Skip to main content

Tiny agentic framework for building AI agents which can do more than tiny just tasks.

Project description

TinyGent Logo

✨ Tiny platform for amazing agents ✨

🏠 Homepage | 📚 Documentation | 💡 Examples | 🚀 Quick Start

🤖 Tinygent is a tiny agentic framework - lightweight, easy to use (hopefully), and efficient (also hopefully ;-0) library for building and deploying generative AI applications. It provides a simple interface for working with various models and tools, making it ideal for developers who want to quickly prototype and deploy AI solutions.

🎯 Create an agent

# uv sync --extra openai

from tinygent.tools import tool
from tinygent.core.factory import build_agent

@tool
def get_weather(location: str) -> str:
    """Get the current weather in a given location."""
    return f'The weather in {location} is sunny with a high of 75°F.'

agent = build_agent(
    'react',
    llm='openai:gpt-4o-mini',
    tools=[get_weather],
)

print(agent.run('What is the weather like in Prague?'))

🚀 Getting Started

📋 Prerequisites

Before you begin using tinygent, ensure that you meet the following software prerequisites.

💻 Install From Source

  1. Clone the tinygent repository to your local machine.

    git clone git@github.com:filchy/tinygent.git tinygent
    cd tinygent
    
  2. Create a Python environment.

    uv venv --seed .venv
    source .venv/bin/activate
    
  3. Install the tinygent library. To install only the core tinygent library without any optional dependencies, run the following:

    uv sync
    

    To install the tinygent library along with all of the optional dependencies. Including developer tools (--all-groups), additional packages and all of the dependencies needed for profiling and plugins (--all-extras) in the source repository, run the following:

    uv sync --all-groups --all-extras
    

    [!NOTE] Not all packages are included in the default installation to keep the library lightweight. You can customize your installation by specifying the optional dependencies you need.

  4. Install tinygent in editable mode (development mode), so that changes in the source code are immediately reflected:

    uv pip install -e .
    

🎬 See It In Action

TinyChat Demo

🏗️ Architecture

%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#e1f5ff', 'primaryTextColor': '#0d47a1', 'primaryBorderColor': '#42a5f5', 'lineColor': '#1976d2', 'secondaryColor': '#fff4e1', 'tertiaryColor': '#f0e1ff'}}}%%
flowchart LR
    User[User Code]:::userNode
    Factory[Factories]:::factoryNode
    Runtime[Runtime Registry]:::runtimeNode
    Components[Agents & Tools & Memory]:::componentNode
    Packages[Provider Packages]:::packageNode

    User a@--> Factory
    Factory b@--> Runtime
    Runtime c@--> Components
    Packages d@-.-> Runtime

    a@{animate: true}
    b@{animate: true}
    c@{animate: true}
    d@{animate: true}

    linkStyle 0 stroke-width:2px
    linkStyle 1 stroke-width:2px
    linkStyle 2 stroke-width:2px
    linkStyle 3 stroke-width:2px,stroke-dasharray: 5 5

    classDef userNode fill:#e1f5ff,stroke:#1976d2,stroke-width:2px,color:#0d47a1
    classDef factoryNode fill:#fff4e1,stroke:#f57c00,stroke-width:2px,color:#e65100
    classDef runtimeNode fill:#f0e1ff,stroke:#7b1fa2,stroke-width:2px,color:#4a148c
    classDef componentNode fill:#e1ffe1,stroke:#388e3c,stroke-width:2px,color:#1b5e20
    classDef packageNode fill:#ffe1e1,stroke:#d32f2f,stroke-width:2px,color:#b71c1c

Tinygent uses a registry-based plugin architecture: Packages register components into the Runtime. Factories query the Runtime to build Components for your code.

💡 Examples (Quick Start)

  1. 🔑 Ensure you have set the OPENAI_API_KEY environment variable to allow the example to use OpenAI's API. An API key can be obtained from openai.com.

    export OPENAI_API_KEY="your_openai_api_key"
    
  2. ▶️ Run the examples using uv:

    uv run examples/agents/multi-step/main.py
    
  3. 🔍 Explore more examples below:

📚 Features & Examples

Name Type Description
Tool Usage Basics Basic tool creation and usage
LLM Usage Basics Direct LLM interaction patterns
Function Calling Basics Function calling with LLMs
Chat Buffer Memory Memory Store complete conversation history
Summary Buffer Memory Memory Summarize older messages to save tokens
Window Buffer Memory Memory Keep only recent N messages
Combined Memory Memory Combine multiple memory strategies
Basic Tools Tools Simple tool definitions with @tool
Reasoning Tools Tools Tools that provide reasoning traces
JIT Tools Tools Just-in-time compiled tools
Middlewares in Agents Agents Add custom processing layers to agents
ReAct Agent Agents Reasoning and acting pattern
Multi-Step Agent Agents Break down complex tasks into steps
Squad Agent Agents Coordinate multiple specialized agents
Modular Agentic Planner Agents Advanced planning with modular architecture
Tiny OpenAI Package OpenAI LLMs and embeddings
Tiny Anthropic Package Anthropic Claude LLMs
Tiny MistralAI Package Mistral AI LLMs
Tiny Gemini Package Google Gemini LLMs
Tiny VoyageAI Package VoyageAI embedding models
Brave Tools Package Brave search integration
Tiny Chat Package FastAPI-based chat interface
Tiny Graph Package Neo4j knowledge graph integration

✅ Linting & Formatting

To ensure code quality, formatting consistency, and type safety, run:

uv run fmt   # Format code Ruff
uv run lint  # Run Ruff linter and Mypy type checks

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

tinygent-0.1.1008.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

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

tinygent-0.1.1008-py3-none-any.whl (114.6 kB view details)

Uploaded Python 3

File details

Details for the file tinygent-0.1.1008.tar.gz.

File metadata

  • Download URL: tinygent-0.1.1008.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tinygent-0.1.1008.tar.gz
Algorithm Hash digest
SHA256 168d5b50a397482957f726d42f8e5d4a02ad0e3f84f373c0b45ad080ddc50d26
MD5 7a2c98db883854331a7e83cbbdaab3e0
BLAKE2b-256 7effd8bc024c7129a67e26dba88022ec914279e8f2931864cd68d7e64e293355

See more details on using hashes here.

File details

Details for the file tinygent-0.1.1008-py3-none-any.whl.

File metadata

  • Download URL: tinygent-0.1.1008-py3-none-any.whl
  • Upload date:
  • Size: 114.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tinygent-0.1.1008-py3-none-any.whl
Algorithm Hash digest
SHA256 b8a373d1dffe50cf95014120afb4551be361f2ff552618ddd375e38440f5c95b
MD5 1c116ee069b6e71c0e8de3e84de854ec
BLAKE2b-256 0f7ae08f3fc1e7bf1806998667eea5b925a6b4963f9a53b99d4fc0e125674b2b

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