Overview

Agent Mode lets ModRouter run selected MCP tools automatically when a model requests them. This is useful for workflows where the model should call tools, receive results, and continue until it can produce a final answer. When Agent Mode runs:
  1. The model returns one or more tool calls.
  2. ModRouter executes tools that are configured for auto-execution.
  3. Tool results are sent back to the model.
  4. The loop continues until the model returns a final answer or the maximum depth is reached.
Agent Mode is not compatible with streaming responses. Use non-streaming chat or responses endpoints when auto-executing tools.

Configure Auto-Executable Tools

Use tools_to_execute to make tools available and tools_to_auto_execute to allow selected tools to run without application-side approval.
Only tools included in tools_to_execute can be auto-executed.

Send a Request

Go SDK

Choosing Auto-Executable Tools

Only mark deterministic, low-risk tools for auto-execution. For tools that write files, trigger external actions, or make irreversible changes, return the tool call to your application and ask for approval before execution.