Skip to content
✨ agentgateway has joined the Agentic AI Foundation (AAIF) — Learn more

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Page as Markdown

Goose

Route Goose’s LLM traffic through agentgateway to govern an autonomous agent’s model and tool calls.

Goose is an open-source, on-machine AI agent from Block that combines LLM reasoning with tool execution via the Model Context Protocol (MCP). Routing Goose’s LLM calls through agentgateway gives you a single place to apply rate limits, capture audit logs, and switch providers without reconfiguring the agent.

What you get

  • A consistent OpenAI-compatible endpoint Goose can target with its openai provider, regardless of the upstream model.
  • API keys held by agentgateway, not pasted into Goose’s config file.
  • Per-request metrics and access logs for every LLM call the agent makes.

Architecture

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│      Goose      │────▶│   agentgateway  │────▶│  LLM provider   │
│      (CLI)      │     │   (port 3000)   │     │ (OpenAI, etc.)  │
└─────────────────┘     └─────────────────┘     └─────────────────┘

Before you begin

  1. Install the agentgateway binary.
  2. Install Goose by following the Goose installation guide.
  3. Have an LLM provider API key, such as an OpenAI API key.

Steps

Step 1: Configure agentgateway

Create a config.yaml:

# yaml-language-server: $schema=https://agentgateway.dev/schema/config

llm:
  port: 3000
  models:
  - name: "*"
    provider: openAI
    params:
      apiKey: "$OPENAI_API_KEY"

Step 2: Start agentgateway

export OPENAI_API_KEY='<your-api-key>'
agentgateway -f config.yaml

Step 3: Point Goose at agentgateway

Goose reads provider settings from environment variables or from ~/.config/goose/config.yaml. Configure Goose to use the OpenAI provider with agentgateway as the host.

export GOOSE_PROVIDER=openai
export GOOSE_MODEL=gpt-4o
export OPENAI_HOST=http://localhost:3000
export OPENAI_API_KEY=placeholder

The following table describes each environment variable:

VariableDescription
GOOSE_PROVIDERThe LLM provider Goose uses. Set to openai so Goose speaks the OpenAI-compatible API.
GOOSE_MODELThe model to use. Must be set — Goose will not start without a model configured.
OPENAI_HOSTThe base URL of the agentgateway proxy.
OPENAI_API_KEYMust be non-empty for Goose to start, but it is not used to call OpenAI — agentgateway holds the real key.

Equivalent ~/.config/goose/config.yaml:

GOOSE_PROVIDER: openai
GOOSE_MODEL: gpt-4o
OPENAI_HOST: http://localhost:3000

Step 4: Run Goose

Start an interactive session:

goose session

Or send a one-shot prompt to verify the connection:

goose run --text "say hello"

Watch the agentgateway logs as Goose makes LLM calls. You should see a log entry showing the request was forwarded to the OpenAI endpoint with the configured model:

info  request gateway=default/default listener=llm route=internal/model:* endpoint=api.openai.com:443 http.method=POST http.path=/v1/chat/completions http.status=200 protocol=llm gen_ai.operation.name=chat gen_ai.provider.name=openai gen_ai.request.model=gpt-4o gen_ai.usage.input_tokens=4419 gen_ai.usage.output_tokens=10 duration=2195ms

Next steps

Goose can also use MCP servers as tools. To proxy and govern MCP tool calls through agentgateway, see the MCP setup guides.

Was this page helpful?
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.