pedrojimenez.dev
All work
Open source2026 · MVP · in beta

agentkit

An open-source TypeScript toolkit for building production AI agents — distilled from the hard parts of real client work. The loop that can't run away with the bill, JSON you can trust, and retrieval that never leaks across tenants.

agentkit
agentkit — // business impact 1agentkit — // business impact 2

// context & bottleneck

Frameworks make the demo easy; production makes the demo lie. The model sometimes returns prose where you asked for JSON, a runaway tool loop is a bill, and two tenants must never see each other's documents. These aren't exotic failures — they're what broke while shipping real agents for paying clients.

// solution & architecture

Extract the reusable core from two production systems — a multi-tenant dental copilot and a social publishing bot — into one zero-dependency library, and leave the client-specific parts private.

An agent loop with a hard budget: token and cost ceilings are checked before every model call, so a runaway agent stops before it spends — verified by tests that drive the loop into the cap on purpose.
Reliable structured output: ask for JSON, validate the shape, and on a miss re-ask with the exact error so the model self-corrects instead of the pipeline crashing.
Tenant-safe RAG: retrieval is scoped by a tenant key at the store level, not filtered after the fact — a query can never see another tenant's chunks.
Typed tool registry that never trusts model shapes: garbage arguments coerce to {}, and a tool refuses cleanly instead of throwing.

// business impact

Released open source under MIT, tested with node:test against a mocked LLM and verified end to end against a live model — structured extraction, a tool-calling loop, and budget accounting, with the reasoning-token trap that emptied replies in production diagnosed and fixed in the open. This is the reusable, tested part of what makes the client systems work.

← PreviousLuxeDriveNext →Melow
Related workOpen source
MelowAI · SaaS · 2026Social Command CenterAutomation · AI · 2026MoneyGuardMobile · AI · 2025