# Azure Demo Mistral (/examples/models/azure/ai-foundry/demo-mistral)



<Note>
  This source uses Agno's classic `AzureAIFoundry` adapter and the `azure-ai-inference` package, which Microsoft [retired on August 26, 2026](https://learn.microsoft.com/en-us/azure/foundry/how-to/navigate-from-classic#sdk-mapping). Existing endpoint availability is separate from SDK retirement. For a new integration, use the [current Foundry API setup](/models/providers/cloud/azure-ai-foundry/overview#current-foundry-api) with a compatible deployment. The classic setup below applies only to an existing compatible endpoint unless a current adaptation is explicitly provided.
</Note>

<Warning>
  Microsoft retired `Mistral-Large-2411` on January 30, 2026. Keep the source for reference and apply the current adapter/deployment changes in the run steps. Choose a model available in your resource; changing a string does not create a deployment. See the [Azure retirement schedule](https://learn.microsoft.com/en-us/azure/foundry/openai/concepts/retired-models).
</Warning>

```python title="demo_mistral.py"
"""
Azure Demo Mistral
==================

Cookbook example for `azure/ai_foundry/demo_mistral.py`.
"""

from agno.agent import Agent, RunOutput  # noqa
from agno.models.azure import AzureAIFoundry

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

agent = Agent(model=AzureAIFoundry(id="Mistral-Large-2411"), markdown=True)

# Get the response in a variable
# run: RunOutput = agent.run("Share a 2 sentence horror story")
# print(run.content)

# Print the response on the terminal
agent.print_response("Share a 2 sentence horror story")

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

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

## Run the Current Adaptation [#run-the-current-adaptation]

<Steps>
    <Step title="Set up your virtual environment">
      <CodeBlockTabs defaultValue="Mac">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="Mac">
            Mac
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Windows">
            Windows
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="Mac">
          ```bash
          uv venv --python 3.12
          source .venv/bin/activate
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Windows">
          ```bash
          uv venv --python 3.12
          .venv\Scripts\activate
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </Step>

  <Step title="Install dependencies">
    ```bash
    uv pip install -U agno openai
    ```
  </Step>

    <Step title="Use a current Foundry deployment">
      Deploy an available model supporting Chat Completions and the capabilities used by this example. Copy its exact deployment name, the resource's OpenAI-compatible URL ending in `/openai/v1`, and its key. See the [current Foundry API setup](/models/providers/cloud/azure-ai-foundry/overview#current-foundry-api).

      <CodeBlockTabs defaultValue="Mac/Linux">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="Mac/Linux">
            Mac/Linux
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Windows">
            Windows
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="Mac/Linux">
          ```bash
          export FOUNDRY_DEPLOYMENT="your_deployment_name"
          export FOUNDRY_BASE_URL="https://your-resource.services.ai.azure.com/openai/v1"
          export FOUNDRY_API_KEY="your_resource_key"
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Windows">
          ```powershell
          $Env:FOUNDRY_DEPLOYMENT="your_deployment_name"
          $Env:FOUNDRY_BASE_URL="https://your-resource.services.ai.azure.com/openai/v1"
          $Env:FOUNDRY_API_KEY="your_resource_key"
          ```
        </CodeBlockTab>
      </CodeBlockTabs>

      In the saved source, replace the `AzureAIFoundry` import with:

      ```python
      from os import environ
      from agno.models.openai.like import OpenAILike
      ```

      Replace the entire `AzureAIFoundry(...)` expression with:

      ```python
      OpenAILike(
          id=environ["FOUNDRY_DEPLOYMENT"],
          api_key=environ["FOUNDRY_API_KEY"],
          base_url=environ["FOUNDRY_BASE_URL"],
      )
      ```

      Keep the surrounding `Agent` arguments and run calls. The deployment name can differ from the catalog's model name; it must match the deployment at this endpoint.
    </Step>

  <Step title="Run the example">
    Apply the current model import and constructor replacements above. Save the adapted code as `demo_mistral.py`, then run:

    ```bash
    python demo_mistral.py
    ```
  </Step>
</Steps>

Full source: [cookbook/90\_models/azure/ai\_foundry/demo\_mistral.py](https://github.com/agno-agi/agno/blob/8f36eaf2d18e91afa7b327eec66a3cd3685dcb87/cookbook/90_models/azure/ai_foundry/demo_mistral.py)
