Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

tiny-agent-kit

中文说明

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

Install

pip install git+https://github.com/monstertulin/tiny-agent-kit.git

For local development, use pip install -e . instead.

Quickstart

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.

Design boundaries

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.

Development

uv sync --extra dev
uv run python -m unittest discover -s tests -v

The runnable example is in examples/basic.py.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages