#[non_exhaustive]pub struct ManagedAgentDef {
pub name: String,
pub model: ModelRef,
pub system: Option<String>,
pub description: Option<String>,
pub tools: Vec<ToolConfig>,
pub mcp_servers: Vec<McpServerConfig>,
pub skills: Vec<SkillRef>,
pub permission_policy: Option<PermissionPolicy>,
pub metadata: Option<BTreeMap<String, String>>,
}Expand description
Declarative agent definition. Serializes to CANON §3.1/§3.6–§3.9.
This struct fully describes an agent’s configuration: which model to use, system prompt, available tools, MCP servers, skills, and permission policies. The runtime builds a runnable agent from this definition.
§Examples
use adk_managed::types::ManagedAgentDef;
// Deserialize from JSON (recommended for external callers)
let json = serde_json::json!({
"name": "my-assistant",
"model": "gemini-2.5-flash",
"system": "You are a helpful assistant."
});
let def: ManagedAgentDef = serde_json::from_value(json).unwrap();
assert_eq!(def.name, "my-assistant");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringHuman-readable agent name.
model: ModelRefProvider-neutral model reference.
system: Option<String>System prompt.
description: Option<String>Agent description.
tools: Vec<ToolConfig>Tool declarations (built-in + custom).
mcp_servers: Vec<McpServerConfig>MCP server configurations.
skills: Vec<SkillRef>Skill references.
permission_policy: Option<PermissionPolicy>Permission policy for tools.
metadata: Option<BTreeMap<String, String>>Caller metadata (arbitrary key-value pairs).
Implementations§
Source§impl ManagedAgentDef
impl ManagedAgentDef
Sourcepub fn new(name: impl Into<String>, model: ModelRef) -> Self
pub fn new(name: impl Into<String>, model: ModelRef) -> Self
Create a new ManagedAgentDef with required fields and defaults for optional ones.
§Arguments
name- Human-readable agent namemodel- Provider-neutral model reference
§Example
use adk_managed::types::{ManagedAgentDef, ModelRef};
let def = ManagedAgentDef::new("my-agent", ModelRef::Shorthand("gemini-2.5-flash".to_string()))
.with_system("You are a helpful assistant.");Sourcepub fn with_system(self, system: impl Into<String>) -> Self
pub fn with_system(self, system: impl Into<String>) -> Self
Set the system prompt.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the agent description.
Sourcepub fn with_tools(self, tools: Vec<ToolConfig>) -> Self
pub fn with_tools(self, tools: Vec<ToolConfig>) -> Self
Set the tool declarations.
Sourcepub fn with_mcp_servers(self, mcp_servers: Vec<McpServerConfig>) -> Self
pub fn with_mcp_servers(self, mcp_servers: Vec<McpServerConfig>) -> Self
Set the MCP server configurations.
Sourcepub fn with_skills(self, skills: Vec<SkillRef>) -> Self
pub fn with_skills(self, skills: Vec<SkillRef>) -> Self
Set the skill references.
Sourcepub fn with_permission_policy(self, policy: PermissionPolicy) -> Self
pub fn with_permission_policy(self, policy: PermissionPolicy) -> Self
Set the permission policy.
Sourcepub fn with_metadata(self, metadata: BTreeMap<String, String>) -> Self
pub fn with_metadata(self, metadata: BTreeMap<String, String>) -> Self
Set caller metadata.
Trait Implementations§
Source§impl Clone for ManagedAgentDef
impl Clone for ManagedAgentDef
Source§fn clone(&self) -> ManagedAgentDef
fn clone(&self) -> ManagedAgentDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more