> ## 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.

# Data Analyst Agent

> Query IMDB movie data with a LangDB agent using DuckDbTools.

## Code

```python data_analyst.py theme={null}
from textwrap import dedent

from agno.agent import Agent
from agno.models.langdb import LangDB
from agno.tools.duckdb import DuckDbTools

duckdb_tools = DuckDbTools()
duckdb_tools.create_table_from_path(
    path="https://agno-public.s3.amazonaws.com/demo_data/IMDB-Movie-Data.csv",
    table="movies",
)

agent = Agent(
    model=LangDB(id="llama3-1-70b-instruct-v1.0"),
    tools=[duckdb_tools],
    markdown=True,
    additional_context=dedent("""\
    You have access to the following tables:
    - movies: contains information about movies from IMDB.
    """),
)
agent.print_response("What is the average rating of movies?", stream=False)
```

## Usage

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

  <Step title="Export environment variables">
    ```bash theme={null}
    export LANGDB_API_KEY="your_langdb_api_key"
    export LANGDB_PROJECT_ID="your_langdb_project_id"
    export LANGDB_API_BASE_URL="https://api.langdb.ai"
    ```
  </Step>

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U openai agno duckdb
    ```
  </Step>

  <Step title="Run Agent">
    Save the code above as `data_analyst.py`, then run:

    ```bash theme={null}
    python data_analyst.py
    ```
  </Step>
</Steps>
