TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/block/goose/llms.txt
Use this file to discover all available pages before exploring further.
Agent is the main orchestrator in Goose that manages conversations, extensions, tools, and provider interactions.
Overview
The Agent is responsible for:- Managing conversation flow and message handling
- Coordinating tool execution (both platform and extension tools)
- Managing extensions (MCP servers, frontend tools)
- Handling permission checks and confirmations
- Processing retry logic and error recovery
- Auto-compaction of conversation history
Struct Definition
crates/goose/src/agents/agent.rs:136-153
Configuration
AgentConfig
Configuration for Agent initialization.crates/goose/src/agents/agent.rs:106-113
Manages session persistence and retrieval
Handles permission policies for tool execution
Optional scheduler for recurring tasks
Operating mode:
Auto, Chat, or AgenticWhether to disable automatic session naming
Platform type:
GooseCli or GooseDesktopGoosePlatform
crates/goose/src/agents/agent.rs:91-94
Constructor Methods
new()
Create a new Agent with default configuration.crates/goose/src/agents/agent.rs:205-216
Example:
with_config()
Create an Agent with custom configuration.Custom agent configuration
crates/goose/src/agents/agent.rs:218-252
Example:
Core Methods
reply()
Process a user message and generate a streaming response.The user’s input message
Session configuration including ID and settings
Token to cancel the operation
AgentEvent including messages, tool calls, and system notifications
Source: crates/goose/src/agents/agent.rs:871-1078
Example:
provider()
Get the current LLM provider.crates/goose/src/agents/agent.rs:447-452
Extension Management
add_extension()
Add a new extension to the agent.Configuration for the extension (MCP, STDIO, or Frontend)
Session ID to associate the extension with
crates/goose/src/agents/agent.rs:715-734
Example:
remove_extension()
Remove an extension from the agent.Name of the extension to remove
Associated session ID
crates/goose/src/agents/agent.rs:818-830
list_extensions()
Get all active extensions.crates/goose/src/agents/agent.rs:832-837
list_tools()
Get all available tools for a session.Session ID
Optional filter for specific extension
crates/goose/src/agents/agent.rs:796-816
Tool Execution
dispatch_tool_call()
Execute a single tool call.Tool call parameters (name, arguments)
Unique request identifier
Token to cancel the operation
Current session context
crates/goose/src/agents/agent.rs:495-587
Permission Handling
handle_confirmation()
Handle user confirmation for a tool execution.The tool request ID awaiting confirmation
User’s permission decision
crates/goose/src/agents/agent.rs:843-862
Events
AgentEvent
Events emitted during agent execution.crates/goose/src/agents/agent.rs:156-161
A conversation message (user, assistant, tool results)
Notification from an MCP server
The active model changed (for lead-worker providers)
Conversation history was replaced (e.g., after compaction)
Session State Management
save_extension_state()
Persist extension state to session metadata.Session configuration
crates/goose/src/agents/agent.rs:591-611
load_extensions_from_session()
Restore extensions from session metadata.Session containing extension metadata
crates/goose/src/agents/agent.rs:638-713
Related Types
- Session - Session management
- Conversation - Message history
- Config - Configuration system