You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This page provides an overview of the Agent SDK API, including the `Agent` class, methods and properties built-in to the Agents SDK.
11
11
12
-
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.
12
+
The Agents SDK exposes two main APIs:
13
+
14
+
* The server-side `Agent` class. 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, how to call AI models, and any error handling.
15
+
* The client-side `AgentClient` class, which allows you to connect to an Agent instance from a client-side application. The client APIs also include React hooks, including `useAgent` and `useAgentChat`, and allow you to automatically synchronize state between each unique Agent (running server-side) and your client applications.
16
+
17
+
You can also find more specific usage examples for each API in the [Agents API Reference](/agents/api-reference/).
Visit the documentation on [storing and syncing state](/agents/api-reference/store-and-sync-state/) to learn more about the `this.setState` and `this.sql` APIs.
578
+
:::note
579
+
580
+
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.
581
+
582
+
:::
583
+
574
584
575
585
### Client API
576
586
587
+
The Agents SDK provides a set of client APIs for interacting with Agents from client-side JavaScript code, including:
588
+
589
+
* React hooks, including `useAgent` and `useAgentChat`, for connecting to Agents from client applications.
590
+
* 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.
591
+
* The ability to call remote methods (Remote Procedure Calls; RPC) on the Agent from client-side JavaScript code using the `@callable` method decorator.
592
+
577
593
#### AgentClient
578
594
579
595
Client for connecting to an Agent from the browser.
0 commit comments