Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions public/__redirects
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,26 @@
/aegis/analytics/ /smart-shield/configuration/dedicated-egress-ips/ips-utilization/ 301

# agents
/agents/tools/code-execution/ /agents/sandboxes-and-workspaces/ 301
/agents/tools/code-execution/sandbox/ /agents/sandboxes-and-workspaces/sandbox/ 301
/agents/tools/persistent-files/ /agents/sandboxes-and-workspaces/persistent-files/ 301
/agents/tools/code-execution/run-javascript/ /agents/sandboxes-and-workspaces/run-javascript/ 301
/agents/tools/code-execution/persistent-files/ /agents/sandboxes-and-workspaces/computer-container-backend/ 301
/agents/tools/persistent-files/persistence/ /agents/sandboxes-and-workspaces/persistence/ 301
/agents/tools/persistent-files/reference/ /agents/sandboxes-and-workspaces/reference/ 301
/agents/tools/codemode/ai-sdk/ /agents/tools/codemode/integrations/ai-sdk/ 301
/agents/tools/codemode/tanstack-ai/ /agents/tools/codemode/integrations/tanstack-ai/ 301
/agents/tools/codemode/browser/ /agents/tools/codemode/integrations/browser/ 301
/agents/tools/codemode/mcp/ /agents/tools/codemode/integrations/mcp/ 301
/agents/tools/codemode/openapi/ /agents/tools/codemode/integrations/openapi/ 301
/agents/tools/computer-container/ /agents/sandboxes-and-workspaces/computer-container-backend/ 301
/agents/tools/files-and-code/ /agents/sandboxes-and-workspaces/ 301
/agents/tools/files-and-code/persistent-files/ /agents/sandboxes-and-workspaces/persistent-files/ 301
/agents/tools/files-and-code/persistence/ /agents/sandboxes-and-workspaces/persistence/ 301
/agents/tools/files-and-code/reference/ /agents/sandboxes-and-workspaces/reference/ 301
/agents/tools/files-and-code/run-javascript/ /agents/sandboxes-and-workspaces/run-javascript/ 301
/agents/tools/files-and-code/run-linux/ /agents/sandboxes-and-workspaces/computer-container-backend/ 301
/agents/tools/sandbox/ /agents/sandboxes-and-workspaces/sandbox/ 301
/agents/communication-channels/ /agents/agent-class/communication-channels/ 301
/agents/communication-channels/chat/ /agents/agent-class/communication-channels/chat/ 301
/agents/communication-channels/chat/autonomous-responses/ /agents/agent-class/communication-channels/chat/autonomous-responses/ 301
Expand Down
6 changes: 5 additions & 1 deletion src/components/cf/AgentsPlatformDiagram.astro
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ const runtime = [
];

