Skip to content

Commit 32aa342

Browse files
committed
more
1 parent 612997e commit 32aa342

File tree

14 files changed

+112
-42
lines changed

14 files changed

+112
-42
lines changed
650 KB
Binary file not shown.

src/content/changelog/agents/2025-02-25-agents-sdk.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ date: 2025-02-25T14:00:00Z
99

1010
We've released the [agents-sdk](http://blog.cloudflare.com/build-ai-agents-on-cloudflare/), a package and set of tools that help you build and ship AI Agents.
1111

12-
You can get up and running with a [chat-based AI Agent](https://github.com/cloudflare/agents-starter) (and deploy it to Workers) that uses the `agents-sdk`, tool calling, and state syncing with a React-based front-end by running the following command:
12+
You can get up and running with a [chat-based AI Agent](https://github.com/cloudflare/agents-starter) (and deploy it to Workers) that uses the Agents SDK, tool calling, and state syncing with a React-based front-end by running the following command:
1313

1414
```sh
1515
npm create cloudflare@latest agents-starter -- --template="cloudflare/agents-starter"
1616
# open up README.md and follow the instructions
1717
```
1818

19-
You can also add an Agent to any existing Workers application by installing the `agents-sdk` package directly
19+
You can also add an Agent to any existing Workers application by installing the `agents` package directly
2020

2121
```sh
22-
npm i agents-sdk
22+
npm i agents
2323
```
2424

2525
... and then define your first Agent:
2626

2727
```ts
28-
import { Agent } from 'agents-sdk';
28+
import { Agent } from 'agents';
2929

3030
export class YourAgent extends Agent<Env> {
3131
// Build it out
@@ -37,4 +37,4 @@ export class YourAgent extends Agent<Env> {
3737
}
3838
```
3939

40-
Head over to the [Agents documentation](/agents/) to learn more about the `agents-sdk`, the SDK APIs, as well as how to test and deploying agents to production.
40+
Head over to the [Agents documentation](/agents/) to learn more about the Agents SDK, the SDK APIs, as well as how to test and deploying agents to production.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: npm i agents
3+
description: Install the latest version of the `agents` SDK to build multi-agent applications, use the new RPC API, and visit the latest documentation updates.
4+
products:
5+
- agents
6+
- workers
7+
date: 2025-03-17T14:00:00Z
8+
---
9+
10+
![npm i agents](~/assets/images/agents/npm-i-agents.apng)
11+
12+
#### Multi-Agent applications and RPC
13+
14+
We've added a number of big new features to the Agents SDK over the past few weeks, including:
15+
16+
- TODO
17+
- TODO
18+
- TODO: the regular client now syncs state on the agent (just like the react version)
19+
- TODO: useAgentChat bug fixes for passing headers/credentials, properly clearing cache on unmount, etc
20+
- TODO: experiemental /schedule module with a prompt/schema for adding scheduling to your app (with evals!)
21+
22+
We've also fixed a nubmer of bugs with state synchronization and the React hooks.
23+
24+
### Call Agent methods from your client code
25+
26+
We've added a new [`@callable` decorator](/agents/api-reference/client-api/) for defining methods that can be called directly from clients. This allows you call methods from within your client code: you can call methods (with arguments) and get native JavaScript objects back.
27+
28+
<TypeScriptExample>
29+
30+
```ts
31+
32+
```
33+
34+
</TypeScriptExample>
35+
36+
#### agents-starter
37+
38+
TODO
39+
40+
- TODO
41+
- Upgraded to use the latest [wrangler v4](/changelog/2025-03-13-wrangler-v4/) release.
42+
- [Workers AI](/workers-ai/) is now the default AI provider in the [`agents-starter`](https://github.com/cloudflare/agents-starter) project: this uses the new [structured outputs](/changelog/2025-02-25-json-mode/) (or "JSON mode") support now in Workers AI and the [`workers-ai-provider`](https://sdk.vercel.ai/providers/community-providers/cloudflare-workers-ai#generateobject).
43+
44+
#### More documentation
45+
46+
We've contined to build out the Agents SDK documentation, including:
47+
48+
- Expanded [API reference documentation](/agents/api-reference/), covering the methods and properties exposed by the Agents SDK, as well as more usage examples.
49+
- A new [Client API](/agents/api-reference/client-api/) reference that documents `useAgent`, `useAgentChat` and the new `@callable` decorator exposed by the SDK.
50+
- New documentation on how to [call agents](/agents/api-refererence/calling-agents/) and authenticate clients, using [Server-Sent Events (SSE)](/agents/api-refererence/http-sse/).
51+
52+
#### `agents-sdk` -> `agents`
53+
54+
We've also renamed the Agents package to just `agents` (it's cleaner). If you've already been building with the Agents SDK, you can update your dependencies to use the new package name:
55+
56+
```sh
57+
# Remove the old (deprecated) package
58+
npm uninstall agents-sdk
59+
60+
# Install the new package
61+
npm i agents
62+
63+
# Find instances of the old package name in your codebase
64+
grep -r 'agents-sdk' .
65+
# Replace instances of the old package name with the new one
66+
# (or use find-replace in your editor)
67+
sed -i 's/agents-sdk/agents/g' $(grep -rl 'agents-sdk' .)
68+
```
69+
70+
If you're still wondering what Agents are, [read our blog on building AI Agents on Cloudflare](https://blog.cloudflare.com/build-ai-agents-on-cloudflare/) and/or visit the [Agents documentation](/agents/) to learn more.

src/content/docs/agents/api-reference/agents-api.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ sidebar:
88

99
import { MetaInfo, Render, Type, TypeScriptExample, WranglerConfig } from "~/components";
1010

11-
This page provides an overview of the Agent SDK API, including the `Agent` class, methods and properties built-in to the `agents-sdk`.
11+
This page provides an overview of the Agent SDK API, including the `Agent` class, methods and properties built-in to the Agents SDK.
1212

13-
An Agent is a JavaScript class that extends the `Agent` class from the `agents-sdk` package. An Agent encapsulates all of the logic for an Agent, including how clients can connect to it, how it stores state, the methods it exposes, and any error handling.
13+
An Agent is a JavaScript class that extends the `Agent` class from the Agents SDK package. An Agent encapsulates all of the logic for an Agent, including how clients can connect to it, how it stores state, the methods it exposes, and any error handling.
1414

1515
<TypeScriptExample>
1616

1717
```ts
18-
import { Agent } from "agents-sdk";
18+
import { Agent } from "agents";
1919

2020
class MyAgent extends Agent {
2121
// Define methods on the Agent
@@ -34,14 +34,14 @@ Instances of an Agent are addressed by a unique identifier: that identifier (ID)
3434

3535
### Agent
3636

37-
Writing an Agent requires you to define a class that extends the `Agent` class from the `agents-sdk` package. An Agent encapsulates all of the logic for an Agent, including how clients can connect to it, how it stores state, the methods it exposes, and any error handling.
37+
Writing an Agent requires you to define a class that extends the `Agent` class from the Agents SDK package. An Agent encapsulates all of the logic for an Agent, including how clients can connect to it, how it stores state, the methods it exposes, and any error handling.
3838

3939
You can also define your own methods on an Agent: it's technically valid to publish an Agent only has your own methods exposed, and create/get Agents directly from a Worker.
4040

4141
Your own methods can access the Agent's environment variables and bindings on `this.env`, state on `this.setState`, and call other methods on the Agent via `this.yourMethodName`.
4242

4343
```ts
44-
import { Agent } from "agents-sdk";
44+
import { Agent } from "agents";
4545

4646
interface Env {
4747
// Define environment variables & bindings here
@@ -361,7 +361,7 @@ function agentFetch(
361361

362362
### React API
363363

364-
The `agents-sdk` provides a React API for simplifying connection and routing to Agents from front-end frameworks, including React Router (Remix), Next.js, and Astro.
364+
The Agents SDK provides a React API for simplifying connection and routing to Agents from front-end frameworks, including React Router (Remix), Next.js, and Astro.
365365

366366
#### useAgent
367367

@@ -397,7 +397,7 @@ function useAgent<State = unknown>(
397397

398398
### Chat Agent
399399

400-
The `agents-sdk` exposes an `AIChatAgent` class that extends the `Agent` class and exposes an `onChatMessage` method that simplifies building interactive chat agents.
400+
The Agents SDK exposes an `AIChatAgent` class that extends the `Agent` class and exposes an `onChatMessage` method that simplifies building interactive chat agents.
401401

402402
You can combine this with the `useAgentChat` React hook from the `agents-sdk/ai-react` package to manage chat state and messages between a user and your Agent(s).
403403

@@ -473,6 +473,6 @@ To learn more about how to manage state within an Agent, refer to the documentat
473473

474474
### Next steps
475475

476-
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the `agents-sdk` and deploy it to Workers.
476+
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the Agents SDK and deploy it to Workers.
477477
* Learn more [using WebSockets](/agents/api-reference/websockets/) to build interactive Agents and stream data back from your Agent.
478-
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the `agents-sdk` and [Workflows](/workflows).
478+
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the Agents SDK and [Workflows](/workflows).

src/content/docs/agents/api-reference/calling-agents.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,6 @@ This ensures we only create Agents for authenticated users, and allows you to va
195195
### Next steps
196196

197197
* Review the [API documentation](/agents/api-reference/agents-api/) for the Agents class to learn how to define
198-
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the `agents-sdk` and deploy it to Workers.
198+
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the Agents SDK and deploy it to Workers.
199199
* Learn more [using WebSockets](/agents/api-reference/websockets/) to build interactive Agents and stream data back from your Agent.
200-
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the `agents-sdk` and [Workflows](/workflows).
200+
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the Agents SDK and [Workflows](/workflows).

src/content/docs/agents/api-reference/client-api.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ TODO
7676
### Next steps
7777

7878
* Review the [API documentation](/agents/api-reference/agents-api/) for the Agents class to learn how to define
79-
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the `agents-sdk` and deploy it to Workers.
79+
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the Agents SDK and deploy it to Workers.
8080
* Learn more [using WebSockets](/agents/api-reference/websockets/) to build interactive Agents and stream data back from your Agent.
81-
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the `agents-sdk` and [Workflows](/workflows).
81+
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the Agents SDK and [Workflows](/workflows).

src/content/docs/agents/api-reference/http-sse.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ Both WebSockets and Server-Sent Events (SSE) enable real-time communication betw
104104
* While SSE works well for simple streaming scenarios, WebSockets are better suited for applications requiring minutes or hours of connection time, as they maintain a more stable connection with built-in ping/pong mechanisms to keep connections alive.
105105
* WebSockets use their own protocol (ws:// or wss://), separating them from HTTP after the initial handshake. This separation allows WebSockets to better handle binary data transmission and implement custom subprotocols for specialized use cases.
106106

107-
If you're unsure of which is better for your use-case, we recommend WebSockets. The [WebSockets API documentation](/agents/api-reference/websockets/) provides detailed information on how to use WebSockets with the `agents-sdk`.
107+
If you're unsure of which is better for your use-case, we recommend WebSockets. The [WebSockets API documentation](/agents/api-reference/websockets/) provides detailed information on how to use WebSockets with the Agents SDK.
108108

109109
### Next steps
110110

111111
* Review the [API documentation](/agents/api-reference/agents-api/) for the Agents class to learn how to define
112-
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the `agents-sdk` and deploy it to Workers.
112+
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the Agents SDK and deploy it to Workers.
113113
* Learn more [using WebSockets](/agents/api-reference/websockets/) to build interactive Agents and stream data back from your Agent.
114-
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the `agents-sdk` and [Workflows](/workflows).
114+
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the Agents SDK and [Workflows](/workflows).

src/content/docs/agents/api-reference/rag.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Here's an example of how to give an Agent retrieval capabilties:
2727
<TypeScriptExample>
2828

2929
```ts
30-
import { Agent } from "agents-sdk";
30+
import { Agent } from "agents";
3131

3232
interface Env {
3333
AI: Ai;

src/content/docs/agents/api-reference/schedule-tasks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ You can call `this.schedule` within any method on an Agent, and schedule tens-of
1818
<TypeScriptExample>
1919

2020
```ts
21-
import { Agent } from "agents-sdk"
21+
import { Agent } from "agents"
2222

2323
export class SchedulingAgent extends Agent {
2424
async onRequest(request) {

src/content/docs/agents/api-reference/store-and-sync-state.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Every Agent has built-in state management capabilities. You can set and update t
2626
<TypeScriptExample>
2727

2828
```ts
29-
import { Agent } from "agents-sdk";
29+
import { Agent } from "agents";
3030

3131
export class MyAgent extends Agent {
3232
// Update state in response to events
@@ -61,7 +61,7 @@ If you're using TypeScript, you can also provide a type for your Agent's state b
6161
<TypeScriptExample>
6262

6363
```ts
64-
import { Agent } from "agents-sdk";
64+
import { Agent } from "agents";
6565

6666
interface Env {}
6767

@@ -285,6 +285,6 @@ This works because each instance of an Agent has its _own_ database, the state s
285285
### Next steps
286286

287287
* Review the [API documentation](/agents/api-reference/agents-api/) for the Agents class to learn how to define
288-
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the `agents-sdk` and deploy it to Workers.
288+
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the Agents SDK and deploy it to Workers.
289289
* Learn more [using WebSockets](/agents/api-reference/websockets/) to build interactive Agents and stream data back from your Agent.
290-
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the `agents-sdk` and [Workflows](/workflows).
290+
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the Agents SDK and [Workflows](/workflows).

0 commit comments

Comments
 (0)