MCPcopy Index your code
hub / github.com/AI45Lab/Code / into_agent_definition

Method into_agent_definition

core/src/subagent.rs:364–391  ·  view source on GitHub ↗

Compile this worker recipe into a runtime agent definition.

(self)

Source from the content-addressed store, hash-verified

362
363 /// Compile this worker recipe into a runtime agent definition.
364 pub fn into_agent_definition(self) -> AgentDefinition {
365 let mut agent = AgentDefinition::new(&self.name, &self.description)
366 .with_permissions(
367 self.permissions
368 .unwrap_or_else(|| self.kind.default_permissions()),
369 )
370 .with_max_steps(
371 self.max_steps
372 .unwrap_or_else(|| self.kind.default_max_steps()),
373 );
374
375 if self.hidden {
376 agent = agent.hidden();
377 }
378 if let Some(model) = self.model {
379 agent = agent.with_model(model);
380 }
381 if let Some(prompt) = self
382 .prompt
383 .or_else(|| self.kind.default_prompt().map(str::to_string))
384 {
385 agent = agent.with_prompt(&prompt);
386 }
387 if let Some(ci) = self.confirmation_inheritance {
388 agent = agent.with_confirmation(ci);
389 }
390 agent
391 }
392}
393
394impl From<WorkerAgentSpec> for AgentDefinition {

Calls 9

with_permissionsMethod · 0.80
default_permissionsMethod · 0.80
default_max_stepsMethod · 0.80
hiddenMethod · 0.80
default_promptMethod · 0.80
with_promptMethod · 0.80
with_confirmationMethod · 0.80
with_max_stepsMethod · 0.45
with_modelMethod · 0.45