MCPcopy Create free account
hub / github.com/AI45Lab/Code / preserves_explicit_host_overrides

Function preserves_explicit_host_overrides

core/src/agent_api/agent_binding.rs:95–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93
94 #[test]
95 fn preserves_explicit_host_overrides() {
96 let def = AgentDefinition::new("planner", "Plan work")
97 .with_model(ModelConfig {
98 provider: Some("anthropic".to_string()),
99 model: "claude-sonnet".to_string(),
100 })
101 .with_prompt("Definition prompt.")
102 .with_max_steps(3);
103 let opts = SessionOptions::new()
104 .with_model("openai/gpt-4o")
105 .with_max_tool_rounds(12)
106 .with_prompt_slots(SystemPromptSlots {
107 role: Some("Host role".to_string()),
108 extra: Some("Host prompt.".to_string()),
109 ..SystemPromptSlots::default()
110 });
111
112 let opts = apply_agent_definition(opts, &def);
113
114 assert_eq!(opts.model.as_deref(), Some("openai/gpt-4o"));
115 assert_eq!(opts.max_tool_rounds, Some(12));
116 let slots = opts.prompt_slots.unwrap();
117 assert_eq!(slots.role.as_deref(), Some("Host role"));
118 assert_eq!(slots.extra.as_deref(), Some("Host prompt."));
119 }
120
121 #[test]
122 fn defaults_model_provider_when_definition_omits_one() {

Callers

nothing calls this directly

Calls 6

apply_agent_definitionFunction · 0.85
with_promptMethod · 0.80
with_prompt_slotsMethod · 0.80
with_max_tool_roundsMethod · 0.80
with_max_stepsMethod · 0.45
with_modelMethod · 0.45

Tested by

no test coverage detected