This feature is only available on
v1.4.0-prerelease1 and above.Overview
Agent Mode enables Bifrost to automatically execute tool calls without requiring explicit execution API calls for each tool. This transforms Bifrost from a simple gateway into an autonomous agent runtime. When Agent Mode is enabled:- LLM returns tool calls in its response
- Bifrost automatically executes auto-executable tools
- Results are fed back to the LLM
- Loop continues until no more tool calls OR max depth reached
- Non-auto-executable tools are returned to your application for approval
Configuration
Agent Mode requires two configurations:tools_to_execute: Which tools are available (whitelist)tools_to_auto_execute: Which tools can run automatically (subset of above)
Tools To Execute vs Tools To Auto Execute
A tool in
tools_to_auto_execute that is NOT in tools_to_execute will be ignored. The execute list takes precedence.Gateway Setup
- Web UI
- API
- config.json
Configuring Auto-Execute Tools
- Navigate to MCP Gateway in the left sidebar
- Click on a client to open its configuration sheet
- Scroll to the Available Tools section
- For each tool, toggle the Automatically execute tool switch
- Click Save Changes to apply
Global Agent Settings
Configure max depth and other agent settings via:Gateway API:Go SDK Setup
Agent Mode Behavior
Max Depth
Themax_agent_depth setting limits how many iterations the agent can perform:
- Default: 10 iterations
- Each LLM call that produces tool calls counts as one iteration
- When max depth is reached, the current response is returned (may contain pending tool calls)
Parallel Execution
Auto-executable tools are executed in parallel for performance:Mixed Auto/Non-Auto Tools
When a response contains both auto-executable and non-auto-executable tools:- Auto-executable tools are executed first
- The response is returned with:
- A text
contentfield containing the executed tool results as JSON - Pending non-auto-executable tool calls in
tool_calls finish_reasonset to"stop"
- A text
The
content field contains a JSON summary of executed tool results. The tool_calls array contains only the non-auto-executable tools that require your approval. The finish_reason is set to "stop" to exit the agent loop.- Parse the
contentfield to see what was already executed - Review the pending non-auto-executable tools in
tool_calls - Execute or reject them manually
- Continue the conversation with results
Security Considerations
Recommended Patterns
Safe for Auto-Execute:- Read operations (
read_file,list_directory) - Search/query operations (
search,fetch_url) - Non-destructive information gathering
- Write operations (
write_file,create_file) - Delete operations (
delete_file,delete_record) - Execute operations (
run_command,execute_script) - Operations with side effects (sending emails, making purchases)
Example: Safe Configuration
Tool Execution Timeout
Individual tool executions are bounded bytool_execution_timeout:
- Default: 30 seconds
- If a tool exceeds the timeout, an error result is returned
- The agent loop continues with the error result
Advanced: Agent Loop Internals
Iteration Tracking
When Agent Mode executes, each iteration through the LLM and tool execution cycle increments a counter. You can track this for logging and debugging:max_agent_depth setting controls maximum iterations:
- Default: 10
- Range: 1-50 (configurable)
- When reached, current response returned as-is (may contain pending tool calls)
Custom Request ID Management
For complex workflows, track each iteration with unique request IDs:- Audit trail of intermediate steps
- Correlation of tool executions to iterations
- Detailed observability for agent behavior
Parallel vs Sequential Execution
Auto-executable tools run in parallel for performance:Response Format in Agent Mode
When Agent Mode finds mixed auto/non-auto tools:content field contains JSON summary of executed tool results. The tool_calls array contains only non-auto-executable tools.
Next Steps
Code Mode
Let AI write code to orchestrate multiple tools
Tool Filtering
Control tool availability per request

