Personal Python library · 2026

Agentkit

The shared foundation of all my AI assistants: a small, typed engine reused in every project.

Role
Author and maintainer
Period
2026
Stack
PythonPydanticasyncioFastAPIMCPOpenTelemetry

live demo Event playground

The library code is private; the playground replays the event flow with examples.

agentkit · playgroundSimulation · sample events
agent.pypython
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 stream

Arguments are validated with Pydantic before running: if the model gets them wrong, it gets the error back and corrects itself.

event stream
  1. 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.

~30klines of library
~33klines of tests
5+projects using it
4channels: web, Telegram, WhatsApp, voice

C — How it works

  1. 01

    Typed tools

    A Python function with annotated arguments becomes a tool with a strict schema.

  2. 02

    One loop, many channels

    The same agent answers from web, terminal, Telegram, WhatsApp or voice.

  3. 03

    Human control

    Every call can be approved, rejected or corrected before it runs.

  4. 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.