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

# Mistral Structured Output With Tool Use

> Combine web search with a Person output schema on Mistral Medium in a researcher agent.

```python structured_output_with_tool_use.py theme={null}
"""
Mistral Structured Output With Tool Use
=======================================

Cookbook example for `mistral/structured_output_with_tool_use.py`.
"""

from agno.agent import Agent
from agno.models.mistral import MistralChat
from agno.tools.websearch import WebSearchTools
from pydantic import BaseModel

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


class Person(BaseModel):
    name: str
    description: str


model = MistralChat(
    id="mistral-medium-latest",
    temperature=0.0,
)

researcher = Agent(
    name="Researcher",
    model=model,
    role="You find people with a specific role at a provided company.",
    instructions=[
        "- Search the web for the person described"
        "- Find out if they have public contact details"
        "- Return the information in a structured format"
    ],
    tools=[WebSearchTools()],
    output_schema=Person,
    add_datetime_to_context=True,
)

researcher.print_response("Find information about Elon Musk")

# ---------------------------------------------------------------------------
# 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 ddgs mistralai
```

**2. Export your Mistral API key**

```bash Mac/Linux theme={null}
export MISTRAL_API_KEY="your_mistral_api_key_here"
```

```bash Windows theme={null}
$Env:MISTRAL_API_KEY="your_mistral_api_key_here"
```

**3. Run the example**

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

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

Full source: [cookbook/90\_models/mistral/structured\_output\_with\_tool\_use.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/mistral/structured_output_with_tool_use.py)


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