1
Install
2
Create the client
3
Check the API and your key
4
Chat with an agent
5
Close the client
with ReyGrid(api_key=...) as client:.Complete example
Usage
Every client method.
Streaming
Stream replies with SSE.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
From pip install to your first ReyGrid chat reply with the Python SDK.
Install
pip install reygrid
Create the client
import os
from reygrid import ReyGrid
client = ReyGrid(api_key=os.environ["REYGRID_API_KEY"])
Check the API and your key
print(client.ping().status) # "UP"
usage = client.get_usage()
print(f"Usage: {usage.total} / {usage.quotaLimit}")
Chat with an agent
reply = client.chat("{AgentId}", "Hello!", user_id="user-42")
print(reply.output.reply.content)
Close the client
client.close()
with ReyGrid(api_key=...) as client:.import os
from reygrid import ReyGrid, ReyGridAuthError, ReyGridNetworkError
with ReyGrid(api_key=os.environ["REYGRID_API_KEY"]) as client:
try:
usage = client.get_usage()
print(f"Usage: {usage.total} / {usage.quotaLimit}")
reply = client.chat("{AgentId}", "Hello!", user_id="user-42")
print(reply.output.reply.content)
except ReyGridAuthError:
print("Invalid API key")
except ReyGridNetworkError as e:
print(f"Network problem: {e}")