What Programming Language Is Goose Written In? A Deep Dive into the Rust-Based AI Agent Framework
Goose is written primarily in Rust, utilizing a Cargo workspace architecture with all core components—including the agent logic, CLI, server, and SDK—implemented as Rust crates.
The aaif-goose/goose repository is an AI agent framework designed for performance and portability. According to the project's own documentation in AGENTS.md, Goose is "an AI agent framework in Rust with CLI and Electron desktop interfaces," while the README.md confirms it is "Built in Rust for performance and portability." The entire codebase compiles under a unified Cargo workspace defined in the top-level Cargo.toml.
Evidence from the Source Code
Workspace Structure and Configuration
The repository root contains a Cargo.toml file that defines a Rust workspace, listing all member crates under the crates/ directory. This configuration confirms that Rust is the sole programming language used for the core implementation. The workspace includes crates for the core agent, CLI binary, HTTP server, MCP extensions, and the embeddable SDK.
Core Implementation Files
All source files use the .rs extension, confirming Rust as the implementation language:
crates/goose/src/agents/agent.rs– Contains the core agent implementation handling conversation flow, tool orchestration, and session managementcrates/goose-cli/src/main.rs– Entry point for the command-line interface binarycrates/goose-server/src/main.rs– Entry point for the HTTP server backendcrates/goose-sdk/examples/acp_client.rs– Demonstrates SDK usage for embedding Goose in other Rust applications
Architectural Components Written in Rust
The Goose codebase is organized into distinct Rust crates, each serving a specific architectural layer:
- Core Agent Logic – Located in
crates/goose/, this crate handles conversation flow, tool orchestration, retry logic, security features, and session management - CLI Interface – The
crates/goose-cli/crate provides the user-facing command-line interface, with the main entry point atsrc/main.rs - Server Backend –
crates/goose-server/implements an HTTP API using the Axum web framework, exposing the agent for external clients - MCP Extensions – The
crates/goose-mcp/crate implements the plugin system using the Model Context Protocol - Rust SDK –
crates/goose-sdk/provides a library for embedding Goose functionality in other Rust projects - Test Utilities – Supporting crates like
goose-test/andgoose-test-support/provide integration testing frameworks
Working with Goose's Rust Codebase
Using the SDK in Rust Applications
The Goose SDK allows you to embed agent capabilities directly into Rust programs. The following example from crates/goose-sdk/examples/acp_client.rs demonstrates spawning a Goose binary and querying available extensions:
use goose_sdk::custom_requests::GetExtensionsRequest;
use sacp::Client;
// A minimal async function that starts a Goose ACP session and prints available extensions.
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Spawn the Goose binary (assumes `goose` is on $PATH)
let child = goose_sdk::acp::spawn_goose_binary().await?;
let transport = child.transport();
// Connect the ACP client
let client = Client::builder()
.name("sdk-example")
.on_receive_notification(|_, _| Ok(()), sacp::on_receive_notification!())
.connect_with(transport, async move |cx| {
// Initialise the agent
cx.send_request(sacp::schema::InitializeRequest::new(
sacp::schema::ProtocolVersion::LATEST,
))
.await?;
// Query installed extensions
let resp = cx.send_request(GetExtensionsRequest {}).await?;
println!("Installed extensions: {:?}", resp.extensions);
Ok(())
})
.await?;
client.shutdown().await;
Ok(())
}
Building and Running the CLI
Since Goose is a Rust project, you compile and install it using Cargo. The CLI logic resides in crates/goose-cli/src/main.rs:
# Install the latest binary from the local source
cargo install --path crates/goose-cli
# Show the help menu to verify installation
goose --help
# Start an interactive chat session
goose
Embedding the HTTP Server
The Goose server is implemented as an Axum-based HTTP API. You can embed it directly in Rust applications using the server crate:
use goose_server::server::run_server;
#[tokio::main]
async fn main() {
// The server reads the global config and starts an HTTP API on port 8080.
run_server().await.expect("Failed to start Goose server");
}
The server entry point is defined in crates/goose-server/src/main.rs.
Summary
- Goose is implemented entirely in Rust, using a Cargo workspace structure for modular development.
- The repository
aaif-goose/gooseorganizes code into specialized crates under thecrates/directory. - Core components—including the agent logic (
crates/goose/), CLI (crates/goose-cli/), server (crates/goose-server/), and SDK (crates/goose-sdk/)—are all Rust-based. - Documentation in
AGENTS.mdandREADME.mdexplicitly confirms the Rust implementation choice for performance and portability. - The project compiles as a unified workspace defined in the top-level
Cargo.toml.
Frequently Asked Questions
Is Goose written entirely in Rust?
Yes, the core Goose framework is written entirely in Rust. All agent logic, CLI tools, HTTP server, MCP extensions, and the SDK are implemented as Rust crates within a Cargo workspace. The Cargo.toml workspace configuration and the presence of .rs source files throughout the repository confirm this.
Why did Goose choose Rust as its programming language?
According to the project's README.md, Goose chose Rust for performance and portability. Rust's memory safety guarantees, zero-cost abstractions, and ability to compile to native binaries across platforms make it ideal for an AI agent framework that requires reliable, high-performance execution.
Can I extend Goose using other programming languages?
While Goose's core is written in Rust, it exposes interfaces that may allow interaction with other languages. The Model Context Protocol (MCP) extensions in crates/goose-mcp/ provide a plugin system that could theoretically support extensions written in other languages, though the primary extension mechanism and all core APIs are Rust-based.
How do I build Goose from source?
Since Goose is a Rust project, you build it using Cargo. Clone the aaif-goose/goose repository and run cargo build --release from the workspace root. Individual components can be installed using cargo install --path crates/goose-cli for the CLI or cargo install --path crates/goose-server for the server binary.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →