Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agentkit-lite

A minimal, dependency-free tool-calling agent loop — the entire mechanism (call model → check for tool call → run tool → feed result back → repeat) fits in about 80 lines, in agentkit/agent.py.

Most agent frameworks bury this loop under thousands of lines of abstraction. This one doesn't hide it, because the loop is the interesting part — everything else is just plumbing to make it swappable.

Why this exists

Not a "build production agents with 10x less code" pitch. It's a small, readable reference for anyone who wants to see exactly how a tool-calling agent loop works, or who wants a 3-file starting point instead of a 2000-star framework with an opinion about everything.

Quick start (no API key needed)

git clone https://github.com/slymp3/agentkit-lite
cd agentkit-lite
python examples/demo_mock.py

This runs the real agent loop against a scripted fake model (MockClient), so you can see the tool-call → tool-result → answer cycle without any setup. Output:

  [tool] calculator({'expression': '12 * (7 + 1)'})

final answer: 12 * (7 + 1) = 96.

Real usage

pip install anthropic
export ANTHROPIC_API_KEY=sk-...
python examples/demo_live.py

Adding your own tool

from agentkit.tools import registry

@registry.register(
    name="get_weather",
    description="Get current weather for a city.",
    schema={"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
)
def get_weather(city: str) -> str:
    ...
    return f"{city}: 72F, clear"

That's the whole interface. One decorator, one function, one JSON schema.

What's in the box

File Purpose
agentkit/agent.py The loop itself (Agent, ModelResponse, ToolRegistry)
agentkit/tools.py Three example tools: calculator, file reader, word counter
agentkit/clients.py MockClient (offline) and AnthropicClient (real API)
examples/demo_mock.py Runs with zero setup
examples/demo_live.py Runs against the real Claude API

What this is not

No retries, no streaming, no async, no multi-agent orchestration, no memory store. Those are all real problems worth solving — they're just not what this repo is for. Fork it if you need them.

License

MIT

About

A minimal tool-calling agent loop in Python. Runs with zero API key via a MockClient demo, plus a real AnthropicClient for actual use. Clean extension pattern for adding tools.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages