Skip to main content
The Agent class represents a single agent on the Relevance AI platform. Use it to start conversations, fetch existing tasks, and read configuration set in the dashboard.

Load a single agent

Fetch an agent by its ID. The agent ID is visible on the agent’s page in the dashboard.
To use a specific client instead of the default singleton:

List all agents

Fetch a paginated list of every agent in the project:
Pagination is controlled with pageSize and page:
The defaults are pageSize: 20 and page: 1.

Read agent metadata

Once loaded, an agent exposes a number of fields:
name, description, and avatar may be undefined if they haven’t been configured in the dashboard.

Start a conversation

Send a message with sendMessage. This creates a new task (the conversation thread) and returns it immediately. The method doesn’t wait for the agent to respond.
To continue an existing conversation, pass the task back:
File attachments can be included as well:
For a full walkthrough of message types, attachments, and response handling, see Messaging.

Retrieve tasks

A single task

Fetch a specific task by ID:

A list of tasks

Fetch a paginated, sortable, and filterable list of tasks for the agent:
All options are optional. The defaults are pageSize: 100, page: 1, and sort: { createdAt: "asc" }. Filtering by status accepts an array of simplified task statuses. For the full lifecycle and status values, see Tasks.