Metadata-Version: 2.4
Name: manolo-bot
Version: 0.6.1
Summary: Self-hosted AI agent and Python library for Telegram with tools, memory, and MCP
Author-email: Carlos Cesar Caballero Díaz <ccesarcaball.cc@gmail.com>
Project-URL: Homepage, https://github.com/cccaballero/manolo_bot
Project-URL: Documentation, https://manolo-bot.readthedocs.io/
Project-URL: Repository, https://github.com/cccaballero/manolo_bot
Project-URL: Issues, https://github.com/cccaballero/manolo_bot/issues
Project-URL: Changelog, https://github.com/cccaballero/manolo_bot/releases
Keywords: telegram,telegram-bot,telegram-ai-bot,ai,ai-agent,llm,chatbot,self-hosted,langchain,langgraph,mcp,rag,openai,gemini,ollama
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.11.11
Requires-Dist: aiogram>=3.17.0
Requires-Dist: beautifulsoup4>=4.13.3
Requires-Dist: ddgs>=9.6.0
Requires-Dist: deepagents>=0.7
Requires-Dist: envmodel>=0.2
Requires-Dist: google-generativeai>=0.8.4
Requires-Dist: langchain>=0.3.20
Requires-Dist: langchain-community>=0.3.19
Requires-Dist: langchain-core>=0.3.52
Requires-Dist: langchain-google-genai>=2.0.10
Requires-Dist: langchain-mcp-adapters>=0.1.4
Requires-Dist: langchain-ollama>=0.2.3
Requires-Dist: langchain-openai>=0.3.8
Requires-Dist: langgraph>=0.5.4
Requires-Dist: mcp>=1.3.1
Requires-Dist: pillow>=11.1.0
Requires-Dist: python-dotenv>=1.0.1
Requires-Dist: telegramify-markdown[mermaid]>=0.5.1
Requires-Dist: transformers>=4.53.0
Requires-Dist: youtube-transcript-api>=1.1.1
Requires-Dist: langchain-tavily>=0.2.17
Requires-Dist: html2text>=2025.4.15
Requires-Dist: pypdf>=6.12.2
Requires-Dist: langchain-text-splitters>=1.1.0
Requires-Dist: docx2txt>=0.9
Requires-Dist: redis>=5.0
Requires-Dist: croniter>=6.2.4
Provides-Extra: docs
Requires-Dist: sphinx>=9.1.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=3.1.0; extra == "docs"
Requires-Dist: myst-parser>=5.1.0; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints>=3.10.3; extra == "docs"
Dynamic: license-file

# Manolo Bot

**Your own AI agent in Telegram — with tools, memory, and MCP.**

