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

# Data Analyst

> Load an IMDB movie CSV into DuckDB and query it with a LangDB agent.

```python data_analyst.py theme={null}
"""Run `uv pip install duckdb` to install dependencies."""

from textwrap import dedent

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

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

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)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass
```

## Run the Example

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno duckdb openai
```

**2. Export environment variables**

```bash Mac/Linux theme={null}
export LANGDB_API_KEY="your_langdb_api_key_here"
export LANGDB_PROJECT_ID="your_langdb_project_id_here"
```

```bash Windows theme={null}
$Env:LANGDB_API_KEY="your_langdb_api_key_here"
$Env:LANGDB_PROJECT_ID="your_langdb_project_id_here"
```

**3. Run the example**

Save the code above as `data_analyst.py`, then run:

```bash theme={null}
python data_analyst.py
```

Full source: [cookbook/90\_models/langdb/data\_analyst.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/langdb/data_analyst.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.