The backend cloud for reliable AI agents. Memory, retries, tools, traces and durable execution without building orchestration infrastructure yourself.
Project description
relayhq
Python SDK for Relay — the backend cloud for reliable AI agents.
pip install relayhq
import asyncio
from relayhq import create_agent, builtin, tool
async def get_user_handler(input):
return await db.users.find(input["id"]) # runs in your process
get_user = tool(
name="get_user",
description="Look up a user by id",
input_schema={
"type": "object",
"properties": {"id": {"type": "string"}},
"required": ["id"],
},
handler=get_user_handler,
)
agent = create_agent(
api_key="relay_live_...", # from relaygh.dev/en/signup
base_url="https://api.relaygh.dev",
model="gpt-4o-mini",
memory={"namespace": f"user:{user_id}"},
tools=[builtin.calculator, get_user],
)
async def main():
async for event in agent.run("Look up u_001 and tell me their tier"):
if event["type"] == "token":
print(event["text"], end="", flush=True)
asyncio.run(main())
What you get
- Multi-provider routing — Anthropic, OpenAI, any OpenAI-compatible endpoint (Ollama, vLLM, Groq, Together, OpenRouter). Pick with the
modelstring. - Custom function tools — your handler runs in your process. The SDK ships the schema; the runtime pauses; you fulfill locally over the same stream.
- Semantic memory —
memory={"namespace": ...}and the agent recalls relevant past turns automatically (pgvector under the hood). - Persistent execution traces — every token, tool call, tool result, and error captured server-side. Replay from the dashboard.
Event stream
agent.run(input) returns an AsyncIterator[dict]. Events:
{"type": "token", "text": "..."}
{"type": "tool_call", "id": "...", "name": "...", "input": ...}
{"type": "tool_result", "id": "...", "output": ...}
{"type": "done", "output": "...", "usage": {"input_tokens": ..., "output_tokens": ...}}
{"type": "error", "message": "..."}
A tool_call for a custom tool is followed by its tool_result after your handler runs and the POST completes. Order is guaranteed.
Get a key
Free during beta, no credit card. Sign up at https://relaygh.dev/en/signup with your email and an OpenAI/Anthropic key — you get back a relay_live_… key.
Or self-host the whole stack: https://github.com/KevinCorrea5103/relay
License
Apache 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file relayhq-0.1.0.tar.gz.
File metadata
- Download URL: relayhq-0.1.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c6a68f78d53a1ad8756d11a73f982fe83d58691c4c882394a699b156d893622
|
|
| MD5 |
282b67be455142315a22898b5459fc26
|
|
| BLAKE2b-256 |
2d9918aefec2f397536b384ad96137a4e8bb2bd12ad2a7736b6499aac3980e1b
|
File details
Details for the file relayhq-0.1.0-py3-none-any.whl.
File metadata
- Download URL: relayhq-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db83e2a7980546e0d2b425b897a1b114eba07e9dc56be7f6e3905bad372d893a
|
|
| MD5 |
08b5e8d5bac6aa9dda1aa5aaed7ac9c7
|
|
| BLAKE2b-256 |
0e5f208448622ccc7bfa44ca6267c21a0f0e26d9c4d9546c771cc341084d0f6a
|