Skip to content

Commit 1e74471

Browse files
committed
ok
1 parent e732381 commit 1e74471

File tree

2 files changed

+21
-40
lines changed

2 files changed

+21
-40
lines changed

src/content/docs/agents/getting-started/add-an-agent-to-an-existing-project.mdx

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

src/content/docs/agents/index.mdx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import {
2323
Tabs,
2424
} from "~/components";
2525

26-
Build and deploy AI-powered Agents on Cloudflare that can autonomously perform tasks, communicate with clients in real time, persist state, execute long-running and repeat tasks on a schedule, send emails, run asynchronous workflows, browse the web, query data from your Postgres database, call AI models, support human-in-the-loop use-cases, and more.
26+
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/).
2727

2828
### Ship your first Agent
2929

30-
Use the agent starter template to create your first Agent with the Agents SDK:
30+
To use the agent starter template and create your first Agent with the Agents SDK:
3131

3232
```sh
3333
# install it
@@ -36,14 +36,32 @@ npm create cloudflare@latest agents-starter -- --template=cloudflare/agents-star
3636
npx wrangler@latest deploy
3737
```
3838

39-
Head to the guide on [building a chat agent](/agents/getting-started/build-a-chat-agent) to learn how to build and deploy an Agent to prod.
39+
Head to the guide on [building a chat agent](/agents/getting-started/build-a-chat-agent) to learn how the starter project is built and how to use it as a foundation for your own agents.
4040

4141
If you're already building on [Workers](/workers/), you can install the `agents` package directly into an existing project:
4242

4343
```sh
4444
npm i agents
4545
```
4646

47+
And then define your first Agent by creating a class that extends the `Agent` class:
48+
49+
<TypeScriptExample>
50+
51+
```ts
52+
import { Agent, AgentNamespace } from 'agents';
53+
54+
export class MyAgent extends Agent<Env, State = unknown> {
55+
// Define methods on the Agent:
56+
// https://developers.cloudflare.com/agents/api-reference/agents-api/
57+
// Every Agent has built in state via this.setState and this.sql
58+
// Built-in scheduling via this.schedule
59+
// Agents support WebSockets, HTTP requests, state synchronization and
60+
// can run for seconds, minutes or hours: as long as the tasks need.
61+
}
62+
```
63+
</TypeScriptExample>
64+
4765
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`.
4866

4967
### Why build agents on Cloudflare?

0 commit comments

Comments
 (0)