Skip to main content

restate-agent

Restate-backed, Pydantic-typed agent runner inspired by PydanticAI's TemporalAgent.

Quickstart

from pydantic import BaseModel
from restate_agent import RestateAgent

class Answer(BaseModel):
    text: str

class DummyAgent:
    async def run(self, prompt: str, deps=None, tools=None) -> Answer:
        return Answer(text=f"Echo: {prompt}")

agent = RestateAgent(DummyAgent(), output_type=Answer)
result = await agent.run("hello")
print(result.text)

Agent contract

RestateAgent expects a runner with this shape:

async def run(self, prompt: str, *, deps=None, tools=None) -> OutputT: ...

The agent is responsible for using the registered tools (if any) and returning the output type you pass to RestateAgent.

Durable execution

Durable execution uses an activity executor (e.g., Restate workflow context) to run the non-deterministic agent call in an activity while keeping orchestration deterministic.

from restate_agent import RestateAgent
from restate_agent.runtime import RestateActivityExecutor, create_durable_runtime

# ctx is your Restate workflow context
runtime, handler = create_durable_runtime(
    agent,
    lambda _handler: RestateActivityExecutor(ctx),
)
# handler is the activity entrypoint you register with Restate
result = await agent.run("hello", runtime=runtime)

Optional integrations

  • restate SDK: pip install "restate-agent[restate]"

See docs/ and examples/ for more detailed usage.

Build & test

python -m pip install -e .[restate]
python -m pytest
python -m build
basedpyright

Notes

TemporalAgent compatibility: this library mirrors PydanticAI's TemporalAgent ergonomics but maps workflows/activities to Restate and uses create_durable_runtime(...) to wire the activity boundary.

Durable execution expects JSON-serializable deps, tool payloads, and outputs.

Metadata

Release files for restate-agent 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for restate-agent 0.1.0
File Size Uploaded
restate_agent-0.1.0.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for restate-agent 0.1.0
File Interpreter ABI Platform
restate_agent-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.5 kB

Release files / restate_agent-0.1.0.tar.gz

Download URL restate_agent-0.1.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2f3c0fd4e5c6893162f2630bfd07a65ca482c2f82b14c7dbe154747a50827f41
BLAKE2b-256 checksum
How to use checksums
dee8bd9e33dcbb4c6612aa3bef472f2e7dff30170d5d31ad91abc8e01c8608ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / restate_agent-0.1.0-py3-none-any.whl

Download URL restate_agent-0.1.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca8d7ff5a74efb48eba26ec37ec7ae78234494fedf8fa5547c27b5e5b49ed79e
BLAKE2b-256 checksum
How to use checksums
eb7bbf2d6cd65fe38fa0ede328f937b19ea2ce5c3763a05063e9576d1805fd7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page