tiny-agent-kit is a small, provider-agnostic Python agent loop for applications that need typed tools without adopting a large orchestration framework.
It borrows the useful ideas behind PydanticAI, OpenAI Agents, and MCP:
- Pydantic-validated tool arguments and JSON schemas
- A bounded tool-calling loop with model-visible error feedback
- Optional structured final output
- A standard-library OpenAI-compatible adapter
- No provider SDK, tracing backend, queue, or hosted control plane in the core
pip install git+https://github.com/monstertulin/tiny-agent-kit.gitFor local development, use pip install -e . instead.
import os
from pydantic import BaseModel
from tiny_agent import Agent, OpenAICompatibleModel, tool
class AddParams(BaseModel):
a: int
b: int
@tool(name="add", description="Add two integers.", parameters=AddParams)
def add(params: AddParams) -> int:
return params.a + params.b
model = OpenAICompatibleModel(
base_url="https://api.openai.com/v1",
api_key=os.environ["OPENAI_API_KEY"],
model="gpt-4o-mini",
)
agent = Agent(model, tools=[add], max_steps=4)
print(agent.run("What is 21 + 21?").output)The model adapter also works with local servers and other OpenAI-compatible providers. Implement ChatModel.complete() to connect a different provider.
This project is intentionally synchronous and single-agent. Add MCP for a shared tool protocol, Playwright or Stagehand for browser work, and a durable workflow runtime only when the application actually needs those capabilities. Tool failures are returned to the model as JSON feedback; put authorization, domain allowlists, and human approval outside the model loop.
uv sync --extra dev
uv run python -m unittest discover -s tests -vThe runnable example is in examples/basic.py.
MIT