Skip to main content

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

  • 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

restate_agent-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

restate_agent-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

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

Hashes for restate_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2f3c0fd4e5c6893162f2630bfd07a65ca482c2f82b14c7dbe154747a50827f41
MD5 e10582e1c9ee4729b47eac779d0c1963
BLAKE2b-256 dee8bd9e33dcbb4c6612aa3bef472f2e7dff30170d5d31ad91abc8e01c8608ac

See more details on using hashes here.

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

Hashes for restate_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca8d7ff5a74efb48eba26ec37ec7ae78234494fedf8fa5547c27b5e5b49ed79e
MD5 bf0bf6c823bbe6ac103bacc7456030fc
BLAKE2b-256 eb7bbf2d6cd65fe38fa0ede328f937b19ea2ce5c3763a05063e9576d1805fd7b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page