Skip to content

Commit 4cbd43d

Browse files
committed
fixed image
1 parent 88cbf64 commit 4cbd43d

File tree

1 file changed

+79
-21
lines changed

1 file changed

+79
-21
lines changed

src/content/changelog/agents/2025-03-17-npm-i-agents.mdx

Lines changed: 79 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,31 @@ date: 2025-03-17T14:00:00Z
99

1010
import { Badge, MetaInfo, Render, TypeScriptExample } from "~/components"
1111
import { Image } from 'astro:assets';
12+
import npmAgentsAnimated from "~/assets/images/agents/npm-i-agents.apng"
1213

13-
<Image src="~/assets/images/agents/npm-i-agents.apng" alt="npm i agents" width="1000" height="541" />
14+
<Image src={npmAgentsAnimated} alt="npm i agents" width="1000" height="541" />
15+
16+
#### `agents-sdk` -> `agents` <Badge text="Updated" variant="tip" size="small" />
17+
18+
**We've renamed the Agents package to `agents`**!
19+
20+
If you've already been building with the Agents SDK, you can update your dependencies to use the new package name, and replace references to `agents-sdk` with `agents`:
21+
22+
```sh
23+
# Remove the old (deprecated) package
24+
npm uninstall agents-sdk
25+
26+
# Install the new package
27+
npm i agents
28+
29+
# Find instances of the old package name in your codebase
30+
grep -r 'agents-sdk' .
31+
# Replace instances of the old package name with the new one
32+
# (or use find-replace in your editor)
33+
sed -i 's/agents-sdk/agents/g' $(grep -rl 'agents-sdk' .)
34+
```
35+
36+
Future updates will be pushed to the new `agents` package, and the older package will be marked as deprecated.
1437

1538
#### Multi-Agent applications and RPC <Badge text="New" variant="tip" size="small" />
1639

@@ -22,44 +45,79 @@ We've added a number of big new features to the Agents SDK over the past few wee
2245
- TODO: useAgentChat bug fixes for passing headers/credentials, properly clearing cache on unmount, etc
2346
- TODO: experiemental /schedule module with a prompt/schema for adding scheduling to your app (with evals!)
2447

25-
We've also fixed a nubmer of bugs with state synchronization and the React hooks.
48+
We've also fixed a number of bugs with state synchronization and the React hooks.
2649

27-
#### Call Agent methods from your client code <Badge text="New" variant="tip" size="small" />
50+
<TypeScriptExample>
2851

29-
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.
52+
```ts
53+
import { Agent } from 'agents';
3054

31-
#### `agents-sdk` -> `agents` <Badge text="Updated" variant="tip" size="small" />
55+
// TODO: example of Multi-Agent or similar here
56+
class MyAgent extends Agent {}
3257

33-
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:
58+
```
59+
</TypeScriptExample>
3460

35-
```sh
36-
# Remove the old (deprecated) package
37-
npm uninstall agents-sdk
61+
#### Call Agent methods from your client code <Badge text="New" variant="tip" size="small" />
3862

39-
# Install the new package
40-
npm i agents
63+
We've added a new [`@callable()`](/agents/api-reference/client-api/) decorator 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.
64+
65+
<TypeScriptExample>
66+
67+
```ts
68+
// index.ts
69+
import { Agent, callable } from 'agents';
70+
71+
// TODO: replace this with a real example
72+
class MyAgent extends Agent {
73+
@callable()
74+
async getHistory(limit: number): Promise<string[]> {
75+
// Allow a client to directly fetch chat history
76+
return this.state.chatHistory.slice(-limit)
77+
}
78+
}
79+
80+
// client.tsx
81+
const { call } = useAgent({ agent: "rpc" });
82+
83+
const fetchUserHistory = async () => {
84+
try {
85+
setLoading(true);
86+
const result = await call("getHistory(5)");
87+
addToast(`Regular RPC result: ${result}`, "success");
88+
} catch (error) {
89+
addToast(`Error: ${error}`, "error");
90+
} finally {
91+
setLoading(false);
92+
}
93+
};
4194

42-
# Find instances of the old package name in your codebase
43-
grep -r 'agents-sdk' .
44-
# Replace instances of the old package name with the new one
45-
# (or use find-replace in your editor)
46-
sed -i 's/agents-sdk/agents/g' $(grep -rl 'agents-sdk' .)
4795
```
96+
</TypeScriptExample>
4897

49-
#### agents-starter
98+
#### agents-starter <Badge text="Updated" variant="tip" size="small" />
5099

51-
TODO
100+
The [`agents-starter`](https://github.com/cloudflare/agents-starter) project — a real-time, chat-based example application with tool-calling & human-in-the-loop built using the Agents SDK — has seen the following updates:
52101

53102
- TODO
54103
- Upgraded to use the latest [wrangler v4](/changelog/2025-03-13-wrangler-v4/) release.
55104
- [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).
56105

57-
#### More documentation
106+
If you're new to Agents, you can install and run the `agents-starter` project in two commands:
107+
108+
```sh
109+
# Install it
110+
$ npm create cloudflare@latest agents-starter -- --template="cloudflare/agents-starter"
111+
# Run it
112+
$ npm run start
113+
```
114+
115+
#### More documentation <Badge text="Updated" variant="tip" size="small" />
58116

59117
We've contined to build out the Agents SDK documentation, including:
60118

61119
- Expanded [API reference documentation](/agents/api-reference/), covering the methods and properties exposed by the Agents SDK, as well as more usage examples.
62-
- A new [Client API](/agents/api-reference/client-api/) reference that documents `useAgent`, `useAgentChat` and the new `@callable` decorator exposed by the SDK.
63-
- 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/).
120+
- A new [Client API](/agents/api-reference/client-api/) reference that documents `useAgent`, `useAgentChat` and the new `@callable` RPC decorator exposed by the SDK.
121+
- New documentation on how to [call agents](/agents/api-refererence/calling-agents/) and (optionally) authenticate clients before they connect to your Agents.
64122

65123
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.

0 commit comments

Comments
 (0)