Compile this worker recipe into a runtime agent definition.
(self)
| 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 | |
| 394 | impl From<WorkerAgentSpec> for AgentDefinition { |