Skip to main content
All methods return Promises and are fully typed. Types such as ChatResponse and MessagesResponse are exported from reygrid.

Health and usage

ping(): Promise<PingResponse>

GET /ping. No API key required.
PingResponse: success, status ("UP" | "DOWN"), service, version, metadata? (uptime?, timestamp?).
GET /validate.
Shortcut for (await validate()).usage.

Chat

chat(agentId, message, opts?): Promise<ChatResponse>

Sends a message and returns the full reply (POST /agents/{agentId}/chat).
string
required
The agent ID.
string
required
The user message.
string
Existing conversation. Ignored when userId is set.
string
Stable user identifier for a persistent conversation.
Tool[]
Tool definitions. See Tool calling.
ToolResult[] | null
Results for tool calls: { toolCallId, output }.
Returns ChatResponse: success, messageId, output (reply.id, reply.content, finish_reason), usage.credits, and optional conversationId, userId.
For streaming use streamChat() rather than passing stream: true to chat().

Sending tool results

Conversations

listConversations(agentId, { page?, size? }): Promise<ConversationsResponse>

deleteConversation(agentId, conversationRef): Promise<DeleteMessagesResponse>

conversationRef is a conversation ID or a persistent user ID.

Messages

listMessages(agentId, conversationRef, { page?, size? }): Promise<MessagesResponse>

deleteMessage(agentId, conversationRef, messageId, cascade = false): Promise<DeleteMessagesResponse>

With cascade = true the message immediately following is deleted too.

Tool calls

cancelToolCall(agentId, conversationRef, toolCallId): Promise<CancelToolResponse>

A 404 throws ReyGridNotFoundError; a 409 (cannot be canceled) throws ReyGridConflictError.

Agents

listAgents(): Promise<AgentsResponse> · getAgent(agentId) · updateAgent(agentId, update)

Knowledge

uploadFile accepts a Blob, ArrayBuffer or Uint8Array. Uploads and crawls wait for indexing, so they use a 10-minute timeout by default ({ timeoutMs } to change it). See Knowledge & search.

Search, feedback, models and usage

getUsageReport() is the account report from GET /usage; getUsage() still returns this key’s usage from /validate.

Pagination helpers

paginateConversations(agentId, size = 20) and paginateMessages(agentId, conversationRef, size = 20) return a Paginator<T> (page size is clamped to 1–100).