Metadata-Version: 2.4
Name: tinygent
Version: 0.1.1
Summary: Tiny agentic framework for building AI agents which can do more than tiny just tasks.
Project-URL: Homepage, https://github.com/filchy/tinygent
Project-URL: Repository, https://github.com/filchy/tinygent
Project-URL: Issues, https://github.com/filchy/tinygent/issues
Author: Filip Chytil
License-Expression: MIT
License-File: LICENSE
Keywords: agentic,agents,ai,anthropic,framework,llm,openai
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: ==3.12.*
Requires-Dist: async-lru>=2.0.5
Requires-Dist: jinja2>=3.1.6
Requires-Dist: langchain-core>=0.3.74
Requires-Dist: opentelemetry-exporter-otlp>=1.38.0
Requires-Dist: opentelemetry-sdk>=1.38.0
Requires-Dist: pydantic>=2.11.7
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: typer>=0.19.2
Provides-Extra: anthropic
Requires-Dist: tinygent-anthropic; extra == 'anthropic'
Provides-Extra: brave
Requires-Dist: tinygent-brave; extra == 'brave'
Provides-Extra: chat
Requires-Dist: tinygent-chat; extra == 'chat'
Provides-Extra: dev
Requires-Dist: mypy>=1.17.1; extra == 'dev'
Requires-Dist: ruff>=0.12.11; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.7.1; extra == 'docs'
Requires-Dist: mkdocs>=1.6.1; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=1.0.2; extra == 'docs'
Provides-Extra: gemini
Requires-Dist: tinygent-gemini; extra == 'gemini'
Provides-Extra: graph
Requires-Dist: tinygent-graph; extra == 'graph'
Provides-Extra: mistralai
Requires-Dist: tinygent-mistralai; extra == 'mistralai'
Provides-Extra: openai
Requires-Dist: tinygent-openai; extra == 'openai'
Provides-Extra: voyageai
Requires-Dist: tinygent-voyageai; extra == 'voyageai'
Description-Content-Type: text/markdown

<div align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset=".github/images/logo-light.svg">
    <source media="(prefers-color-scheme: light)" srcset=".github/images/logo-dark.svg">
    <img alt="TinyGent Logo" src=".github/images/logo-dark.svg" width="80%">
  </picture>
</div>

<div align="center">
  <h3>Tiny platform for amazing agents.</h3>

  <h4>
    <a href="https://github.com/filchy/tinygent">Homepage</a> | <a href="https://filchy.github.io/tinygent">Documentation</a>
  </h4>
</div>

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

```python
# 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 [Git](https://git-scm.com/)
- Install [uv](https://docs.astral.sh/uv/getting-started/installation/)

### Install From Source

1. Clone the tinygent repository to your local machine.
    ```bash
    git clone git@github.com:filchy/tinygent.git tinygent
    cd tinygent
    ```

2. Create a Python environment.
    ```bash
    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:
    ```bash
    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:
    ```bash
    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:
    ```bash
    uv pip install -e .
    ```

## 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`](https://openai.com/).
    ```bash
    export OPENAI_API_KEY="your_openai_api_key"
    ```

2. Run the examples using `uv`:
    ```bash
    uv run examples/agents/multi-step/main.py
    ```

3. Explore more examples below:

### Basics

1. [Tool Usage](examples/tool-usage)
2. [LLM Usage](examples/llm-usage)
3. [Function Calling](examples/function-calling)

### Memory

1. [Chat Buffer Memory](examples/memory/basic-chat-memory)
2. [Summary Buffer Memory](examples/memory/buffer-summary-memory)
3. [Window Buffer Memory](examples/memory/buffer-window-chat-memory)
4. [Combined Memory](examples/memory/combined-memory)

### Tools

1. [Basic Tools](examples/tool-usage/main.py)
2. [Reasoning Tools](examples/tool-usage/main.py)
3. [JIT Tools](examples/tool-usage/main.py)

### Agents

1. [Middlewares in Agents](examples/agents/middleware/)
2. [ReAct Agent](examples/agents/react/)
3. [Multi-Step Agent](examples/agents/multi-step/)
4. [Squad Agent](examples/agents/squad/)
5. [Modular Agentic Planner Agent](examples/agents/map/)

### Packages

1. [Brave Tools](packages/tiny_brave/)
2. [Tiny Chat](packages/tiny_chat)
3. [Tiny OpenAI](packages/tiny_openai)
4. [Tiny MistralAI](packages/tiny_mistralai)
5. [Tiny Gemini](packages/tiny_gemini)
6. [Tiny Anthropic](packages/tiny_anthropic)
7. [Tiny VoyageAI](packages/tiny_voyageai)
8. [Tiny Graph](packages/tiny_graph)

## Linting & Formatting

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

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