AgentSkillsCN

azure-foundry-agent

调用 Azure AI Foundry 代理,完成各类任务。当用户提出“调用 Foundry 代理”“使用 Azure 代理”“呼叫 Foundry 代理”,或明确指定要使用的特定代理名称时,即可启用此功能。支持多种可配置的代理,将用户的查询路由至指定的 Azure Foundry 代理,并返回由 AI 生成的响应。

SKILL.md
--- frontmatter
name: azure-foundry-agent
description: 'Invoke Azure AI Foundry agents for various tasks. Use when asked to "invoke foundry agent", "use azure agent", "call foundry agent", or when user specifies a specific agent name to use. Supports multiple configurable agents. Routes queries to the specified Azure Foundry agent and returns AI-generated responses.'

Azure Foundry Agent Invoker

A skill for invoking Azure AI Foundry agents to answer questions and perform tasks. Supports multiple agents that can be configured in a YAML file.

When to Use This Skill

  • User asks to "invoke a foundry agent" or "use azure agent"
  • User specifies a specific agent name to invoke
  • User wants to interact with any configured Azure Foundry agent
  • User asks what agents are available

Prerequisites

  • Azure CLI installed and authenticated (az login)
  • Python 3.11+ installed
  • Required packages installed:
    bash
    pip install --pre azure-ai-projects>=2.0.0b1 azure-identity pyyaml
    
  • Access to Azure AI Foundry endpoint
  • Proper Azure credentials configured (DefaultAzureCredential)

Configuration

Agents are configured in the references/agents-config.yaml file:

yaml
endpoint: "https://your-resource.services.ai.azure.com/api/projects/your-project"

agents:
  - name: "agent-name"
    description: "What the agent does"
    triggers:
      - "keyword1"
      - "keyword2"

Adding a New Agent

  1. Open references/agents-config.yaml
  2. Add a new agent entry under the agents: section:
    yaml
    - name: "your-new-agent"
      description: "Description of what your agent does"
      triggers:
        - "trigger keyword 1"
        - "trigger keyword 2"
    
  3. Save the file

Step-by-Step Workflow

Step 1: Identify the Agent

When the user requests to invoke a Foundry agent:

  1. Check if they specified an agent name
  2. If not, ask which agent they want to use or list available agents

Step 2: List Available Agents (Optional)

To see all configured agents:

bash
python .github/skills/azure-foundry-agent/scripts/invoke_agent.py --list

Step 3: Execute the Agent

Run the Python script with the agent name and query:

bash
python .github/skills/azure-foundry-agent/scripts/invoke_agent.py "<agent_name>" "<user_query>"

Step 4: Handle Unknown Agents

If the user specifies an agent that's not in the configuration:

  • The script will show an error message
  • Display the list of available agents
  • Instruct the user to either select from available agents OR add their agent to the config file

Example Usage

List available agents:

bash
python .github/skills/azure-foundry-agent/scripts/invoke_agent.py --list

Invoke the work assistant:

bash
python .github/skills/azure-foundry-agent/scripts/invoke_agent.py "work-assitant" "What can you help me with?"

Invoke with partial name match:

bash
python .github/skills/azure-foundry-agent/scripts/invoke_agent.py "work" "Tell me about the project"

Available Agents

Currently configured agents (see references/agents-config.yaml for full list):

Agent NameDescription
work-assitantWork Assistant for project documents and work items

Troubleshooting

IssueSolution
Agent not found in configAdd the agent to references/agents-config.yaml
Authentication failedRun az login to authenticate with Azure
Agent not found in AzureVerify the agent name matches exactly in Azure Foundry
Connection timeoutCheck network connectivity and endpoint URL
Missing packagesRun pip install --pre azure-ai-projects>=2.0.0b1 azure-identity pyyaml

Error Messages

"Agent 'X' not found in configuration"

  • The specified agent is not in the config file
  • Either select from available agents or add your agent to references/agents-config.yaml

"Authentication Error"

  • Run az login to authenticate with Azure

"Agent Not Found" (from Azure)

  • The agent exists in config but not in Azure Foundry
  • Verify the agent name in Azure AI Foundry portal

References