class AgentDefinition
Bases:BaseModel
Agent definition loaded from Markdown file.
Agents are specialized configurations that can be triggered based on
user input patterns. They define custom system prompts and tool access.
Properties
color: str | Nonedescription: strhooks: HookConfig | Nonemax_iteration_per_run: int | Nonemcp_servers: dict[str, Any] | Nonemetadata: dict[str, Any]model: strname: strpermission_mode: str | Noneprofile_store_dir: str | Noneskills: list[str]source: str | Nonesystem_prompt: strtools: list[str]when_to_use_examples: list[str]
Methods
get_confirmation_policy()
Convert permission_mode to a ConfirmationPolicyBase instance. Returns None when permission_mode is None (inherit parent policy).classmethod load()
Load an agent definition from a Markdown file. Agent Markdown files have YAML frontmatter with:- name: Agent name
- description: Description with optional
<example>tags for triggering - tools (optional): List of allowed tools
- skills (optional): Comma-separated skill names or list of skill names
- mcp_servers (optional): MCP server configurations mapping
- model (optional): Model profile to use (default: ‘inherit’)
- color (optional): Display color
- permission_mode (optional): How the subagent handles permissions
- max_iterations_per_run: Max iteration per run
- hooks (optional): List of applicable hooks
- Parameters:
agent_path– Path to the agent Markdown file. - Returns: Loaded AgentDefinition instance.

