Durable Restate-backed agent wrapper with Pydantic type safety.
Project description
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
restateSDK: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.
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 restate_agent-0.1.0.tar.gz.
File metadata
- Download URL: restate_agent-0.1.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f3c0fd4e5c6893162f2630bfd07a65ca482c2f82b14c7dbe154747a50827f41
|
|
| MD5 |
e10582e1c9ee4729b47eac779d0c1963
|
|
| BLAKE2b-256 |
dee8bd9e33dcbb4c6612aa3bef472f2e7dff30170d5d31ad91abc8e01c8608ac
|
File details
Details for the file restate_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: restate_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca8d7ff5a74efb48eba26ec37ec7ae78234494fedf8fa5547c27b5e5b49ed79e
|
|
| MD5 |
bf0bf6c823bbe6ac103bacc7456030fc
|
|
| BLAKE2b-256 |
eb7bbf2d6cd65fe38fa0ede328f937b19ea2ce5c3763a05063e9576d1805fd7b
|