Skip to main content
Goose is built with a layered, extensible architecture designed to support multiple interfaces, AI providers, and tool integrations. This design enables developers to customize every aspect of the system—from UI to model providers to custom tools.

System Overview

Goose follows a classic client-server architecture with pluggable components at each layer:

Core Components

1. User Interfaces

Goose provides multiple ways to interact with the agent:
  • CLI (goose-cli): Command-line interface for terminal users
  • Desktop App: Electron-based application with rich UI features
  • Custom Interfaces: Build your own via REST API or Agent Client Protocol

2. Server Layer

The server layer provides two integration protocols:

REST API (goose-server)

HTTP-based API suitable for web applications and simple integrations.

Agent Client Protocol (ACP)

JSON-RPC protocol for richer integrations with bidirectional communication.

3. Core Layer

The core layer (crates/goose/) contains the main business logic:

Agent

The central orchestrator that manages conversation flow, tool execution, and provider interaction.
Key responsibilities:
  • Managing conversation context
  • Coordinating tool execution
  • Handling provider streaming
  • Managing permissions and security
  • Orchestrating subagents

Extension Manager

Manages MCP (Model Context Protocol) servers that provide tools and resources to the agent.
Features:
  • Dynamic extension loading/unloading
  • Tool discovery and caching
  • Resource management (MCP resources)
  • OAuth flow handling for authenticated extensions

Provider Registry

Abstracts AI model providers behind a common interface.
Supports:
  • 25+ AI providers (Anthropic, OpenAI, Ollama, etc.)
  • Custom provider plugins
  • Model capability detection
  • Token counting and cost estimation

Session Manager

Handles persistent state, conversation history, and session metadata.

4. Integration Layer

MCP Servers

Goose uses the Model Context Protocol to integrate external tools:
Extensions can be:
  • Built-in: Bundled with Goose
  • Stdio: External processes communicating via stdin/stdout
  • SSE: HTTP-based Server-Sent Events

AI Providers

Providers implement the Provider trait to connect to AI models:

Data Flow

A typical request flows through the system as follows:

Configuration and Customization

Configuration Files

Goose uses a layered configuration system:

Environment Variables

Configuration precedence: Environment > config.yaml > defaults

Recipes

YAML-based configuration for complete agent experiences:

Security Model

Goose implements multiple security layers:

Permission System

Applied to:
  • Tool execution
  • File system access
  • Network requests
  • Environment variable access

Extension Sandboxing

  • Extensions run as separate processes
  • Controlled environment variables (see Envs::DISALLOWED_KEYS)
  • Malware scanning for downloaded extensions
  • Resource limits and timeouts

Session Isolation

  • Each session has isolated state
  • Working directory restrictions
  • Extension data partitioning

Extension Points

The architecture supports customization at multiple levels:

Build System

Goose uses a Rust workspace structure:
Key build commands:

Performance Considerations

Context Management

Goose implements automatic context compaction when messages approach token limits:

Tool Call Parallelization

Multiple tool calls in a single model response execute in parallel:

Caching

  • Tool lists cached and versioned for quick access
  • Provider capabilities cached per model
  • Session data persisted to SQLite for fast retrieval
For custom distribution guidance, see the CUSTOM_DISTROS.md guide in the Goose repository.

Next Steps

Agents

Learn about agent orchestration and subagents

Providers

Explore AI provider integration

Extensions

Understand the MCP extension system

Sessions

Discover session management