> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Telegram Reasoning Agent

> ReasoningTools + DuckDuckGo search on Telegram

## Code

```python reasoning_agent.py theme={null}
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIChat
from agno.os.app import AgentOS
from agno.os.interfaces.telegram import Telegram
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.reasoning import ReasoningTools

agent_db = SqliteDb(db_file="tmp/persistent_memory.db")

reasoning_agent = Agent(
    name="Reasoning Research Agent",
    model=OpenAIChat(id="gpt-5.2"),
    db=agent_db,
    tools=[
        ReasoningTools(add_instructions=True),
        DuckDuckGoTools(),
    ],
    instructions="Use tables to display data. When you use thinking tools, keep the thinking brief.",
    add_datetime_to_context=True,
    markdown=True,
)


agent_os = AgentOS(
    agents=[reasoning_agent],
    interfaces=[Telegram(agent=reasoning_agent)],
)
app = agent_os.get_app()

if __name__ == "__main__":
    agent_os.serve(app="reasoning_agent:app", reload=True)
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Set Environment Variables">
    ```bash theme={null}
    export TELEGRAM_TOKEN=your-bot-token-from-botfather
    export OPENAI_API_KEY=your-openai-api-key
    export APP_ENV=development
    ```
  </Step>

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U "agno[telegram]" duckduckgo-search
    ```
  </Step>

  <Step title="Run Example">
    ```bash theme={null}
    python reasoning_agent.py
    ```
  </Step>
</Steps>

## Key Features

* **Chain-of-Thought Reasoning**: ReasoningTools enables structured thinking for complex queries
* **Web Search**: DuckDuckGo integration for up-to-date information retrieval
* **Data Presentation**: Uses tables to display structured data
* **Persistent Memory**: SQLite database for session storage
