Agent with Tools

Maintain a classic AzureAIFoundry web-search agent while migrating to current Foundry inference.

Classic adapter: its SDK is retired. See the migration example.

Code

from agno.agent import Agent
from agno.models.azure import AzureAIFoundry
from agno.tools.websearch import WebSearchTools

agent = Agent(
    model=AzureAIFoundry(id="Cohere-command-a"),
    tools=[WebSearchTools()],
    markdown=True,
)

agent.print_response("What is currently happening in France?", stream=True)

Usage

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Create the model deployment

In your classic Foundry project, deploy Cohere Command A with the deployment name Cohere-command-a. If you choose another deployment name, pass that exact name to AzureAIFoundry(id=...).

Set your API key

export AZURE_API_KEY=xxx
export AZURE_ENDPOINT=xxx

Install dependencies

uv pip install -U azure-ai-inference aiohttp ddgs agno

Run Agent

Save the code above as tool_use.py, then run:

python tool_use.py