Skip to main content
Beyond basic tools and knowledge bases, agents take three further configuration options: MCP (Model Context Protocol) servers for external tool integrations, hooks for triggering webhooks on agent lifecycle events, and an approval flow that pauses execution until a human approves sensitive tool calls. This guide walks through each one.
Prerequisites:
  • An agent created (see Build an Agent guide)
1

Add an MCP server

Connect an external MCP server to your agent. The agent discovers and calls tools exposed by the MCP server over HTTP transport (default; SSE is also accepted) during runs.Endpoint: POST /api/agents/{id}/mcp-servers
The agent connects to the MCP server at the start of each run to discover available tools. Tools are then available alongside builtin tools and knowledge base search.
Response:
2

Configure a webhook hook

Add an HTTP webhook hook that fires before each tool call. Use hooks to log tool usage, enforce policies, or notify external systems.Endpoint: POST /api/agents/{id}/hooks
This example uses PreToolUse, but hooks fire at six lifecycle events (OnRunStart, PreToolUse, OnDelegation, PostToolUse, PreResponse, OnRunComplete) and come in three types (http, rule, approval). Use the optional matcher field to target a specific tool by name. See Hooks & Middleware for the full event semantics and the webhook request/response contract.
3

Enable approval flow

Add an approval hook to the agent. When a tool call matches, the run pauses and emits an approval_requested SSE event. The run waits until you approve or reject via the API.Endpoint: POST /api/agents/{id}/hooks
Set matcher to a specific tool name to only require approval for that tool, or omit matcher to require approval for all tool calls.
4

Approve a pending tool call

When an approval_requested event pauses a run, call the approve endpoint to let execution continue, or reject to skip the tool call.Endpoint: POST /api/agents/runs/{run_id}/approve
After approval, the SSE stream resumes and the tool executes normally. After rejection, the agent skips the tool call and may try a different approach or respond to the user directly.

What’s Next

Agents & Tools

Understand the full tool system including MCP, builtins, and custom tools.

Orchestration

Coordinate multiple agents working together.

Agents API Reference

Full endpoint documentation for agents.