async_ form (for example chat() and async_chat()) with identical parameters. Responses are typed dataclasses; field names match the API (conversationId, quotaLimit, …).
Health and usage
ping() → PingResponse
ping() → PingResponse
GET /ping. No API key required.PingResponse: success, status ("UP" or "DOWN"), service, version, metadata (uptime, timestamp).validate() → ValidateResponse
validate() → ValidateResponse
GET /validate.get_usage() → Usage
get_usage() → Usage
Shortcut for
validate().usage.Chat
chat(agent_id, message, *, conversation_id=None, user_id=None, tools=None, results=None) → ChatResponse
Sends a message to an agent and returns the full reply (POST /agents/{agentId}/chat).
str
required
The agent ID.
str
required
The user message.
str
Existing conversation. Ignored when
user_id is set.str
Stable user identifier for a persistent conversation.
list[dict]
Tool definitions. Pass plain dicts. See Tool calling.
list[dict]
Tool results:
{"toolCallId": ..., "output": "<string>"}.ChatResponse: success, messageId, output (reply.id, reply.content, finish_reason), usage.credits, and optional conversationId, userId.
chat() does not take a stream argument. For streaming use stream_chat().Sending tool results
Conversations
list_conversations(agent_id, page=1, size=20) → ConversationsResponse
size is capped at 100.
delete_conversation(agent_id, conversation_ref) → DeleteMessagesResponse
conversation_ref is a conversation ID or a persistent user ID.
Messages
list_messages(agent_id, conversation_ref, page=1, size=20) → MessagesResponse
delete_message(agent_id, conversation_ref, message_id, cascade=False) → DeleteMessagesResponse
With cascade=True, the message immediately following is deleted too.
Tool calls
cancel_tool_call(agent_id, conversation_ref, tool_call_id) → CancelToolResponse
404 raises ReyGridNotFoundError; a 409 (cannot be canceled) raises ReyGridConflictError.
Agents
list_agents() · get_agent(agent_id) · update_agent(agent_id, *, name=None, instructions=None, model=None)
Knowledge
upload_file accepts a path, bytes (pass filename) or an open binary file. Uploads and crawls wait for indexing, so they use a 10-minute timeout by default (timeout= to change it). See Knowledge & search.
Search, feedback, models and usage
get_usage_report() is the account report from GET /usage; get_usage() still returns this key’s usage from /validate.
Pagination helpers
paginate_conversations(agent_id, size=20) and paginate_messages(agent_id, conversation_ref, size=20) return a Paginator. Iterating it yields a PaginatedResult per page, with .data (the items) and .pagination.
async_ variants: