Skip to content

Commit 67827fa

Browse files
committed
Cleaning up "Get started" folder, adding example to overview page
1 parent 0dfe4ad commit 67827fa

File tree

4 files changed

+51
-48
lines changed

4 files changed

+51
-48
lines changed

src/content/docs/agents/getting-started/build-a-chat-agent.mdx

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/content/docs/agents/getting-started/get-started.mdx

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,45 +27,52 @@ To use the Agent starter template and create your first Agent with the Agents SD
2727

2828
## Manually create an Agent
2929

30+
<Steps>
3031
1. Install the `agents` package directly into an existing project:
3132

32-
```sh
33-
npm i agents
34-
```
33+
```sh
34+
npm i agents
35+
```
3536

3637
2. Define your first Agent by creating a class that extends the `Agent` class:
3738

38-
<TypeScriptExample>
39+
<TypeScriptExample>
3940

40-
```ts
41-
import { Agent, AgentNamespace } from "agents";
41+
```ts
42+
import { Agent, AgentNamespace } from "agents";
4243

43-
export class MyAgent extends Agent {
44-
// Define methods on the Agent:
45-
// https://developers.cloudflare.com/agents/api-reference/agents-api/
46-
//
47-
// Every Agent has built in state via this.setState and this.sql
48-
// Built-in scheduling via this.schedule
49-
// Agents support WebSockets, HTTP requests, state synchronization and
50-
// can run for seconds, minutes or hours: as long as the tasks need.
51-
}
52-
```
44+
export class MyAgent extends Agent {
45+
// Define methods on the Agent:
46+
// https://developers.cloudflare.com/agents/api-reference/agents-api/
47+
//
48+
// Every Agent has built in state via this.setState and this.sql
49+
// Built-in scheduling via this.schedule
50+
// Agents support WebSockets, HTTP requests, state synchronization and
51+
// can run for seconds, minutes or hours: as long as the tasks need.
52+
}
53+
```
5354

54-
</TypeScriptExample>
55+
</TypeScriptExample>
5556

5657
3. Add the [Durable Objects](/durable-objects/) binding to your wrangler file:
5758

58-
<WranglerConfig>
59-
```toml
60-
[[durable_objects.bindings]]
61-
name = "MyAgent"
62-
class_name = "MyAgent"
59+
<WranglerConfig>
60+
```toml
61+
[[durable_objects.bindings]]
62+
name = "MyAgent"
63+
class_name = "MyAgent"
64+
65+
[[migrations]]
66+
tag = "v1"
67+
new_sqlite_classes = ["MyAgent"]
68+
69+
```
70+
</WranglerConfig>
71+
72+
</Steps>
6373

64-
[[migrations]]
65-
tag = "v1"
66-
new_sqlite_classes = ["MyAgent"]
74+
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`.
6775

68-
```
69-
</WranglerConfig>
76+
## Additional resources
7077

71-
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`.
78+
- [Prompt an AI model](/workers/get-started/prompting/)

src/content/docs/agents/getting-started/prompting.mdx

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/content/docs/agents/index.mdx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,25 @@ head:
1111
content: Agents
1212
---
1313

14-
import { CardGrid, Description, Feature, LinkButton, LinkTitleCard, PackageManagers, Plan, RelatedProduct, Render, TabItem, Tabs, TypeScriptExample, WranglerConfig } from "~/components";
14+
import { CardGrid, Description, Feature, LinkButton, LinkTitleCard, PackageManagers, Plan, RelatedProduct, Render, TabItem, Tabs, TypeScriptExample, WranglerConfig, GitHubCode, Example } from "~/components";
1515

1616
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/).
1717

18-
Try [building a chat agent](https://github.com/cloudflare/agents-starter).
18+
<Example title="Build a chat agent">
19+
20+
<GitHubCode
21+
repo="cloudflare/agents-starter"
22+
file="src/server.ts"
23+
commit="219dbd72adaff17c12276802d88dfbb5a0ab36b2"
24+
lang="ts"
25+
lines="24-33"
26+
/>
27+
28+
Try building a chat agent using the [Agents starter template](https://github.com/cloudflare/agents-starter).
29+
30+
</Example>
31+
32+
<LinkButton href="/agents/getting-started/get-started/">Get started</LinkButton>
1933

2034
## Why build agents on Cloudflare?
2135

0 commit comments

Comments
 (0)