Nota
O acesso a esta página requer autorização. Podes tentar iniciar sessão ou mudar de diretório.
O acesso a esta página requer autorização. Podes tentar mudar de diretório.
O Agent Framework suporta muitos tipos diferentes de ferramentas que estendem as capacidades dos agentes. As ferramentas permitem aos agentes interagir com sistemas externos, executar código, pesquisar dados e muito mais.
Tipos de Ferramentas
| Tipo de Ferramenta | Description |
|---|---|
| Ferramentas Funcionais | Código personalizado que os agentes podem chamar durante conversas |
| Aprovação de Ferramentas | Aprovação humana-in-the-loop para invocações de ferramentas |
| Intérprete de código | Executar código num ambiente sandbox |
| Pesquisa de Ficheiros | Pesquise entre ficheiros carregados |
| Pesquisa na Web | Pesquise na internet para obter informações |
| Ferramentas MCP Alojadas | Ferramentas MCP alojadas pelo Azure AI Foundry |
| Ferramentas MCP Locais | Ferramentas MCP a correr localmente ou em servidores personalizados |
Matriz de Suporte ao Prestador
Os fornecedores OpenAI e Azure OpenAI oferecem cada um múltiplos tipos de clientes com diferentes capacidades de ferramenta. Os clientes Azure OpenAI espelham os seus equivalentes OpenAI.
| Tipo de Ferramenta | Conclusão do Chat | Respostas | Assistentes | Azure AI Foundry | Anthropic | Ollama | Copiloto do GitHub | Estúdio Copiloto |
|---|---|---|---|---|---|---|---|---|
| Ferramentas Funcionais | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Aprovação de Ferramentas | ❌ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Intérprete de código | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Pesquisa de Ficheiros | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Pesquisa na Web | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Ferramentas MCP Alojadas | ❌ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Ferramentas MCP Locais | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
Observação
As colunas Chat Completion, Respostas e Assistentes aplicam-se tanto ao OpenAI como ao Azure OpenAI — as variantes do Azure espelham o mesmo suporte de ferramentas que os seus equivalentes OpenAI.
Matriz de Suporte ao Prestador
Os fornecedores OpenAI e Azure OpenAI oferecem cada um múltiplos tipos de clientes com diferentes capacidades de ferramenta. Os clientes Azure OpenAI espelham os seus equivalentes OpenAI.
| Tipo de Ferramenta | Conclusão do Chat | Respostas | Assistentes | Azure AI Foundry | Anthropic | Claude Agent | Ollama | Copiloto do GitHub |
|---|---|---|---|---|---|---|---|---|
| Ferramentas Funcionais | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Aprovação de Ferramentas | ❌ | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Intérprete de código | ❌ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Pesquisa de Ficheiros | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Pesquisa na Web | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Geração de Imagem | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Ferramentas MCP Alojadas | ❌ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Ferramentas MCP Locais | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Observação
As colunas Chat Completion, Respostas e Assistentes aplicam-se tanto ao OpenAI como ao Azure OpenAI — as variantes do Azure espelham o mesmo suporte de ferramentas que os seus equivalentes OpenAI. As ferramentas MCP locais funcionam com qualquer fornecedor que suporte ferramentas funcionais.
Utilização de um Agente como Ferramenta Funcional
Pode usar um agente como ferramenta funcional para outro agente, permitindo a composição de agentes e fluxos de trabalho mais avançados. O agente interno é convertido numa ferramenta funcional e fornecido ao agente externo, que pode então chamá-lo conforme necessário.
Chama .AsAIFunction() um AIAgent para o converter numa ferramenta de função que possa ser fornecida a outro agente:
// Create the inner agent with its own tools
AIAgent weatherAgent = new AzureOpenAIClient(
new Uri("https://<myresource>.openai.azure.com"),
new AzureCliCredential())
.GetChatClient("gpt-4o-mini")
.AsAIAgent(
instructions: "You answer questions about the weather.",
name: "WeatherAgent",
description: "An agent that answers questions about the weather.",
tools: [AIFunctionFactory.Create(GetWeather)]);
// Create the main agent and provide the inner agent as a function tool
AIAgent agent = new AzureOpenAIClient(
new Uri("https://<myresource>.openai.azure.com"),
new AzureCliCredential())
.GetChatClient("gpt-4o-mini")
.AsAIAgent(instructions: "You are a helpful assistant.", tools: [weatherAgent.AsAIFunction()]);
// The main agent can now call the weather agent as a tool
Console.WriteLine(await agent.RunAsync("What is the weather like in Amsterdam?"));
Chamar .as_tool() um agente para o converter numa ferramenta funcional que possa ser fornecida a outro agente:
from agent_framework.azure import AzureOpenAIChatClient
from azure.identity import AzureCliCredential
# Create the inner agent with its own tools
weather_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).as_agent(
name="WeatherAgent",
description="An agent that answers questions about the weather.",
instructions="You answer questions about the weather.",
tools=get_weather
)
# Create the main agent and provide the inner agent as a function tool
main_agent = AzureOpenAIChatClient(credential=AzureCliCredential()).as_agent(
instructions="You are a helpful assistant.",
tools=weather_agent.as_tool()
)
# The main agent can now call the weather agent as a tool
result = await main_agent.run("What is the weather like in Amsterdam?")
print(result.text)
Também pode personalizar o nome da ferramenta, descrição e nome do argumento:
weather_tool = weather_agent.as_tool(
name="WeatherLookup",
description="Look up weather information for any location",
arg_name="query",
arg_description="The weather query or location"
)