AgentKernel

Building the nervous system of autonomous software

Track 03 of four. The plumbing layer behind every production system on this site, lifted out and written twice: once in async Python, once in modern ESM JavaScript. So the patterns are language-portable.

Open source github.com ↗
Track
03 of 4 · Production engines
Languages
Python 3.12 (async) Node.js / ESM JavaScript
Dependencies
Redis SQLite PostgreSQL (optional)
Engines (6)
01 LLM router + circuit breaker 02 SCAR memory + SHA-256 cache 03 Retriever: search, Firecrawl, graphify 04 Queue + SSE streaming 05 Media: TTS voice, subtitles, ChaiPitch 06 JWT auth + CRUD + DB schema
Repository

What this track is

AgentKernel is the engines repo: the infrastructure layer that sits underneath the agentic systems. Every production product on this site uses some subset of these six engines. The repo isolates them, removes the application-specific bits, documents the trade-offs, and ships them in both Python and JavaScript so the patterns travel.

Engine Pipeline & Verification Topology

The Six Engines: Live Request Path

The six engines

1. Multi-provider LLM router

Routes LLM traffic across multiple providers (Anthropic, OpenAI, Ollama). Each provider has a circuit breaker; hard failures (rate limit, 5xx) trip the breaker and shift traffic to the next provider in priority order. Includes a request-budget guard so a runaway loop can't bankrupt you.

2. SHA-256 idempotency cache: SCAR

I named it “Repeat Failure Guard” in the production system; in the open-source release it's just SCAR. SQLite-backed. Takes a deterministic SHA-256 of the canonicalised input, returns the cached output within a TTL. Eliminates wasted spend on repeated identical agent calls : which happens more than you'd expect.

3. Retriever: search, Firecrawl scraper, graphify, content analyzer

Four retrieval tools in one engine. Web search across providers (SerpAPI, Brave, DuckDuckGo). Firecrawl-based page scraping and content extraction. A dependency graph builder (graphify) that maps relationships between code files or data nodes so agents can navigate context without reading everything. A content analyzer that scores relevance, authority, and sentiment.

4. Queue with circuit breaker and SSE streaming

Standard producer/consumer task queue with a stateful circuit breaker per downstream service. When a downstream goes flaky the consumer enters half-open mode and probes; dead-letter handling for tasks that exhaust retries. SSE streaming layer sits alongside so a connected browser can watch task progress in real time without polling.

5. Media: TTS voice synthesis, subtitles, ChaiPitch outreach

Three independent tools. A multi-provider TTS voice engine (ElevenLabs, Gemini TTS) that compiles audio into WAV containers. A subtitle generator that aligns text segments to audio timing. ChaiPitch: an AI copywriting engine that generates Hinglish WhatsApp outreach messages for Indian D2C leads, including a Remotion-compatible StoryTemplate for programmatic video output.

6. JWT auth + CRUD + database schema

Short-lived access tokens, longer-lived refresh tokens, refresh-token rotation on use, token revocation on password reset. Full CRUD layer with Prisma (ESM) and SQLAlchemy (Python) schemas, multi-tenant database structure, and async database session management.

Why two languages

Two reasons. First, the production work is split : the Agentic SDLC pipeline is Python, the WellnessInYou backend has parts in TypeScript/ESM. I needed the patterns to travel cleanly between them. Second, writing the same engine twice forces clarity. If the JavaScript version is twice as long as the Python version, one of them is doing something wrong : usually it's something I should fix in both.

Honest framing

These engines aren't novel research. They're well-known patterns implemented carefully. The reason this track exists is that if you're hiring me, you want to see how I treat the unsexy infrastructure layer. The router, the cache, the queue, the webhook verifier : this is the work that determines whether a production system stays up.

How to evaluate the code

Open the router engine in both languages and compare them. If the patterns are clearly the same and the differences are explained by language idioms, that's the signal I'd want a reviewer to take away.