Skip to main content

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 AbsurdDurability

absurd = AsyncAbsurd("postgresql://localhost/absurd", queue_name="agents")
agent = Agent("openai:gpt-5.2", name="analyst", capabilities=[AbsurdDurability()])


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

Metadata

Release files for pydantic-ai-absurd 0.8.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 pydantic-ai-absurd 0.8.0
File Size Uploaded
pydantic_ai_absurd-0.8.0.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-ai-absurd 0.8.0
File Interpreter ABI Platform
pydantic_ai_absurd-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.8 kB

Release files / pydantic_ai_absurd-0.8.0.tar.gz

Download URL pydantic_ai_absurd-0.8.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
53057c3bb3db9815fcf2f0a97271a3ffa0054322edf3a93593796f0df9b18162
BLAKE2b-256 checksum
How to use checksums
89c1cc45f268e9b6638c8ffd285578875bbae11b035f15e22179c6556103edb2
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / pydantic_ai_absurd-0.8.0-py3-none-any.whl

Download URL pydantic_ai_absurd-0.8.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91d643c6a260fc04df02271a25bfe700bd1d81460c437ac38a18fbd2e8474c58
BLAKE2b-256 checksum
How to use checksums
dcf5e2cca131ae20372a66c503f026d51f3d1d442878e60d0faf0ad3969fd589
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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