Skip to content

Commit f1844bd

Browse files
committed
agents docs
1 parent a0f1dda commit f1844bd

File tree

5 files changed

+77
-4
lines changed

5 files changed

+77
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ This ensures we only create Agents for authenticated users, and allows you to va
190190

191191
### Next steps
192192

193-
* Review the [API documentation](/agents/api-reference/sdk/) for the Agents class to learn how to define
193+
* Review the [API documentation](/agents/api-reference/agents-api/) for the Agents class to learn how to define
194194
* [Build a chat Agent](/agents/getting-started/build-a-chat-agent/) using the `agents-sdk` and deploy it to Workers.
195195
* Learn more [using WebSockets](/agents/api-reference/websockets/) to build interactive Agents and stream data back from your Agent.
196196
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the `agents-sdk` and [Workflows](/workflows).
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: Client API
3+
pcx_content_type: concept
4+
sidebar:
5+
order: 11
6+
---
7+
8+
import { MetaInfo, Render, Type, TypeScriptExample, WranglerConfig } from "~/components";
9+
10+
The Agents SDK provides a set of client APIs for interacting with Agents from client-side JavaScript code, including:
11+
12+
* React hooks, including `useAgent` and `useAgentChat`, for connecting to Agents from client applications.
13+
* Client-side [state syncing](/agents/api-reference/store-and-sync-state/) that allows you to subscribe to state updates between the Agent and any connected client(s) when calling `this.setState` within your Agent's code.
14+
* The ability to call remote methods (Remote Procedure Calls; RPC) on the Agent from client-side JavaScript code using the `@callable` method decorator.
15+
16+
## React hooks
17+
18+
TODO
19+
20+
#### `useAgent`
21+
22+
TODO
23+
24+
<TypeScriptExample>
25+
26+
```ts
27+
import { useAgent } from "agents-sdk/react";
28+
29+
// TODO
30+
```
31+
32+
</TypeScriptExample>
33+
34+
#### `useAgentChat`
35+
36+
TODO
37+
38+
<TypeScriptExample>
39+
40+
```ts
41+
import { useAgent } from "agents-sdk/react";
42+
import { useAgentChat } from "agents-sdk/ai-react";
43+
44+
// TODO
45+
```
46+
47+
</TypeScriptExample>
48+
49+
## State synchronization
50+
51+
:::note
52+
53+
Visit the [state management API documentation](/agents/api-reference/store-and-sync-state/) within the Agents SDK, including the native `state` APIs and the built-in `this.sql` API for storing and querying data within your Agents.
54+
55+
:::
56+
57+
TODO
58+
59+
<TypeScriptExample>
60+
61+
```ts
62+
import { useState } from "react";
63+
import { useAgent } from "agents-sdk/react";
64+
65+
// TODO
66+
```
67+
68+
</TypeScriptExample>
69+
70+
71+
## Call remote methods
72+
73+
TODO

src/content/docs/agents/api-reference/using-ai-models.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ A user can disconnect during a long-running response from a modern reasoning mod
2424

2525
## Calling AI Models
2626

27-
You can call models from any method within an Agent, including from HTTP requests using the [`onRequest`](/agents/api-reference/sdk/) handler, when a [scheduled task](/agents/api-reference/schedule-tasks/) runs, when handling a WebSocket message in the [`onMessage`](/agents/api-reference/websockets/) handler, or from any of your own methods.
27+
You can call models from any method within an Agent, including from HTTP requests using the [`onRequest`](/agents/api-reference/agents-api/) handler, when a [scheduled task](/agents/api-reference/schedule-tasks/) runs, when handling a WebSocket message in the [`onMessage`](/agents/api-reference/websockets/) handler, or from any of your own methods.
2828

2929
Importantly, Agents can call AI models on their own — autonomously — and can handle long-running responses that can take minutes (or longer) to respond in full.
3030

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ If you're looking to build a more complex Agent, you can use the Agents SDK to b
163163
164164
Otherwise, you can:
165165
166-
* Review the [Agents API reference](/agents/api-reference/creating-agents/) and the APIs exposed by the Agents SDK.
166+
* Review the [Agents API reference](/agents/api-reference/agents-api/) and the APIs exposed by the Agents SDK.
167167
* Learn more [using WebSockets](/agents/api-reference/websockets/) to build interactive Agents and stream data back from your Agent.
168168
* [Orchestrate asynchronous workflows](/agents/api-reference/run-workflows) from your Agent by combining the Agents SDK and [Workflows](/workflows).
169169
* How to [schedule tasks](/agents/api-reference/schedule-tasks) from within your Agent using the `this.schedule` API.

src/content/docs/agents/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ If you're already building on [Workers](/workers/), you can install the `agents-
4444
npm i agents-sdk
4545
```
4646

47-
Dive into the [Agent SDK reference](/agents/api-reference/sdk/) to learn more about how to use the `agents-sdk` package and defining an `Agent`.
47+
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`.
4848

4949
#### Why build agents on Cloudflare?
5050

0 commit comments

Comments
 (0)