Skip to content

Commit 6b92aff

Browse files
committed
add instruction on adding DO binding
1 parent 5bb5f56 commit 6b92aff

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/content/docs/agents/index.mdx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
TabItem,
2323
Tabs,
2424
TypeScriptExample,
25+
WranglerConfig,
2526
} from "~/components";
2627

2728
The Agents SDK enables you to build and deploy AI-powered agents that can autonomously perform tasks, communicate with clients in real time, call AI models, persist state, schedule tasks, run asynchronous workflows, browse the web, query data from your database, support human-in-the-loop interactions, and [a lot more](/agents/api-reference/).
@@ -50,7 +51,7 @@ And then define your first Agent by creating a class that extends the `Agent` cl
5051
<TypeScriptExample>
5152

5253
```ts
53-
import { Agent, AgentNamespace } from 'agents';
54+
import { Agent, AgentNamespace } from "agents";
5455

5556
export class MyAgent extends Agent {
5657
// Define methods on the Agent:
@@ -65,6 +66,21 @@ export class MyAgent extends Agent {
6566

6667
</TypeScriptExample>
6768

69+
Lastly, add the [Durable Objects](/durable-objects/) binding to your wrangler file:
70+
71+
<WranglerConfig>
72+
```toml
73+
[[durable_objects.bindings]]
74+
name = "MyAgent"
75+
class_name = "MyAgent"
76+
77+
[[migrations]]
78+
tag = "v1"
79+
new_sqlite_classes = ["MyAgent"]
80+
81+
```
82+
</WranglerConfig>
83+
6884
Dive into the [Agent SDK reference](/agents/api-reference/agents-api/) to learn more about how to use the Agents SDK package and defining an `Agent`.
6985

7086
### Why build agents on Cloudflare?
@@ -110,3 +126,4 @@ Run machine learning models, powered by serverless GPUs, on Cloudflare's global
110126
Build stateful agents that guarantee executions, including automatic retries, persistent state that runs for minutes, hours, days, or weeks.
111127

112128
</RelatedProduct>
129+
```

0 commit comments

Comments
 (0)