Parse an agent definition from YAML content. The YAML can describe either a full [`AgentDefinition`] or a cattle-style [`WorkerAgentSpec`] by including a `kind` field.
(content: &str)
| 685 | /// The YAML can describe either a full [`AgentDefinition`] or a cattle-style |
| 686 | /// [`WorkerAgentSpec`] by including a `kind` field. |
| 687 | pub fn parse_agent_yaml(content: &str) -> anyhow::Result<AgentDefinition> { |
| 688 | let value: serde_yaml::Value = serde_yaml::from_str(content) |
| 689 | .map_err(|e| anyhow::anyhow!("Failed to parse agent YAML: {}", e))?; |
| 690 | |
| 691 | parse_agent_yaml_value(value, "agent YAML") |
| 692 | } |
| 693 | |
| 694 | fn parse_agent_yaml_value( |
| 695 | value: serde_yaml::Value, |