Durable execution of Pydantic AI agents on Postgres via Absurd.
Project description
Pydantic AI Absurd
Durable execution for Pydantic AI agents, on Postgres alone.
Agents run for a while, a model call, a tool call, another model call. When the worker dies in the middle of that, the run is usually lost: you restart from zero and pay for every token again.
Pydantic AI Absurd fixes that. Call agent.run() inside a durable task and every model and MCP call is checkpointed into Postgres. If the worker crashes, a new one resumes from the last completed step, no restart, no re-spent tokens. Same idea as Pydantic AI's Temporal integration, but with no Temporal, no Redis, no broker: just the Postgres you already have.
Installation
pip install pydantic-ai-absurd
Example
import asyncio
from absurd_sdk import AsyncAbsurd
from pydantic_ai import Agent
from pydantic_ai_absurd import AbsurdAgent
absurd = AsyncAbsurd("postgresql://localhost/absurd", queue_name="agents")
agent = AbsurdAgent(Agent("openai:gpt-5.2", name="analyst"), absurd)
@absurd.register_task(name="analyse")
async def analyse(params, ctx):
result = await agent.run(params["prompt"])
return {"output": result.output}
async def main():
await absurd.spawn("analyse", {"prompt": "Analyse Q3 revenue"})
await absurd.work_batch(batch_size=1)
if __name__ == "__main__":
asyncio.run(main())
You author a task, call the agent inside it, and run it durably. That's the whole idea.
Documentation
Read the docs at kludex.github.io/pydantic-ai-absurd, a step-by-step tutorial, how durability actually works, tools and MCP servers, and a production guide.
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 pydantic_ai_absurd-0.3.0.tar.gz.
File metadata
- Download URL: pydantic_ai_absurd-0.3.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d31b2be5ee472af1172aefe4e53730d43590e844ec2898ae8cf36987be2c6e4
|
|
| MD5 |
17b3071cf0cdfd9ad0e801f2276a0cd8
|
|
| BLAKE2b-256 |
7462cb90e201ddb676eb8c8b4a00ce7661062578f5df94464631b486d9dca57c
|
File details
Details for the file pydantic_ai_absurd-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pydantic_ai_absurd-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68331a2de992c76a45da0118b76cd6125693afb7577dd957044abfdb2a399b2d
|
|
| MD5 |
46e291b7ef4869846f248201c32c679d
|
|
| BLAKE2b-256 |
e7357cd73307ee2f1738a61400613add6ba3b0d6ffe87d6877f47ae4f91fea9b
|