A streamlined framework for building powerful LLM-powered agents that can solve complex tasks through tool execution, orchestration, and dynamic capability creation.
Project description
tinyAgent 🤖
Why tinyAgent?
Turn any Python function into an AI‑powered agent in three lines:
from tinyagent.decorators import tool
from tinyagent.agent import tiny_agent
@tool # 1️⃣ function → tool
def add(a: int, b: int) -> int:
return a + b
agent = tiny_agent(tools=[add]) # 2️⃣ tool → agent
print(agent.run("add 40 and 2")) # 3️⃣ natural‑language call
# → 42
- Zero boilerplate – just a decorator.
- Built‑in LLM orchestration – validation, JSON I/O, retry, fallback.
- ReAct Pattern Support – Advanced reasoning + acting pattern for complex multi-step tasks.
- Scales as you grow – add more tools or plug into tiny_chain without rewrites.
Made by (x) @tunahorse21 | A product of alchemiststudios.ai
Heads Up
tinyAgent is in BETA until V1. It's working but still evolving! I can't guarantee it's 100% bug-free, but I'm actively improving it whenever I can between my day job and business.
Found something that could be better? Show off your skills and open an issue with a fix: I'd genuinely appreciate it!
Overview
tinyAgent is a streamlined framework for building powerful, LLM-powered agents that solve complex tasks through tool execution, orchestration, and dynamic capability creation. Convert any Python function into a useful tool and then into an agent with minimal configuration, unlocking a world of scalable, modular possibilities.
Installation & Setup
1. Install the Package
# Basic installation
pip install tiny_agent_os
# With observability features (recommended)
pip install "tiny_agent_os[traceboard]"
# With all features (RAG + observability)
pip install "tiny_agent_os[rag,traceboard]"
2. Get the Configuration Files
After installation, you'll need two configuration files:
# Create a basic config.yml
python -m tinyagent.config init
# Or download the example config directly
wget https://raw.githubusercontent.com/alchemiststudiosDOTai/tinyAgent/v0.65/config.yml
Create a .env file with your API keys:
# Download the example .env file
wget https://raw.githubusercontent.com/alchemiststudiosDOTai/tinyAgent/v0.65/.envexample -O .env
# Edit with your API keys
nano .env # or use any text editor
3. Quick Start Example
from tinyagent.decorators import tool
from tinyagent.agent import tiny_agent
from tinyagent.observability.tracer import configure_tracing # For tracing support
# Define a tool
@tool
def add(a: int, b: int) -> int:
return a + b
# Enable tracing (optional)
configure_tracing() # This reads your config.yml
# Create an agent (with tracing enabled)
agent = tiny_agent(tools=[add], trace_this_agent=True)
# Run it!
result = agent.run("add 40 and 2")
print(result) # → 42
4. ReAct Pattern Example (NEW!)
For complex multi-step reasoning tasks, use the ReAct agent. The framework automatically tells the LLM about available tools, so you can use any function name:
from tinyagent.react.react_agent import ReActAgent
from tinyagent.decorators import tool
from tinyagent.agent import get_llm
# Define tools - any function name works!
@tool
def calculate(expression: str) -> float:
"""Evaluate a mathematical expression."""
return eval(expression)
@tool
def add_numbers(a: float, b: float) -> float:
"""Add two numbers together."""
return a + b
# Create ReAct agent
agent = ReActAgent()
agent.register_tool(calculate._tool)
agent.register_tool(add_numbers._tool)
# Run with reasoning steps - framework automatically handles tool discovery
result = agent.run_react(
query="If I have 15 apples and give away 40%, how many do I have left?",
llm_callable=get_llm(),
max_steps=5
)
print(result) # → "You have 9 apples left."
Key Features:
- ✅ Automatic tool discovery - Framework tells LLM about available tools
- ✅ No "Unknown tool" errors - LLM uses exact tool names from registration
- ✅ Zero configuration - Just register tools and run
- ✅ Multi-step reasoning - Handles complex queries requiring multiple tool calls
Post-Installation Configuration
After installing (either via pip or from source), remember to configure your environment and .env files with relevant API keys from https://openrouter.ai
Both the config.yml and env work out of the box with a openrouter API, you can use any openai API, and the config has an example of a local LLM. The /documentation folder has more details and is being updated.
Features
- Modular Design: Easily convert any function into a tool.
- Flexible Agent Options: Use the simple orchestrator or advanced
AgentFactory. - ReAct Pattern: Built-in support for Reasoning + Acting pattern for complex multi-step reasoning tasks.
- Robust Error Handling: Improved debugging with custom exceptions and JSON parsing.
- Structured Output: Enforce JSON formats for consistent outputs.
- Comprehensive Observability: Built-in OpenTelemetry tracing with multiple exporters (console, OTLP, SQLite) and a web-based trace viewer.
Acknowledgments & Inspirations
- my wife
- HuggingFace SmoLAgents
- Aider-AI
- And many other open-source contributors!
Learn More
- Functions as Tools
- ReAct Pattern Guide
- tinyChain Overview (Note: tinyChain will be sunset soon in favor of ReAct pattern due to better performance and stability. Existing code will continue to work but won't receive updates.)
- RAG
- Observability
Contact
For questions, suggestions, or business inquiries:
- Email: info@alchemiststudios.ai
- X: @tunahorse21
- Website: alchemiststudios.ai
License
Business Source License 1.1 (BSL) This project is licensed under the Business Source License 1.1. It is free for individuals and small businesses (with annual revenues under $1M). For commercial use by larger businesses, an enterprise license is required. For licensing or usage inquiries, please contact: info@alchemiststudios.ai
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tiny_agent_os-0.72.12.tar.gz.
File metadata
- Download URL: tiny_agent_os-0.72.12.tar.gz
- Upload date:
- Size: 2.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
592c911681861438589e53e00d98ce1ff3898d45d35a4fb6cc79e529692c81df
|
|
| MD5 |
3cfb9ef4edb5d4e6e7540aedb3ccb6ff
|
|
| BLAKE2b-256 |
00e88837b86596775b709e44162278ab258414848d2512691a8ef6d14bea9e17
|
File details
Details for the file tiny_agent_os-0.72.12-py3-none-any.whl.
File metadata
- Download URL: tiny_agent_os-0.72.12-py3-none-any.whl
- Upload date:
- Size: 166.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d647d9fbffc7715cd9268be8515cf7f5e0f03f8ef0c3bc8112c6e03d9c0bf02
|
|
| MD5 |
d20126826ace5114c9c99cfa5d22bc63
|
|
| BLAKE2b-256 |
9005ff2b7c36dac428e04e537535bfb5d27583f9f7b935b928be39f170f5650e
|