Rebuno Python SDK
Rebuno gives your agents durable execution (crash and resume without re-running side effects), an event-sourced record of everything they did, and optional governance over what they're allowed to do.
Durability works by recording every non-deterministic effect your handler produces, so a resumed run replays the recorded result instead of doing the work again. The SDK gives you three ways to record an effect:
@rebuno.tool— mark an async function as a durable tool callrebuno.http_client()— anhttpxclient that records LLM calls as durable steps (drop it into your OpenAI/Anthropic client)rebuno.step()— record non-deterministic local work (time, randomness, ids) so it replays identically
Installation
pip install rebuno
Building an agent
from rebuno import Agent, tool
@tool
async def search(query: str) -> list[str]:
return [f"result for {query}"]
async def process(prompt: str) -> dict:
hits = await search(prompt)
return {"answer": hits}
agent = Agent("dev-agent", secret="dev-secret", base_url="http://localhost:8080")
agent.run(process, port=5000)
The handler's signature is the input schema: process(prompt: str) makes prompt
a required input field. A single pydantic.BaseModel parameter gets validated input;
a single input: dict (or input: Any) parameter receives the raw input unchanged.
agent.run(...) binds process and serves the webhook endpoint with uvicorn
(this call blocks). The kernel calls that webhook to dispatch each execution; the
agent runs process and records every tool call durably, so crashes and pending
approvals resume transparently on the next dispatch — your handler code doesn't need
to know the difference.
If you want to mount the agent into an existing service, or serve it with your own
uvicorn/gunicorn process, use agent.app (a FastAPI app) instead of agent.run(...).
Tools
from rebuno import tool
@tool
async def search(query: str, limit: int = 10) -> list[str]:
...
Tools are plain async functions — hand them to your framework as a list:
agent = create_agent(llm, [search, ...])
Use @tool("custom_id") to set an explicit tool id, and
@tool(idempotency="at_most_once") for destructive operations that must not be
retried automatically (e.g. sending an email or charging a card).
If a tool does blocking or CPU-bound work, offload it so it doesn't block the event loop:
@tool
async def render(doc: str) -> bytes:
return await asyncio.to_thread(render_sync, doc)
Durable LLM calls
LLM calls are the most expensive and least deterministic thing an agent does, so
Rebuno records them too — without you rewriting how you call the model.
http_client() returns an httpx.AsyncClient you hand to your provider's async
client:
from openai import AsyncOpenAI
import rebuno
llm = AsyncOpenAI(http_client=rebuno.http_client())
It works as an httpx transport that sits under the provider SDK: on the first
run it forwards the request to the provider and records the response as a durable
step (kind=llm_call, the same machinery as tool calls); on resume it replays
the recorded response instead of calling — and paying for — the model again. The
request's model field is used as the step target. Extra kwargs (e.g.
timeout) are forwarded to httpx.AsyncClient.
Streaming works the same way: the transport tees the provider's event stream to
your code while assembling it, records the assembled whole, and replays it as a
stream so stream=True still yields a stream on resume.
Recording only happens inside an execution — outside one, the client is a plain passthrough. One current limit: non-JSON request bodies aren't recognized as LLM calls.
Durable local work
Wrap non-deterministic local computation — the current time, random choices, fresh ids — so its result is recorded once and replays identically on resume:
from rebuno import step
chosen = await step("pick_winner", random.choice, args={"candidates": candidates})
Building a client
Clients are used to create executions and inspect what they did. It talks to the kernel's client/admin routes with Bearer auth.
from rebuno import Client
client = Client(base_url="http://localhost:8080", api_key="...")
base_url and api_key fall back to the REBUNO_URL and REBUNO_API_KEY
environment variables when omitted; base_url is required one way or the other.
Pass timeout= to override the default 35s. Client is an async context
manager, so it closes its connection pool for you:
async with Client() as client:
execution = await client.create("dev-agent", input={"prompt": "hello"})
...
Otherwise call await client.close() when you're done.
What you can do with it:
# executions
execution = await client.create("dev-agent", input={"prompt": "hello"})
execution = await client.get(execution.id)
await client.cancel(execution.id)
# what an execution did (event log and steps)
events = await client.events(execution.id, after_seq=0, limit=100)
steps = await client.list_steps(execution.id, status="pending")
step = await client.get_step(execution.id, step_id)
Failed requests raise typed errors (NotFoundError, UnauthorizedError,
PolicyError, NetworkError, …) — all subclasses of rebuno.RebunoError.
Human-in-the-loop / approvals
Approvals are inspected and resolved through Client:
pending = await client.list_approvals()
await client.grant_approval(pending[0].id, decided_by="alice")
License
MIT
Metadata
Release files for rebuno 0.12.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 |
|---|---|---|---|---|
| rebuno-0.12.0.tar.gz | 73.7 kB | Without provenance | Details for rebuno-0.12.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rebuno-0.12.0-py3-none-any.whl | Python 3 | none | any | Details for rebuno-0.12.0-py3-none-any.whl |
Total release size: 99.8 kB
Release files / rebuno-0.12.0.tar.gz
| Download URL | rebuno-0.12.0.tar.gz |
|---|---|
| Size | 73.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cc5164beefcc71463a9de30eaa3a85adb7b33d3be9f69ece7f86d4da6ef2bc0
|
|
BLAKE2b-256 checksum How to use checksums |
16792a0fa4cb5f790b13e7cd10a61f130e9a6c37d262f7eae34b0387e1c8c153
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 / rebuno-0.12.0-py3-none-any.whl
| Download URL | rebuno-0.12.0-py3-none-any.whl |
|---|---|
| Size | 26.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8bf7fa8cc2c0b89fa833f8f357b0f05cd67edfb0ea82139af76f857676cc9ccd
|
|
BLAKE2b-256 checksum How to use checksums |
a8a902ac44b5cc2fe51a83c138cd8e19a0ac3260b84dc8caa2898f323cd90994
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 rebuno 0.12.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.