Skip to main content

A streamlined framework for building powerful LLM-powered agents that actually work

Project description

tinyAgent

tinyAgent Logo

Turn any Python function into an AI‑powered agent in just a few lines:

from tinyagent import tool, ReactAgent

@tool
def multiply(a: float, b: float) -> float:
    """Multiply two numbers together."""
    return a * b

@tool
def divide(a: float, b: float) -> float:
    """Divide the first number by the second number."""
    return a / b

agent = ReactAgent(tools=[multiply, divide])
result = agent.run("What is 12 times 5, then divided by 3?")
# → 20

That's it! The agent automatically:

  • Understands it needs to perform multiple steps
  • Calls multiply(12, 5) → gets 60
  • Takes that result and calls divide(60, 3) → gets 20
  • Returns the final answer

Why tinyAgent?

  • Zero boilerplate – Just decorate functions with @tool
  • Automatic reasoning – Agent figures out which tools to use and in what order
  • Built-in LLM – Works out of the box with OpenRouter
  • Type safe – Full type hints and validation
  • Production ready – Error handling and retries

Installation

pip install tiny_agent_os

Quick Setup

Set your API key:

export OPENAI_API_KEY=your_openrouter_key_here
export OPENAI_BASE_URL=https://openrouter.ai/api/v1

Get your key at openrouter.ai

Note: This is a complete rewrite. The old version (0.72) will be frozen soon and maintained for critical fixes only. New development happens here.

More Examples

Multi-step reasoning

from tinyagent import tool, ReactAgent

@tool
def calculate_percentage(value: float, percentage: float) -> float:
    """Calculate what percentage of a value is."""
    return value * (percentage / 100)

@tool
def subtract(a: float, b: float) -> float:
    """Subtract b from a."""
    return a - b

agent = ReactAgent(tools=[calculate_percentage, subtract])
result = agent.run("If I have 15 apples and give away 40%, how many are left?")
print(result)  # → "You have 9 apples left."

Behind the scenes:

  1. Agent calculates 40% of 15 → 6
  2. Subtracts 6 from 15 → 9
  3. Returns a natural language answer

Key Features

ReactAgent

  • Multi-step reasoning - Breaks down complex problems automatically
  • Clean API - Simple, ergonomic interface
  • Error handling - Built-in retry logic and graceful failures

Tools Philosophy

Every function can be a tool. Keep them:

  • Atomic - Do one thing well
  • Typed - Use type hints for parameters
  • Documented - Docstrings help the LLM understand usage

Status

BETA - Actively developed and used in production. Breaking changes possible until v1.0.

Found a bug? Have a feature request? Open an issue!

License

Business Source License 1.1

  • Free for individuals and small businesses (< $1M revenue)
  • Enterprise license required for larger companies

Contact: info@alchemiststudios.ai


Made by @tunahorse21 | alchemiststudios.ai focusing on keeping it "tiny"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiny_agent_os-0.1.0.tar.gz (35.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tiny_agent_os-0.1.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file tiny_agent_os-0.1.0.tar.gz.

File metadata

  • Download URL: tiny_agent_os-0.1.0.tar.gz
  • Upload date:
  • Size: 35.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for tiny_agent_os-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2161bdda6da52c858802a00193d9600d57873e9b2435a0a95a74413fd32e97e5
MD5 bf1a9a82c45240ed9386a17901a5dacf
BLAKE2b-256 eaca2dbecb8fb6190b9a1369967aa461945cda7ae77aa53f3c1b42e6bf611dc2

See more details on using hashes here.

File details

Details for the file tiny_agent_os-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tiny_agent_os-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for tiny_agent_os-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4094258768f094e66c1ad1197bd38f323237dbe7514650fcc4a44bdcdbdb903a
MD5 d8a2aa7337f604b0b680b72ae8c6f3e5
BLAKE2b-256 2739581b3d23396fd9b2d641d4e97c0eff61b0e4c95673ff62fc4ca46162fd73

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page