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

# Sage: Answer Engine

This example shows how to build Sage, a Perplexity-like Answer Engine that intelligently determines whether to perform a web search or conduct a deep analysis using ExaTools based on the user's query.

Sage:

1. Uses real-time web search (DuckDuckGo) and deep contextual analysis (ExaTools) to provide comprehensive answers
2. Intelligently selects tools based on query complexity
3. Provides an interactive Streamlit UI with session management and chat history export
4. Supports multiple LLM providers (OpenAI, Anthropic, Google, Groq)

## Key capabilities

* Natural language query understanding and processing
* Real-time web search integration with DuckDuckGo
* Deep contextual analysis using ExaTools
* Multiple LLM provider support
* Session management using SQLite
* Chat history export
* Interactive Streamlit UI

<video autoPlay muted controls className="w-full aspect-video" src="https://mintlify.s3.us-west-1.amazonaws.com/agno/videos/answer-engine.mp4" />

## Simple queries to try

* "Tell me about the tariffs the US is imposing in 2025"
* "Which is a better reasoning model: o3-mini or DeepSeek R1?"
* "Tell me about Agno"
* "What are the latest trends in renewable energy?"

## Advanced analysis queries

* "Evaluate how emerging AI regulations could influence innovation"
* "Compare the environmental impact of electric vs hydrogen vehicles"
* "Analyze the global semiconductor supply chain challenges"
* "Explain the implications of quantum computing on cryptography"

## Code

The complete code is available in the [Agno repository](https://github.com/agno-agi/agno).

## Usage

<Steps>
  <Step title="Clone the repository">
    ```bash theme={null}
    git clone https://github.com/agno-agi/agno.git
    cd agno
    ```
  </Step>

  <Step title="Create virtual environment">
    ```bash theme={null}
    python3 -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    ```
  </Step>

  <Step title="Install dependencies">
    ```bash theme={null}
    pip install -r cookbook/examples/streamlit_apps/answer_engine/requirements.txt
    ```
  </Step>

  <Step title="Set up API keys">
    ```bash theme={null}
    # Required
    export OPENAI_API_KEY=***
    export EXA_API_KEY=***

    # Optional (for additional models)
    export ANTHROPIC_API_KEY=***
    export GOOGLE_API_KEY=***
    export GROQ_API_KEY=***
    ```

    We recommend using gpt-4o for optimal performance.
  </Step>

  <Step title="Launch the app">
    ```bash theme={null}
    streamlit run cookbook/examples/streamlit_apps/answer_engine/app.py
    ```

    Open [localhost:8501](http://localhost:8501) to start using Sage.
  </Step>
</Steps>

## Model Selection

The application supports multiple model providers:

* OpenAI (o3-mini, gpt-4o)
* Anthropic (claude-3-5-sonnet)
* Google (gemini-2.0-flash-exp)
* Groq (llama-3.3-70b-versatile)

## Agent Configuration

The agent configuration is in `agents.py` and the prompts are in `prompts.py`:

* To modify prompts, update the `prompts.py` file
* To add new tools or models, update the `agents.py` file

## Support

Need help? Join our [Discourse community](https://community.agno.com) for support!
