Skip to main content

A streamlined framework for building powerful LLM-powered agents

Project description

tinyAgent 🤖

A streamlined framework for building powerful LLM-powered agents that can solve complex tasks through tool execution, orchestration, and dynamic capability creation.

Made by (x) @tunahorse21 | A product of alchemiststudios.ai

Heads Up: tinyAgent is in BETA until V1. It's working but still evolving!
While I can't guarantee it's 100% bug-free, 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!

tinyAgent Logo

   __  .__                _____                         __
_/  |_|__| ____ ___.__. /  _  \    ____   ____   _____/  |_
\   __\  |/    <   |  |/  /_\  \  / ___\_/ __ \ /    \   __\
 |  | |  |   |  \___  /    |    \/ /_/  >  ___/|   |  \  |
 |__| |__|___|  / ____\____|__  /\___  / \___  >___|  /__|
              \/\/            \//_____/      \/     \/

Installation

# Clone the repository
git clone https://github.com/alchemiststudiosDOTai/tinyAgent.git

cd tinyagent

# Option 1: For Linux users, run the installation script
chmod +x install/linuxInstall.sh && ./install/linuxInstall.sh

# Option 2: Manual installation
# Create a virtual environment (recommended)
python3 -m venv .venv

# Activate the virtual environment
# On macOS/Linux
source .venv/bin/activate
# On Windows
.\.venv\Scripts\activate

# Install dependencies
# Option 1: Using UV (recommended - see INSTALL.md for details)
# Option 2: Using pip
pip install -r requirements.txt

# Set up required configuration files
# 1. Environment variables
cp .envexample .env
# Edit .env to add your API keys (especially OpenRouter)

# 2. Configuration file
cp exampleconfig.yml config.yml
# Edit config.yml to customize your settings

Pip Installation

# Simple pip installation
pip install tinyagent

Note: The orchestrator component is currently being built and is in beta.


Philosophy

  1. Functions as Agents
    • You can turn any function into a tool or agent.
    • This makes it easy to add new capabilities.
flowchart LR
    A["Python Function"] --> B["Tool"]
    B --> C["Agent"]
    C --> D["Result"]

Function to Agent Flow

# Define a simple calculator function and turn it into a tool
@tool
def calculate_sum(a: int, b: int) -> int:
    """Calculate the sum of two integers."""
    return a + b

def main():
    """Create a basic agent with a calculator tool."""
    # One-liner: create agent with our tool directly
    agent = AgentFactory.get_instance().create_agent(tools=[calculate_sum])
    # Run the agent with a query
    query = "calculate the sum of 5 and 3"
    print(f"Running agent with query: '{query}'")
    # you can also specify the expected type of the result
    result = agent.run(query, expected_type=int)
    print(f"Result: {result}")
    print(f"Result Type: {type(result)}")
  1. Hierarchical Orchestration
    • You can combine many agents together.
    • A top-level agent or orchestrator can delegate tasks to specialized agents.
    • This helps solve complex problems by breaking them into parts.
flowchart TD
    O["Research Orchestrator"] --> A1["Web Search Agent"]
    O --> A2["Summarizer Agent"]
    O --> A3["Code Snippet Agent"]

Features

  1. Modular Design

    • Tools are defined with @tool and easily integrated or swapped.
  2. Flexible Agent Options

    • Orchestrator: Simple task execution.
    • AgentFactory: Fine-tuned control.
    • DynamicAgentFactory: Dynamic agent creation.
  3. Centralized Setup

    • Factory pattern streamlines configuration and logging.
  4. Robust Error Handling

    • Custom exceptions (e.g., ToolError) improve debugging.
  5. Clean Code Structure

    • Agents handle logic; tools handle execution.
  6. Versatile Interaction

    • Use agent.execute_tool() for precision or agent.run() for broader tasks.
  7. Structured Output

    • Enforce JSON structure on LLM responses for consistent parsing
    • Enable with output.structured: true in config.yml
    • Compatible with OpenRouter's JSON schema validation

Acknowledgments & Inspo

We'd like to thank the creators of these amazing projects that inspired TinyAgent:


Key Takeaways

  • tinyAgent is perfect for scalable AI projects needing structured agent and tool management.
  • It offers extensibility, error handling, and logging, but may be overkill for simple tasks.

Important Note on Tools:

The aider tool integrated in TinyAgent is extremely powerful but requires proper understanding to use effectively. It's highly configurable with many advanced features that can dramatically enhance productivity when used correctly.

⚠️ We strongly recommend thoroughly learning aider before using it in any serious projects.

Invest time in studying the documentation at https://aider.chat/ to understand its capabilities, configuration options, and best practices. This investment will pay off significantly in your development workflow.

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.65.tar.gz (114.8 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.65-py3-none-any.whl (135.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tiny_agent_os-0.65.tar.gz
  • Upload date:
  • Size: 114.8 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.65.tar.gz
Algorithm Hash digest
SHA256 858ef717f8d793baf2473f0b81e4ecc3d43bfb22eacde20d467e920d2b490be1
MD5 b74d3f3e3a7914110a9d65c8eb636707
BLAKE2b-256 595e79b33c1b9d5cb540f00e77de680de4e948aba7d2de1aba98c86ec241339e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tiny_agent_os-0.65-py3-none-any.whl
  • Upload date:
  • Size: 135.2 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.65-py3-none-any.whl
Algorithm Hash digest
SHA256 3e9e0544df455104b4db58a55025ad21b940ff3035291031c93a4df77850e438
MD5 c7da3351f58acdc7e7cb940b51d8973f
BLAKE2b-256 6710f39205c25958b645e0ce321d2d853fc37b0513d415f84b6a672aec9da0d6

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