tinyAgent Logo
tinyAgent Logo

Turn Functions into AI Tools

tinyAgent lets you wrap any Python function with a simple decorator, combine agents to solve complex problems, and leverage experimental meta-agents.


from tinyagent.decorators import tool
from tinyagent.agent import tiny_agent

@tool
def calculate_sum(a: int, b: int) -> int:
    """Return the sum of two integers."""
    return a + b

if __name__ == "__main__":
    agent = tiny_agent(tools=[calculate_sum])
    query = "calculate the sum of 5 and 3"
    result = agent.run(query, expected_type=int)
    print(f"Query: '{query}' -> Result: {result}")

FUNCTIONS AS AGENTS

FUNCTION
def hello()
TOOL
@tool
AGENT
🤖
RESULT
"Hello!"

Features

Function-First Design Icon

Function-First Design

Transform any Python function into an AI-powered tool with a simple decorator - no complex setup required.

Seamless Orchestration Icon

Seamless Orchestration

Chain tools together to solve complex tasks with tiny_chain's smart orchestration engine.

Modular & Extensible Icon

Modular & Extensible

Build, combine, and extend agents to create powerful solutions for any use case.

Flexible Agent Options Icon

Flexible Agent Options

Use the simple orchestrator or advanced AgentFactory to create powerful agents.

Structured Output Icon

Structured Output

Enforce JSON formats for consistent, reliable outputs across your agents.

Robust Architecture Icon

Robust Architecture

Built with reliability and flexibility in mind for production environments.

Getting Started

Terminal
# Install via pip (Recommended)
pip install tiny_agent_os

# Download the Configuration File (config.yml)
wget https://raw.githubusercontent.com/alchemiststudiosDOTai/tinyAgent/v0.65/config.yml

# Download the Environment File (.env)
wget https://raw.githubusercontent.com/alchemiststudiosDOTai/tinyAgent/v0.65/.envexample -O .env

# Edit .env with your API keys
# Required: OpenRouter API key (https://openrouter.ai)
          

Both the config.yml and env work out of the box with an openrouter API. You can use any OpenAI API, and the config has an example of a local LLM.

Core Concepts

🛠️

Tools and the @tool Decorator

Transform any Python function into a usable "tool" with the @tool decorator. This makes it discoverable by your agents, allowing them to execute functions in response to natural-language queries.

tool_example.py
from tinyagent.decorators import tool

@tool
def greet_person(name: str) -> str:
    """Return a friendly greeting."""
    return f"Hello, {name}!"
              
🔄

Orchestration with tiny_chain

tiny_chain is the main engine of tinyAgent's orchestration. It lets your agent solve complex tasks by chaining together multiple tools, using an LLM-powered "triage agent" to plan the best sequence.

tariff_research.py
#!/usr/bin/env python3
"""
tiny_chain example: automatically find and summarise U.S. import-tariff data
"""
from tinyagent.factory.tiny_chain import tiny_chain
from tinyagent.tools.duckduckgo_search import get_tool as search_tool
from tinyagent.tools.custom_text_browser import get_tool as browser_tool
from tinyagent.decorators import tool
from tinyagent.agent import get_llm

@tool(name="summarize", description="Summarize input text with the LLM")
def summarize(text: str) -> str:
    prompt = f"Summarize the following text:\n\n{text}\n\nSummary:"
    return get_llm()(prompt).strip()

# 1 – build the chain
chain = tiny_chain.get_instance(
    tools=[search_tool(), browser_tool(), summarize._tool]
)

# 2 – submit any natural-language task
task_id = chain.submit_task(
    "Find current US import tariffs and visit official trade websites for details"
)

# 3 – get structured results
print(chain.get_task_status(task_id).result)

What it demonstrates

  • 🔗 Automatic tool planning (triage agent) - Picks search → browse → summarize
  • 🛠 Pluggable tools - DuckDuckGo search + custom browser + any @tool
  • 🤖 Structured trace - steps, tools_used, errors if any
  • 🤖 LLM-powered step - summarize converts page content → concise answer

Merch

tinyAgent Sticker

tinyAgent Die Cut Stickers

tinyAgent is a free, open-source project. If you find it useful and want to show your support, consider grabbing a sticker! I receive a small percentage (around 10%) from each purchase. No pressure at all – starring the project on GitHub or contributing with a Pull Request helps immensely too!

Get Stickers →

RESOURCES & COMMUNITY HUB

| BETA STATUS

tinyAgent = BETA until V1
WORKING BUT EVOLVING
SEE ROOM FOR IMPROVEMENT?
OPEN AN ISSUE. FIX IT.
WE VALUE YOUR INPUT.