frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Transactional AI: Saga Pattern for Reliable AI Agent Workflows (v0.2)

https://github.com/Grafikui/Transactional-ai
2•grafikui•1h ago

Comments

grafikui•1h ago
Earlier this week I launched Transactional AI v0.1 to solve a problem I kept hitting: AI agents that half-executed and left systems in broken states.

The core idea: apply the Saga pattern (from distributed systems) to AI workflows. Every step has automatic rollback. If OpenAI succeeds but Stripe fails, the system automatically deletes the AI-generated content and refunds—no manual cleanup.

v0.2 adds production features based on feedback:

Distributed Execution (v0.2.0):

Redis-based distributed locking (prevents race conditions with multiple workers) PostgreSQL storage adapter (ACID compliance for regulated industries) Retry policies with exponential backoff (handles flaky LLM APIs) Observability & Reliability (v0.2.1):

Event hooks for monitoring (12 lifecycle events: step start/complete/fail/timeout/retry, compensation events, transaction lifecycle) Per-step timeouts (kill hung OpenAI calls after 30s) Testing utilities (in-memory storage/locks, no Redis/Postgres needed for tests) Example:

const tx = new Transaction('workflow-123', storage, { lock: new RedisLock('redis://localhost'), events: { onStepTimeout: (step, ms) => alerting.sendAlert(`${step} hung after ${ms}ms`), onStepFailed: (step, err, attempt) => logger.error(`${step} failed`, { err, attempt }) } });

await tx.run(async (t) => { const report = await t.step('generate-ai-report', { do: async () => await openai.createCompletion({...}), undo: async (result) => await db.reports.delete(result.id), retry: { attempts: 3, backoffMs: 2000 }, timeout: 30000 });

  await t.step('charge-customer', {
    do: async () => await stripe.charges.create({...}),
    undo: async (charge) => await stripe.refunds.create({ charge: charge.id }),
    timeout: 10000
  });
}); If anything fails: Automatic rollback in reverse order. Report deleted, payment refunded.

Architecture:

TypeScript, 21 passing tests, strict mode Storage adapters: File (dev), Redis (performance), Postgres (ACID), Memory (tests) Lock adapters: NoOp (single process), Redis (distributed), Mock (tests) CLI inspector: tai-inspect for debugging transaction state No heavyweight orchestration engines (Temporal, AWS Step Functions). Just a 450-line TypeScript library.

Production readiness: 8.0/10 (up from 6.5 in v0.1)

Considering for v0.3.0: compensation retry policies, parallel steps, OpenTelemetry integration, MongoDB/DynamoDB adapters.

GitHub: https://github.com/Grafikui/Transactional-ai NPM: npm install transactional-ai

Happy to answer questions about the implementation, saga patterns, or production experiences!

Why the mad artistic genius trope doesn't stand up to scientific scrutiny

https://theconversation.com/why-the-mad-artistic-genius-trope-doesnt-stand-up-to-scientific-scrut...
1•bikenaga•40s ago•0 comments

There Are 29,000 People on a Waitlist for Beans—and It’s Not for the Fiber

https://www.wsj.com/business/entrepreneurship/rancho-gordo-beans-fiber-protein-e27ec1ff
2•paulpauper•1m ago•0 comments

Elon Musk's X faces bans and investigations over nonconsensual bikini images

https://www.npr.org/2026/01/12/nx-s1-5672579/grok-women-children-bikini-elon-musk
2•mikhael•5m ago•0 comments

Grounding LLMs with Recursive Code Execution

https://yogthos.net/posts/2026-01-12-recursive-language-model.html
1•yogthos•5m ago•0 comments

We're all just content for ICE

https://www.garbageday.email/p/we-re-all-just-content-for-ice
12•tastyface•10m ago•0 comments

Show HN: Endpoint Scaling Kubernetes Controller

https://github.com/nwindian/endpoint-scaler
2•IKnowMazin•10m ago•0 comments

The Pentagon Is Recruiting Elon Musk to Help Them Win a Nuclear War

https://www.mintpressnews.com/pentagon-recruiting-elon-musk-nuclear-war/289055/
2•testing43523•11m ago•0 comments

Asahi Linux – Porting Linux to Apple Silicon [video]

https://media.ccc.de/v/39c3-asahi-linux-porting-linux-to-apple-silicon
2•birdculture•11m ago•0 comments

Show HN: Signal – Newsletter digest with web dashboard and scheduling

https://hiddensignal.app
1•hookedonwinter•12m ago•0 comments

Anduril's Palmer Luckey thinks the future of tech is in the past

https://techcrunch.com/2026/01/08/andurils-palmer-luckey-thinks-the-future-of-tech-is-in-the-past/
4•bookofjoe•15m ago•0 comments

Show HN: Modern Philosophy Course

https://readphilosophy.org/?w=course%2Fmilesians%2Fthales%2Fthales
2•bridelamb•16m ago•0 comments

Universal Commerce Protocol (UCP)

https://developers.google.com/merchant/ucp
2•jcfrei•23m ago•0 comments

35 Theses on the WASPs

https://scholarstage.substack.com/p/35-theses-on-the-wasps
1•barry-cotter•27m ago•0 comments

U.S. Attacked Boat With Aircraft That Looked Like a Civilian Plane

https://www.nytimes.com/2026/01/12/us/politics/us-boat-attacks-law.html
8•jbegley•27m ago•3 comments

Controlling local web servers using xbar

https://blog.gingerbeardman.com/2026/01/12/xbar-local-web-server-controller/
1•msephton•29m ago•0 comments

The will to win is nothing without the will to sleep

https://therundownbytherunningeffect.substack.com/p/the-2025-run-down-recap
2•RalphHavensPT•30m ago•0 comments

Raid on the Medway

https://en.wikipedia.org/wiki/Raid_on_the_Medway
1•vinnyglennon•33m ago•0 comments

Even Linus Torvalds is trying his hand at vibe coding (but just a little)

https://arstechnica.com/ai/2026/01/hobby-github-repo-shows-linus-torvalds-vibe-codes-sometimes/
1•fleahunter•34m ago•0 comments

Veritensor – open-source tool to scan AI models for malware and license issues

https://github.com/ArseniiBrazhnyk/Veritensor
1•arseniibr•36m ago•1 comments

Minnesota sues Trump administration to block surge of federal immigration agents

https://www.reuters.com/world/minnesota-sues-trump-administration-block-surge-federal-immigration...
8•mickle00•36m ago•0 comments

Show HN: AI Elements Vue – A Port of Vercel's AI Elements UI Library

https://github.com/vuepont/ai-elements-vue
1•peoray•38m ago•0 comments

Discord dataset of 78M messages, voice sessions, actions and servers

https://twitter.com/H4ckmanac/status/2010691804132454708
2•circularfoyers•38m ago•0 comments

Generative AI and the end of permanent car paint

https://realizeai.substack.com/p/the-evolution-of-personalization
1•rafaelmdec•38m ago•0 comments

Ask HN: DevOps Learning Resources

1•jack_pp•39m ago•0 comments

PauseOS: Distraction-Free Phone OS

https://pauseos.com/
3•MinimalAction•41m ago•1 comments

You can now reserve a hotel room on the Moon for $250k

https://arstechnica.com/space/2026/01/you-can-now-reserve-a-hotel-room-on-the-moon-for-250000/
3•dangle1•42m ago•1 comments

Great Green Wall 2.0: China is geoengineering deserts with blue-green algae

https://www.scmp.com/news/china/science/article/3338326/great-green-wall-20-china-geoengineering-...
4•jnord•42m ago•1 comments

Who told you you couldn't do that?

https://theaiunderwriter.substack.com/p/who-told-you-you-couldnt-do-that
1•participant26•45m ago•0 comments

Wireless Power Beamed from Moving Aircraft

https://spectrum.ieee.org/wireless-power-movin-airplane
1•WaitWaitWha•48m ago•0 comments

Queen bumblebees are poor foragers thanks to sparse tongue hair

https://www.sciencenews.org/article/queen-bumblebees-tongue-hair-foraging
1•WaitWaitWha•49m ago•0 comments