[![PyPI](https://img.shields.io/pypi/v/manolo-bot.svg)](https://pypi.org/project/manolo-bot/) [![PyPI downloads](https://img.shields.io/pypi/dm/manolo-bot.svg)](https://pypi.org/project/manolo-bot/) [![Python versions](https://img.shields.io/pypi/pyversions/manolo-bot.svg)](https://pypi.org/project/manolo-bot/) [![License: MIT](https://img.shields.io/github/license/cccaballero/manolo_bot.svg)](https://github.com/cccaballero/manolo_bot/blob/master/LICENSE) [![Documentation](https://readthedocs.org/projects/manolo-bot/badge/?version=latest)](https://manolo-bot.readthedocs.io/en/latest/) [![GitHub stars](https://img.shields.io/github/stars/cccaballero/manolo_bot?style=social)](https://github.com/cccaballero/manolo_bot)

`manolo-bot` is a self-hosted AI agent for Telegram and a reusable Python library. It reasons with an LLM, uses tools,
reads your documents with RAG, keeps long-term memory, and can run scheduled actions — with OpenAI, Gemini, or local
models via Ollama or LM Studio.

## Why Manolo?

- **Agentic, not just chat** — multi-step tool use for search, documents, MCP, and web content.
- **Bring your own model** — OpenAI, Google Gemini, Ollama, or any OpenAI-compatible endpoint.
- **Your data stays yours** — self-host it, use local models, and keep conversations on your infrastructure.
- **Telegram-native** — private chats, groups, documents, images, voice notes, and scheduled actions.
- **Library-first** — import `LLMAgent` or `LLMDeepAgent` and build your own assistant.

## Quick start

### 1. Create a Telegram bot

Talk to [@BotFather](https://t.me/BotFather), create a bot, and copy its token.

### 2. Run it from PyPI

```shell
pip install manolo-bot
```

Create a `.env` file:

```dotenv
TELEGRAM_BOT_NAME=Manolo
TELEGRAM_BOT_USERNAME=your_bot_username
TELEGRAM_BOT_TOKEN=your_bot_token
GOOGLE_API_KEY=your_google_api_key
```

Then start the bot:

```shell
manolo-bot
```

### 3. Or run it with Docker

```shell
git clone https://github.com/cccaballero/manolo_bot.git
cd manolo_bot
cp env.example .env
# edit .env
docker compose up -d
```

See [DOCKER.md](DOCKER.md) for details.

## Features

| Feature | What it does |
|---|---|
| **Agent modes** | `agent` (default), `deep_agent` (planning, skills, virtual filesystem, memory), and `llm` (simple) |
| **MCP** | Connect external tools and data sources through the Model Context Protocol |
| **RAG** | Index local documents and let the agent search them with `rag_search` |
| **Memory** | Per-chat long-term memory in `deep_agent` mode |
| **Scheduling** | Ask the agent to run a prompt later or on a cron schedule |
| **Multimodal** | Images, voice notes, and documents (when enabled) |
| **Providers** | OpenAI, Gemini, Ollama, LM Studio, and OpenAI-compatible APIs |

## Documentation

Full documentation, configuration reference, and library examples are at
[manolo-bot.readthedocs.io](https://manolo-bot.readthedocs.io/).

## Configuration

The bot is configured entirely through environment variables. The minimum for a Gemini-backed bot:

```dotenv
TELEGRAM_BOT_NAME=Manolo
TELEGRAM_BOT_USERNAME=your_bot_username
TELEGRAM_BOT_TOKEN=your_bot_token
GOOGLE_API_KEY=your_google_api_key
```

Use `OPENAI_API_KEY`, `OPENAI_API_BASE_URL` (LM Studio, vLLM, or another OpenAI-compatible endpoint), or `OLLAMA_MODEL` instead of Gemini if you prefer. `AI_MODE` selects `agent` (default), `deep_agent`, or `llm`. `PROJECT_GITHUB_URL` and `PROJECT_DOCS_URL` control the buttons shown by `/start` and `/help`.

See the [full configuration reference](https://manolo-bot.readthedocs.io/en/latest/usage_app.html#advanced-configuration) for RAG, MCP, the scheduler, multimodal input, storage, rate limiting, and every other variable.

## Commands

- `/start` — welcome message and project links.
- `/help` — command reference and project links.
- `/flushcontext` — clear the conversation context (admins in groups).
- `/flushmemory` — reset long-term memory (`deep_agent` mode; admins in groups).
- `/flushschedules` — remove scheduled actions (admins in groups).

## Library usage

`manolo-bot` can also be used as a library. Install it and build an agent:

```python
import asyncio

from manolo_bot.ai.config import BotConfig, LLMConfig
from manolo_bot.ai.llmagent import LLMAgent
from manolo_bot.ai.llmbot import LLMBuilder
from manolo_bot.ai.tools import get_tools
from manolo_bot.storage.messages.memory_storage import MemoryMessagesStorage


async def main():
    llm = LLMBuilder(
        LLMConfig(
            google_api_key="your_api_key",
            google_api_model="",
            openai_api_key="",
            openai_api_model="",
            openai_api_base_url="",
            ollama_model="",
        )
    ).get_llm()
    bot_config = BotConfig(
        bot_uuid="my-bot",
        bot_name="Assistant",
        bot_username="assistant_bot",
        bot_token="123456:ABC",
        user_id=0,
    )
    storage = MemoryMessagesStorage(bot_uuid="my-bot", chat_id=123)
    await storage.refresh_messages()

    agent = LLMAgent(
        llm=llm,
        bot_config=bot_config,
        system_instructions="You are a helpful assistant.",
        messages_storage=storage,
        tools=get_tools(),
    )
    async with agent:
        response = await agent.answer_message(chat_id=123, message="What is the current price of Bitcoin?")
        print(response.content)

    await storage.commit()


asyncio.run(main())
```

See the [library guide](https://manolo-bot.readthedocs.io/en/latest/usage_library.html) for `LLMDeepAgent`, RAG, the scheduler, custom tools, MCP, and dynamic instructions. The [API reference](https://manolo-bot.readthedocs.io/en/latest/api.html) covers the lower-level classes.

## Development

```shell
uv sync --dev
pre-commit install
uv run python -m unittest discover tests
```

See the [installation guide](https://manolo-bot.readthedocs.io/en/latest/installation.html) for the full development setup and documentation build.

## Contributing

If you'd like to contribute to this project, feel free to submit a pull request. We're always open to new ideas or
improvements to the code.

## Support the project

If Manolo Bot is useful to you, please give it a ⭐ on GitHub — it helps other people discover the project.

[⭐ Star on GitHub](https://github.com/cccaballero/manolo_bot) ·
[🐛 Report an issue](https://github.com/cccaballero/manolo_bot/issues) ·
[🤝 Contribute](https://github.com/cccaballero/manolo_bot/blob/master/README.md#contributing)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
