Personal Python library · 2026
Agentkit
The shared foundation of all my AI assistants: a small, typed engine reused in every project.
live demo Event playground
The library code is private; the playground replays the event flow with examples.
from pydantic import BaseModel, Field
from agentkit import AgentLoop, tool
class OrderQuery(BaseModel):
order_id: int = Field(gt=0)
include_tracking: bool = False
@tool
async def lookup_order(q: OrderQuery) -> dict:
"""Status of a shop order."""
return await shop.orders.get(q.order_id, q.include_tracking)
loop = AgentLoop(provider=main, tools=[lookup_order])
async for event in loop.run("Where is my order 42?"):
ui.render(event) # typed events, one streamfrom decimal import Decimal
from agentkit import AgentLoop, tool
@tool(requires_approval=True)
async def refund_order(order_id: int, amount_eur: Decimal) -> str:
return await payments.refund(order_id, amount_eur)
async def gate(call): # before execution
return await operator.ask(call) # approve or reject
loop = AgentLoop(provider=main, tools=[refund_order],
approval=gate)from agentkit import AgentLoop, FallbackProvider
provider = FallbackProvider(
[primary, secondary],
retry_on=(RateLimited, Timeout),
)
loop = AgentLoop(provider=provider, tools=[search_catalog],
memory=SqliteMemory("shop.db"),
tracing=True) # OpenTelemetryArguments are validated with Pydantic before running: if the model gets them wrong, it gets the error back and corrects itself.
- Press Run: each step of the agent arrives as a typed event, in the order it happens.
- Providers
- 4 · automatic fallback
- Channels
- Telegram · WhatsApp · web · voice
- Memory
- file and vector, hybrid search
- Tracing
- OpenTelemetry
- Size
- ~30k lines · ~33k of tests
A — The problem
Every AI assistant project repeats the same pieces: the loop that talks to the model, tools, streaming, memory, channels like Telegram. Rewriting them each time means different bugs in each project and no shared improvements.
B — What I built
I gathered those pieces into Agentkit, the library that now powers the e-commerce bots, AURIGA, RECALL, Splitro and my other assistants. A single execution loop with tools written in Python and validated by Pydantic, typed events for streaming, human approval on sensitive actions, automatic failover to another provider, memory, Telegram and WhatsApp adapters, real-time voice and tracing.
C — How it works
- 01
Typed tools
A Python function with annotated arguments becomes a tool with a strict schema.
- 02
One loop, many channels
The same agent answers from web, terminal, Telegram, WhatsApp or voice.
- 03
Human control
Every call can be approved, rejected or corrected before it runs.
- 04
Reliability
If a provider fails, the loop moves to the next one without losing the conversation.
D — The system
A simplified map of the components: not the technical documentation, but it shows how the parts talk to each other.
E — Why it works
Used everywhere
Every improvement reaches every project with a version bump.
More tests than code
Around 33k lines of tests for around 30k lines of library.
Provider-agnostic
Switching models is a config line, not a rewrite.
Events, not strings
UIs and logs receive typed events: easy to render and to check.