Skip to content
Development
Agent

agent-tools

Learn how to use tools with Agent Framework

From plugin
dotnet-skills
46650 skills50 agents
Install
$ npx -y skills add managedcode/dotnet-skills --agent claude-code

How it fires

How this agent gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.

Context preview

The summary Claude sees to decide when to auto-load this agent.

Learn how to use tools with Agent Framework

Agent definition

agent-tools.md
title: Agent Tools
description: Learn how to use tools with Agent Framework
zone_pivot_groups: programming-languages
author: markwallace
ms.topic: reference
ms.author: markwallace
ms.date: 03/17/2026
ms.service: agent-framework

Agent Tools

> [!NOTE] > The live Learn tools surface now routes through `https://learn.microsoft.com/agent-framework/agents/tools/overview`. > Current live docs also add a provider-support matrix and fold agent-as-tool composition into that broader tools overview.

Tooling support can vary considerably between different agent types. Some agents might allow developers to customize the agent at construction time by providing external function tools or by choosing to activate specific built-in tools that are supported by the agent. On the other hand, some custom agents might support no customization via providing external or activating built-in tools, if they already provide defined features that shouldn't be changed.

::: zone pivot="programming-language-csharp"

Therefore, the base abstraction does not provide any direct tooling support, however each agent can choose whether it accepts tooling customization at construction time.

Tooling support with ChatClientAgent

The `ChatClientAgent` is an agent class that can be used to build agentic capabilities on top of any inference service. It comes with support for:

1. Using your own function tools with the agent 1. Using built-in tools that the underlying service might support.

> [!TIP] > For more information on `ChatClientAgent` and information on supported services, see [Simple agents based on inference services](./agent-types/index.md#simple-agents-based-on-inference-services)

Provide `AIFunction` instances during agent construction

There are various ways to construct a `ChatClientAgent`, for example, directly or via factory helper methods on various service clients, but all support passing tools.

// Sample function tool.
[Description("Get the weather for a given location.")]
static string GetWeather([Description("The location to get the weather for.")] string location)
    => $"The weather in {location} is cloudy with a high of 15°C.";

// When calling the ChatClientAgent constructor.
new ChatClientAgent(
    chatClient,
    instructions: "You are a helpful assistant",
    tools: [AIFunctionFactory.Create(GetWeather)]);

// When using one of the helper factory methods.
openAIResponseClient.AsAIAgent(
    instructions: "You are a helpful assistant",
    tools: [AIFunctionFactory.Create(GetWeather)]);

Provide `AIFunction` instances when running the agent

While the base `AIAgent` abstraction accepts `AgentRunOptions` on its run methods, subclasses of `AIAgent` can accept subclasses of `AgentRunOptions`. This allows specific agent implementations to accept agent specific per-run options.

The underlying <xref:Microsoft.Extensions.AI.IChatClient> of the `ChatClientAgent` can be customized via the <xref:Microsoft.Extensions.AI.ChatOptions> class for any invocation. The `ChatClientAgent` can accept a `ChatClientAgentRunOptions` which allows the caller to provide `ChatOptions` for the underlying `IChatClient.GetResponse` method. Where any option clashes with options provided to the agent at construction time, the per run options will take precedence.

Using this mechanism you can provide per-run tools.

// Create the chat options class with the per-run tools.
var chatOptions = new ChatOptions()
{
    Tools = [AIFunctionFactory.Create(GetWeather)]
};
// Run the agent, with the per-run chat options.
await agent.RunAsync(
    "What is the weather like in Amsterdam?",
    options: new ChatClientAgentRunOptions(chatOptions));

> [!NOTE] > Not all agents support tool calling, so providing tools per run requires providing an agent specific options class.

Using built-in tools

Where the underlying service supports built-in tools, they can be provided using the same mechanisms as described above.

The IChatClient implementation for the underlying service should expose an `AITool` derived class that can be used to configure the built-in tool.

For example, when creating an Azure AI Foundry Agent, you can provide a `CodeInterpreterToolDefinition` to enable the code interpreter tool that is built into the Azure AI Foundry service.

var agent = await azureAgentClient.CreateAIAgentAsync(
    deploymentName,
    instructions: "You are a helpful assistant",
    tools: [new CodeInterpreterToolDefinition()]);

::: zone-end ::: zone pivot="programming-language-python"

Tooling support with ChatAgent

The `ChatAgent` is an agent class that can be used to build agentic capabilities on top of any inference service. It comes with support for:

1. Using your own function tools with the agent 2. Using built-in tools that the underlying service might support 3. Using hosted tools like web search and MCP (Model Context Protocol) servers

Provide function tools during agent construction

There are various ways to construct a `ChatAgent`, either directly or via factory helper methods on various service clients. All approaches support passing tools at construction time.

from typing import Annotated
from pydantic import Field
from agent_framework import ChatAgent
from agent_framework.openai import OpenAIChatClient

# Sample function tool
def get_weather(
    location: Annotated[str, Field(description="The location to get the weather for.")],
) -> str:
    """Get the weather for a given location."""
    return f"The weather in {location} is cloudy with a high of 15°C."

# When creating a ChatAgent directly
agent = ChatAgent(
    chat_client=OpenAIChatClient(),
    instructions="You are a helpful assistant",
    tools=[get_weather]  # Tools provided at construction
)

# When using factory helper methods
agent = OpenAIChatClient().as_agent(
    instructions="You are a helpful assistant",
    tools=[get_weather]
)

The agent will automatically use these tools

Read more
Ships withdotnet-skills

Stop explaining .NET to your AI. Start building. We've all been there: asking Claude to use Entity Framework, only to get EF6 patterns in a .NET 8 project. Explaining to Copilot that Blazor Server and Blazor WebAssembly aren't the same thing.

Get the whole plugin