const tools = [
{ type: "Sandbox", name: "Bash/Shell", href: "/agents/tools/sandbox/" },
{
type: "Sandbox",
name: "Bash/Shell",
href: "/agents/sandboxes-and-workspaces/",
},
{ type: "MCP", name: "Servers", href: "/agents/tools/mcp/" },
{ type: "Browser", name: "CDP", href: "/agents/tools/browser/" },
{ type: "AI Search", name: "Retrieval", href: "/agents/tools/ai-search/" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class MyAgent extends Think<Env> {

This setting skips Think's automatic `getAITools()` call. MCP registration, restoration, discovery, raw catalog access, direct calls, and Code Mode connectors continue to work.

Use [`listTools()`](/agents/model-context-protocol/apis/client-api/#thismcplisttools) when you only need the raw MCP catalog. For connector setup, refer to [Use MCP tools with Code Mode](/agents/tools/codemode/mcp/).
Use [`listTools()`](/agents/model-context-protocol/apis/client-api/#thismcplisttools) when you only need the raw MCP catalog. For connector setup, refer to [Use MCP tools with Code Mode](/agents/tools/codemode/integrations/mcp/).

## Invoke the Code Mode runtime without the AI SDK

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ export class MyAgent extends DurableObject<Env> {

</TypeScriptExample>

When recovery is triggered, the JavaScript runs again from the beginning, reusing recorded results for completed calls without printing previously recorded output again. If a call's result was not recorded before the interruption, recovery may repeat the call — even if its action already succeeded. For retry handling, including `unsafeToRepeat()` for operations that cannot safely repeat, refer to [Calls that must not run twice](/agents/tools/filesystem/#calls-that-must-not-run-twice).
When recovery is triggered, the JavaScript runs again from the beginning, reusing recorded results for completed calls without printing previously recorded output again. If a call's result was not recorded before the interruption, recovery may repeat the call — even if its action already succeeded. For retry handling, including `unsafeToRepeat()` for operations that cannot safely repeat, refer to [Calls that must not run twice](/agents/sandboxes-and-workspaces/run-javascript/#calls-that-must-not-run-twice).

Recovery starts on the next call to `workspace.runtime`. To recover without waiting for traffic, call `workspace.runtime.recover()` from a [Durable Object alarm](/durable-objects/api/alarms/).

## Wait for approvals

![A run pauses at an approval gate, then resumes when approved or fails when rejected](~/assets/images/agents/computer-approval-flow.svg)

Expose your application functions through [custom modules](/agents/tools/filesystem/#give-code-access-to-your-own-functions). A function can call `ctx.interrupt()` to pause the run until your application supplies an approval decision.
Expose your application functions through [custom modules](/agents/sandboxes-and-workspaces/run-javascript/#give-code-access-to-your-own-functions). A function can call `ctx.interrupt()` to pause the run until your application supplies an approval decision.

### Require approval before posting a comment

Expand Down Expand Up @@ -103,4 +103,4 @@ for (const call of await workspace.runtime.pending()) {

The run continues once all pending calls are resolved.

For setup, current limitations, and how replay works, refer to [Resume runs after a restart](/agents/tools/filesystem/#resume-runs-after-a-restart).
For setup, current limitations, and how replay works, refer to [Resume runs after a restart](/agents/sandboxes-and-workspaces/run-javascript/#resume-runs-after-a-restart).
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ With 1.0, your class can:
- Serve [previews](/sandbox/previews/) from ports in the sandbox, with your own hostnames and authentication.
- Handle outbound requests for each hostname in Worker code, so [credentials](/sandbox/network/call-an-authenticated-api/) and bindings stay in your Worker.
- Expose only the methods that you want callers to use.
- Run an [agent](/agents/tools/sandbox/) in the same Durable Object, and give the model a tool that runs commands in the sandbox.
- Run an [agent](/agents/sandboxes-and-workspaces/sandbox/) in the same Durable Object, and give the model a tool that runs commands in the sandbox.

<TypeScriptExample filename="src/index.ts">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,8 @@ export class ChatAgent extends AIChatAgent {

</TypeScriptExample>

To let the model combine these tools by writing JavaScript, use the [Code Mode AI SDK integration](/agents/tools/codemode/integrations/ai-sdk/).

### Client-side tools

Define a tool on the server without `execute`, then handle it on the client with `onToolCall`. Use this for tools that need browser APIs.
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/agents/concepts/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction)
An Agent can expose MCP tools through either model interface:

- Pass MCP tools directly to a model with the [Agents MCP client](/agents/tools/mcp/).
- Expose MCP tools inside Code Mode for composition and progressive discovery with [MCP connectors](/agents/tools/codemode/mcp/).
- Expose MCP tools inside Code Mode for composition and progressive discovery with [MCP connectors](/agents/tools/codemode/integrations/mcp/).

An MCP server can also expose Code Mode itself. For example, it can present one `code` tool or separate `search` and `execute` tools. For these server-side patterns, refer to [Build a Code Mode MCP server](/agents/model-context-protocol/guides/build-codemode-mcp-server/).

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/agents/harnesses/think/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export class MyAgent extends Think<Env> {

`includeMcpTools` controls only the automatic model tool merge. MCP connections still register, restore, discover, and wait. Raw catalog access, direct calls, Code Mode connectors, and explicit `this.mcp.getAITools()` calls continue to work.

Use this property instead of removing MCP tool names through `activeTools` in `beforeTurn`. Think converts MCP schemas before it calls `beforeTurn`, so `activeTools` cannot avoid that conversion. To configure a connector runtime, refer to [Use MCP tools with Code Mode](/agents/tools/codemode/mcp/).
Use this property instead of removing MCP tool names through `activeTools` in `beforeTurn`. Think converts MCP schemas before it calls `beforeTurn`, so `activeTools` cannot avoid that conversion. To configure a connector runtime, refer to [Use MCP tools with Code Mode](/agents/tools/codemode/integrations/mcp/).

Add MCP servers programmatically or via `@callable` methods:

Expand Down
22 changes: 20 additions & 2 deletions src/content/docs/agents/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ head:
content: Agents
---

import { PackageManagers, RelatedProduct } from "~/components";
import {
CardGrid,
LinkCard,
PackageManagers,
RelatedProduct,
} from "~/components";
import AgentsPlatformDiagram from "~/components/cf/AgentsPlatformDiagram.astro";

Build and host Agents on Cloudflare, connect chat, voice, email, Slack, and webhooks to a durable agent runtime with Browser, Sandbox, AI Search, MCP, Payments, and other MCP tools.
Expand All @@ -27,7 +32,20 @@ Agents on Cloudflare are composed from four parts:
- **Communication channels** define how users and systems reach your agent, such as [chat](/agents/agent-class/communication-channels/chat/), [voice](/agents/agent-class/communication-channels/voice/), [email](/agents/agent-class/communication-channels/email/), [Slack](/agents/agent-class/communication-channels/slack/), [webhooks](/agents/agent-class/communication-channels/webhooks/), and other event sources.
- **The agent harness** defines the loop: how the agent calls models, selects tools, handles tool results, streams responses, and decides whether to continue. Use the [Pi harness](/agents/harnesses/pi/) to run Pi Durable in a Durable Object, or build your own loop directly on the [Agents SDK runtime](/agents/agent-class/).
- **The Agents SDK runtime** provides durable infrastructure: the [`Agent` class](/agents/agent-class/internals/), [state](/agents/agent-class/state/), [sessions](/agents/runtime/lifecycle/sessions/), [routing](/agents/agent-class/routing/), [WebSockets](/agents/agent-class/websockets/), [scheduling](/agents/agent-class/schedule-tasks/), [fibers](/agents/agent-class/durable-execution/), and [observability](/agents/runtime/operations/observability/).
- **Tools** give the agent capabilities: [browser automation](/agents/tools/browser/), [sandboxed code execution](/agents/tools/sandbox/), [AI Search](/agents/tools/ai-search/), [MCP tools](/agents/tools/mcp/), and [payments](/agents/tools/payments/). [Code Mode](/agents/tools/codemode/) lets models discover and orchestrate multiple tools by writing code.
- **Tools** give the agent capabilities: [browser automation](/agents/tools/browser/), [sandboxed code execution](/agents/sandboxes-and-workspaces/sandbox/), [AI Search](/agents/tools/ai-search/), [MCP tools](/agents/tools/mcp/), and [payments](/agents/tools/payments/). [Code Mode](/agents/tools/codemode/) lets models discover and orchestrate multiple tools by writing code.

<CardGrid>
<LinkCard
title="Sandboxes and workspaces"
href="/agents/sandboxes-and-workspaces/"
description="Give your agent persistent files and an isolated environment to run code."
/>
<LinkCard
title="Code Mode"
href="/agents/tools/codemode/"
description="Let your agent combine tool calls by writing code."
/>
</CardGrid>

### Get started

Expand Down
Loading
Loading