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.
Metadata
Release files for relayhq 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| relayhq-0.2.0.tar.gz | 16.7 kB | Without provenance | Details for relayhq-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| relayhq-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for relayhq-0.2.0-py3-none-any.whl |
Total release size: 38.3 kB
Release files / relayhq-0.2.0.tar.gz
| Download URL | relayhq-0.2.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36db523861798606a4ad2f2ed995578e0aed60b475963ed18133b508ef3347eb
|
|
BLAKE2b-256 checksum How to use checksums |
c76e795ac1a6befbc0a8dca2ae8ba326b99bbde32b1e9ca11095e18d830b90f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / relayhq-0.2.0-py3-none-any.whl
| Download URL | relayhq-0.2.0-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42390d9822581a4ed917616ea50e8918b404cbdebce0271edbd3ac4dcb8123e7
|
|
BLAKE2b-256 checksum How to use checksums |
6737908e85e2ae76a61a2a2d0e1adc61ae279d6e8cbad8470db61d533f8a3223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for relayhq 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.