agents 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -8
- package/dist/{agent-tool-types-NofdbL9X.d.ts → agent-tool-types-Cd1TZPfB.d.ts} +595 -137
- package/dist/agent-tool-types.d.ts +34 -18
- package/dist/agent-tool-types.js +20 -1
- package/dist/agent-tool-types.js.map +1 -0
- package/dist/agent-tools-BXlsuX0d.js +304 -0
- package/dist/agent-tools-BXlsuX0d.js.map +1 -0
- package/dist/agent-tools-_E8wxUIK.d.ts +119 -0
- package/dist/agent-tools.d.ts +24 -18
- package/dist/agent-tools.js.map +1 -1
- package/dist/ai-chat-agent.d.ts +1 -1
- package/dist/ai-chat-agent.js +1 -2
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-chat-v5-migration.d.ts +1 -1
- package/dist/ai-chat-v5-migration.js +1 -2
- package/dist/ai-chat-v5-migration.js.map +1 -1
- package/dist/ai-react.d.ts +1 -1
- package/dist/ai-react.js +1 -2
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.d.ts +1 -7
- package/dist/ai-types.js +2 -8
- package/dist/ai-types.js.map +1 -1
- package/dist/browser/ai.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/chat/index.d.ts +1923 -76
- package/dist/chat/index.js +1784 -278
- package/dist/chat/index.js.map +1 -1
- package/dist/chat/react.d.ts +602 -0
- package/dist/chat/react.js +1506 -0
- package/dist/chat/react.js.map +1 -0
- package/dist/chat-sdk/index.d.ts +4 -4
- package/dist/{classPrivateFieldGet2-CZ7QjTXN.js → classPrivateFieldGet2-DZBYAB34.js} +5 -5
- package/dist/{classPrivateMethodInitSpec-D-0__zd9.js → classPrivateMethodInitSpec-qMjJ6sHQ.js} +2 -2
- package/dist/{client-FUizKzj2.js → client-BZ-B3NhC.js} +19 -3
- package/dist/client-BZ-B3NhC.js.map +1 -0
- package/dist/client-tools-aIBO0Fk7.d.ts +53 -0
- package/dist/client.d.ts +76 -57
- package/dist/client.js +33 -5
- package/dist/client.js.map +1 -1
- package/dist/{compaction-helpers-DVcu5lPN.d.ts → compaction-helpers-wUz6M3us.d.ts} +20 -1
- package/dist/{connector-CrKhowfD.js → connector-CdldGF3h.js} +5 -5
- package/dist/{connector-CrKhowfD.js.map → connector-CdldGF3h.js.map} +1 -1
- package/dist/email.js +1 -1
- package/dist/email.js.map +1 -1
- package/dist/experimental/memory/session/index.d.ts +1 -1
- package/dist/experimental/memory/session/index.js +20 -2
- package/dist/experimental/memory/session/index.js.map +1 -1
- package/dist/experimental/memory/utils/index.d.ts +1 -1
- package/dist/{index-B7IbEeze.d.ts → index-CcbnKkNh.d.ts} +188 -14
- package/dist/index.d.ts +91 -71
- package/dist/index.js +562 -24
- package/dist/index.js.map +1 -1
- package/dist/mcp/client.d.ts +18 -14
- package/dist/mcp/client.js +1 -1
- package/dist/mcp/index.d.ts +30 -30
- package/dist/mcp/index.js +7 -7
- package/dist/mcp/index.js.map +1 -1
- package/dist/{agent-tools-3zLG7MgA.js → message-builder-BymO4N_D.js} +45 -126
- package/dist/message-builder-BymO4N_D.js.map +1 -0
- package/dist/observability/index.d.ts +1 -1
- package/dist/observability/index.js +4 -2
- package/dist/observability/index.js.map +1 -1
- package/dist/react.d.ts +123 -110
- package/dist/react.js +44 -11
- package/dist/react.js.map +1 -1
- package/dist/serializable.d.ts +1 -1
- package/dist/skills/compile.js +1 -1
- package/dist/skills/compile.js.map +1 -1
- package/dist/skills/index.js +5 -5
- package/dist/skills/index.js.map +1 -1
- package/dist/sub-routing.d.ts +6 -6
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/vite.js +5 -5
- package/dist/vite.js.map +1 -1
- package/dist/wire-types-nflOzNuU.js +240 -0
- package/dist/wire-types-nflOzNuU.js.map +1 -0
- package/dist/{workflow-types-SrZK_o9p.d.ts → workflow-types-Baz_PO5v.d.ts} +42 -22
- package/dist/workflow-types.d.ts +25 -21
- package/dist/workflow-types.js.map +1 -1
- package/dist/workflows.d.ts +22 -21
- package/dist/workflows.js +31 -7
- package/dist/workflows.js.map +1 -1
- package/docs/adding-to-existing-project.md +450 -0
- package/docs/agent-class.md +503 -0
- package/docs/agent-tools.md +552 -0
- package/docs/browse-the-web.md +430 -0
- package/docs/callable-methods.md +627 -0
- package/docs/chat-agents.md +1687 -0
- package/docs/chat-sdk.md +181 -0
- package/docs/client-sdk.md +520 -0
- package/docs/client-tools-continuation.md +177 -0
- package/docs/codemode.md +440 -0
- package/docs/configuration.md +775 -0
- package/docs/cross-domain-authentication.md +171 -0
- package/docs/durable-execution.md +537 -0
- package/docs/email.md +663 -0
- package/docs/get-current-agent.md +204 -0
- package/docs/getting-started.md +305 -0
- package/docs/http-websockets.md +668 -0
- package/docs/human-in-the-loop.md +661 -0
- package/docs/index.md +151 -0
- package/docs/long-running-agents.md +730 -0
- package/docs/mcp-client.md +620 -0
- package/docs/mcp-servers.md +526 -0
- package/docs/mcp-transports.md +308 -0
- package/docs/migration-to-ai-sdk-v5.md +96 -0
- package/docs/migration-to-ai-sdk-v6.md +163 -0
- package/docs/observability.md +261 -0
- package/docs/push-notifications.md +367 -0
- package/docs/queue.md +329 -0
- package/docs/readonly-connections.md +278 -0
- package/docs/resumable-streaming.md +127 -0
- package/docs/retries.md +444 -0
- package/docs/routing.md +749 -0
- package/docs/scheduling.md +898 -0
- package/docs/securing-mcp-servers.md +359 -0
- package/docs/server-driven-messages.md +477 -0
- package/docs/sessions.md +1024 -0
- package/docs/state.md +512 -0
- package/docs/sub-agents.md +389 -0
- package/docs/webhooks.md +604 -0
- package/docs/workflows.md +877 -0
- package/package.json +47 -15
- package/dist/agent-tools-3zLG7MgA.js.map +0 -1
- package/dist/agent-tools-DLquv-dp.d.ts +0 -14
- package/dist/client-FUizKzj2.js.map +0 -1
package/docs/index.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Agents Documentation
|
|
2
|
+
|
|
3
|
+
Build stateful AI agents on Cloudflare Workers. Every agent is a Durable Object — an addressable, hibernatable actor with its own SQLite database, WebSockets, and scheduling — so you can afford one durable agent per user, account, task, or conversation, with near-zero cost while idle.
|
|
4
|
+
|
|
5
|
+
## Related package documentation
|
|
6
|
+
|
|
7
|
+
- `@cloudflare/codemode/docs/index.md` — the sandbox runtime used by Agents Codemode integrations
|
|
8
|
+
- `@cloudflare/ai-chat/README.md` — React chat clients, resumable streams, client tools, approvals, and storage controls
|
|
9
|
+
|
|
10
|
+
## Choose your path
|
|
11
|
+
|
|
12
|
+
Pick the base class that matches what you are building. They share the same Durable Object foundation, so you can start small and move up without re-platforming.
|
|
13
|
+
|
|
14
|
+
| You are building... | Use | Why |
|
|
15
|
+
| -------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| Stateful backend logic, real-time sync, custom protocols | [`Agent`](./agent-class.md) | The core class: state, WebSockets, scheduling, SQL, and sub-agents. No opinions about chat or LLMs. |
|
|
17
|
+
| A chat UI where you own the loop, the stream, and the response | [`AIChatAgent`](./chat-agents.md) | A thin chat-protocol adapter for `useAgentChat`. Bring your own agentic loop and custom streaming. |
|
|
18
|
+
| A durable, general-purpose reasoning agent | [`Think`](https://github.com/cloudflare/agents/blob/main/docs/think/index.md) | Opinionated runtime: agentic loop, sessions, tools, memory, compaction, recovery, and multi-channel delivery built in. |
|
|
19
|
+
| A voice agent (speech in, speech out) | [Voice mixins](https://github.com/cloudflare/agents/blob/main/docs/voice/index.md) | `withVoice` adds real-time STT/TTS, interruption and barge-in, and conversation persistence to an agent. |
|
|
20
|
+
| Durable multi-step processes (not chat) | [Workflows](./workflows.md) | Long-running, retryable step orchestration with Cloudflare Workflows. |
|
|
21
|
+
|
|
22
|
+
Not sure? Start with [`Agent`](./agent-class.md) for raw building blocks, or [`Think`](https://github.com/cloudflare/agents/blob/main/docs/think/index.md) if you want a chat or reasoning agent that already handles the hard parts.
|
|
23
|
+
|
|
24
|
+
## What makes these production-grade
|
|
25
|
+
|
|
26
|
+
The differentiator is not "we have durable state" — it is what happens when a turn is interrupted. Agents built on this SDK keep their promises across Durable Object eviction, deploys, client disconnects, and human waits:
|
|
27
|
+
|
|
28
|
+
- **Turn recovery** — an in-flight LLM turn survives Durable Object eviction and resumes instead of silently dying. See [Chat & Fiber Recovery](./chat-agents.md#stream-recovery) and [Durable Execution](./durable-execution.md).
|
|
29
|
+
- **Resumable streams** — a disconnected client rejoins the same stream rather than losing the response. See [Resumable Streaming](./resumable-streaming.md).
|
|
30
|
+
- **Recovery-aware delivery** — Think snapshots channel delivery as `accepted`, `streaming`, or `completed`, so a restart replays a not-yet-streamed answer but posts a safe interruption notice rather than risking a duplicate partial reply. See [Messengers — Delivery and Recovery](https://github.com/cloudflare/agents/blob/main/docs/think/messengers.md#delivery-and-recovery).
|
|
31
|
+
- **Durable submissions** — webhooks and RPC callers submit a turn with an idempotency key and check status later, instead of holding a request open. See [Programmatic Submissions](https://github.com/cloudflare/agents/blob/main/docs/think/programmatic-submissions.md).
|
|
32
|
+
- **Human-in-the-loop without hangs** — a turn can pause for approval and resume later. A human wait is a first-class state, not a stuck request. See [Human in the Loop](./human-in-the-loop.md).
|
|
33
|
+
|
|
34
|
+
## Getting Started
|
|
35
|
+
|
|
36
|
+
- [Getting Started](./getting-started.md) - Quick start guide for new users
|
|
37
|
+
- [Adding to an Existing Project](./adding-to-existing-project.md) - Integrate agents into your app
|
|
38
|
+
- [Understanding the Agent Class](./agent-class.md) - Deep dive into the Agent class architecture
|
|
39
|
+
|
|
40
|
+
## Core Concepts
|
|
41
|
+
|
|
42
|
+
- [State Management](./state.md) - Managing agent state with `setState()`, `initialState`, and `onStateChanged()`
|
|
43
|
+
- [Routing](./routing.md) - How `routeAgentRequest()` and agent naming works
|
|
44
|
+
- [Sub-agents](./sub-agents.md) - Parent/child DO composition via facets, nested routing, and direct child connections
|
|
45
|
+
- [HTTP & WebSockets](./http-websockets.md) - Request handling and real-time connections
|
|
46
|
+
- [Callable Methods](./callable-methods.md) - The `@callable` decorator and client-server method calls
|
|
47
|
+
- [Readonly Connections](./readonly-connections.md) - Restricting which connections can modify state
|
|
48
|
+
- [getCurrentAgent()](./get-current-agent.md) - Accessing agent context across async calls
|
|
49
|
+
|
|
50
|
+
## Client SDK
|
|
51
|
+
|
|
52
|
+
- [Client SDK](./client-sdk.md) - Connecting from React (`useAgent`) and vanilla JS (`AgentClient`), state sync, and RPC calls
|
|
53
|
+
|
|
54
|
+
## Communication Channels
|
|
55
|
+
|
|
56
|
+
- [Email Service](./email.md) - Sending, receiving, and replying to emails
|
|
57
|
+
- [Webhooks](./webhooks.md) - Receiving and sending webhook events
|
|
58
|
+
- [Push Notifications](./push-notifications.md) - Browser push notifications via Web Push API and scheduled delivery
|
|
59
|
+
- TODO: [SMS](./sms.md) - Text message integration (Twilio, etc.)
|
|
60
|
+
- [Voice Agents](https://github.com/cloudflare/agents/blob/main/docs/voice/index.md) - Build voice agents with real-time speech-to-text, text-to-speech, and conversation persistence
|
|
61
|
+
- [Chat SDK State](./chat-sdk.md) - Store Chat SDK subscriptions, locks, queues, and history in Agents sub-agents
|
|
62
|
+
- TODO: [Messengers](./messengers.md) - Slack, Discord, Telegram, and other chat platforms
|
|
63
|
+
|
|
64
|
+
## Background Processing
|
|
65
|
+
|
|
66
|
+
- [Queue](./queue.md) - Immediate background task execution
|
|
67
|
+
- [Scheduling](./scheduling.md) - Delayed, scheduled, and cron-based tasks
|
|
68
|
+
- [Retries](./retries.md) - Automatic retries with exponential backoff and jitter
|
|
69
|
+
- [Durable Execution](./durable-execution.md) - `runFiber()`, `startFiber()`, `stash()`, and crash recovery for long tasks
|
|
70
|
+
- [Workflows](./workflows.md) - Durable multi-step processing with Cloudflare Workflows
|
|
71
|
+
- [Human in the Loop](./human-in-the-loop.md) - Approval flows and manual intervention
|
|
72
|
+
|
|
73
|
+
## AI Integration
|
|
74
|
+
|
|
75
|
+
- TODO: [AI SDK Integration](./ai-sdk.md) - Using Vercel AI SDK with agents
|
|
76
|
+
- TODO: [TanStack Integration](./tanstack.md) - Using TanStack AI with agents
|
|
77
|
+
- [Chat Agents](./chat-agents.md) - `AIChatAgent` class and `useAgentChat` React hook
|
|
78
|
+
- [Chat & Fiber Recovery](./chat-agents.md#stream-recovery) - Recover LLM turns after Durable Object eviction
|
|
79
|
+
- [Agent Tools](./agent-tools.md) - Run chat-capable sub-agents as tools with streaming child timelines
|
|
80
|
+
- [Server-Driven Messages](./server-driven-messages.md) - Autonomous agent workflows: scheduled follow-ups, queue processing, webhooks, chained reasoning
|
|
81
|
+
- TODO: [Using AI Models](./using-ai-models.md) - OpenAI, Anthropic, Workers AI, and other providers
|
|
82
|
+
- TODO: [RAG (Retrieval Augmented Generation)](./rag.md) - Vector search with Vectorize
|
|
83
|
+
- [Sessions (Experimental)](./sessions.md) - Persistent conversation storage with tree-structured messages, context blocks, compaction, and search
|
|
84
|
+
- [Workspace (Experimental)](https://github.com/cloudflare/agents/blob/main/docs/shell/index.md) - Durable virtual filesystem backed by SQLite + R2
|
|
85
|
+
- [Codemode (Experimental)](https://github.com/cloudflare/agents/blob/main/docs/agents/codemode.md) - LLM-generated executable code for tool orchestration
|
|
86
|
+
- [Client Tools Continuation](./client-tools-continuation.md) - Handling tool calls across client/server
|
|
87
|
+
- [Resumable Streaming](./resumable-streaming.md) - Automatic stream resumption on client disconnect
|
|
88
|
+
|
|
89
|
+
## Think (Experimental)
|
|
90
|
+
|
|
91
|
+
- [Overview](https://github.com/cloudflare/agents/blob/main/docs/think/index.md) - Opinionated chat agent with built-in memory, tools, and streaming
|
|
92
|
+
- [Getting Started](https://github.com/cloudflare/agents/blob/main/docs/think/getting-started.md) - Build your first Think agent step by step
|
|
93
|
+
- [Lifecycle Hooks](https://github.com/cloudflare/agents/blob/main/docs/think/lifecycle-hooks.md) - `beforeTurn`, `onStepFinish`, `onChunk`, `onChatResponse`, and more
|
|
94
|
+
- [Tools](https://github.com/cloudflare/agents/blob/main/docs/think/tools.md) - Workspace tools, code execution, extensions
|
|
95
|
+
- [Actions](https://github.com/cloudflare/agents/blob/main/docs/think/actions.md) - Server actions with idempotency, approvals, authorization, and reply attachments
|
|
96
|
+
- [Channels](https://github.com/cloudflare/agents/blob/main/docs/think/channels.md) - Per-channel policy, channel selection, and out-of-band notices
|
|
97
|
+
- [Messengers](https://github.com/cloudflare/agents/blob/main/docs/think/messengers.md) - Receive and reply to Chat SDK messenger webhooks from Think
|
|
98
|
+
- [Client Tools](https://github.com/cloudflare/agents/blob/main/docs/think/client-tools.md) - Browser-side tools, approvals, and concurrency
|
|
99
|
+
- [Sub-agents and Programmatic Turns](https://github.com/cloudflare/agents/blob/main/docs/think/sub-agents.md) - RPC streaming, `saveMessages`, recovery
|
|
100
|
+
- [Programmatic Submissions](https://github.com/cloudflare/agents/blob/main/docs/think/programmatic-submissions.md) - Durable Think turn admission for webhooks and RPC callers
|
|
101
|
+
|
|
102
|
+
## MCP (Model Context Protocol)
|
|
103
|
+
|
|
104
|
+
- [Creating MCP Servers](./mcp-servers.md) - Build MCP servers with `McpAgent`
|
|
105
|
+
- [Securing MCP Servers](./securing-mcp-servers.md) - OAuth and authentication for MCP
|
|
106
|
+
- [Connecting to MCP Servers](./mcp-client.md) - `addMcpServer()` and consuming external MCP tools
|
|
107
|
+
- [MCP Transports](./mcp-transports.md) - Transport options: Streamable HTTP, SSE, and RPC
|
|
108
|
+
|
|
109
|
+
## Authentication & Security
|
|
110
|
+
|
|
111
|
+
- TODO: [Securing your Agents](./securing-agents.md) - Authentication, authorization, and access control
|
|
112
|
+
- [Cross-Domain Authentication](./cross-domain-authentication.md) - Auth across different domains
|
|
113
|
+
|
|
114
|
+
## Observability & Debugging
|
|
115
|
+
|
|
116
|
+
- [Observability](./observability.md) - Monitoring and tracing agent activity
|
|
117
|
+
- TODO: [Testing](./testing.md) - Unit tests, integration tests, mocking agents
|
|
118
|
+
- TODO: [Evals](./evals.md) - Evaluating AI agent quality and behavior
|
|
119
|
+
|
|
120
|
+
## Agent Studio
|
|
121
|
+
|
|
122
|
+
- TODO: [Agent Studio](./agent-studio.md) - Local dev tool for inspecting and interacting with agent instances
|
|
123
|
+
|
|
124
|
+
## Compute Environments
|
|
125
|
+
|
|
126
|
+
- [Browse the Web (Experimental)](./browse-the-web.md) - Full CDP access for web inspection, scraping, and debugging
|
|
127
|
+
- TODO: [Cloudflare Sandboxes](./sandboxes.md) - Isolated environments for coding agents, ffmpeg, and heavy compute
|
|
128
|
+
|
|
129
|
+
## Advanced Topics
|
|
130
|
+
|
|
131
|
+
- [Long-Running Agents](./long-running-agents.md) - Building agents that persist for weeks or months: lifecycle, recovery, async operations, and planning
|
|
132
|
+
- TODO: [SQL API](./sql.md) - Using `this.sql` for direct database queries
|
|
133
|
+
- TODO: [Memory & Persistence](./memory.md) - Long-term storage patterns
|
|
134
|
+
- [Configuration](./configuration.md) - wrangler.jsonc setup, types, secrets, and deployment
|
|
135
|
+
|
|
136
|
+
## Migration Guides
|
|
137
|
+
|
|
138
|
+
- [Migration to AI SDK v5](./migration-to-ai-sdk-v5.md)
|
|
139
|
+
- [Migration to AI SDK v6](./migration-to-ai-sdk-v6.md)
|
|
140
|
+
|
|
141
|
+
## Reference
|
|
142
|
+
|
|
143
|
+
- TODO: [API Reference](./api-reference.md) - Complete API documentation
|
|
144
|
+
- TODO: [FAQ / How is this different from Durable Objects?](./faq.md)
|
|
145
|
+
- TODO: [Resources & Further Reading](./resources.md)
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Contributing
|
|
150
|
+
|
|
151
|
+
Found something missing? Documentation contributions are welcome!
|