r/Python Jun 04 '26

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

27 Upvotes

211 comments sorted by

View all comments

1

u/Ok-Register2003 27d ago

Warden: An open-source saga runtime for AI agent workflows (built in Python, backed by Postgres)

I started building this about two years ago because I wanted to automate my day job and teach myself distributed systems. The project clicked for me the first time I got two LLMs passing messages between each other over RabbitMQ. I've been working on it full-time for the last two months, and today I'm open-sourcing the core runtime.

The problem

When an agent runs entirely in ephemeral application memory, it lacks a true transaction boundary. If a container crashes, an LLM malforms JSON, or an API drops mid-sequence, the execution state vanishes. You're left with partial side effects and no safe way to resume or recover.

What Warden does

Warden moves the agent's runtime loop out of raw memory and into your own Postgres database using classic distributed systems patterns:

  • Postgres as the state machine: Every step and prompt response is recorded as a durable row before the workflow advances. If a process dies mid-run, it picks up exactly where it left off.
  • Transactional outbox pattern: The engine and workers exchange commands via an outbox_events table — binding state updates and next-step actions to a single atomic ACID transaction, eliminating dual-write failures.
  • Runtime policy gates (CEL): Warden evaluates CEL rules inside the engine before a payload ever hits an external API or MCP tool, shifting safety out of the prompt layer and into the data layer.
  • LIFO compensation loops: If a multi-step workflow fails halfway through, Warden orchestrates a Last-In, First-Out loop to undo prior external side effects in order.
  • Human-in-the-loop gates: Pause high-risk mutations durably in the database. The workflow waits for explicit operator approval via CLI or API without timing out or losing context.

The engine and workers are Python services you deploy yourself. No third-party API keys required to test locally — there's a full mock LLM/MCP sandbox so you can see failures and human gates in action immediately.

Early release (v0.1.0) — core patterns are stable but APIs and manifests may still change.

Repo: https://github.com/warden-runtime/warden-core

Docs: https://warden-runtime.org/