Skip to content

Commit f677751

Browse files
authored
[Agents] Add instruction on adding DO binding (#22493)
* add instruction on adding DO binding * minor formatting fix
1 parent 1031c03 commit f677751

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/content/docs/agents/index.mdx

Lines changed: 17 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?

0 commit comments

Comments
 (0)