Edit

AgentToolContext class

Namespace: Microsoft.Azure.Workflows.Sdk

Documents the IAgentToolContext<T> interface and the AgentToolContext<T> class, which provide typed access to agent tool parameters during expression conversion in AI agent workflows.

Usage

// AgentToolContext is used internally by the SDK when defining agent tools
// It provides typed access to tool parameters within expression lambdas

var agent = WorkflowActions.BuiltIn.Agent(
    agentModelType: AgentModelType.OpenAI,
    deploymentId: "gpt-4",
    agentModelSettings: new AgentModelSettings(),
    connectionName: "openai-connection",
    messages: () => new[] { new AgentPromptMessage { Role = "system", Content = "You are helpful" } });

Interface: IAgentToolContext<T>

Represents a contract for exposing typed tool parameters in agent scenarios.

Properties

Name Description Type Required
Parameters Gets the parameters for the agent tool. T No

Class: AgentToolContext<T>

Provides the default implementation of IAgentToolContext<T>.

Constructors

AgentToolContext

Initializes a new AgentToolContext<T> instance with the supplied agent tool parameters.

AgentToolContext(T parameters)
Name Description Type Required
parameters The parameters to configure the agent tool. T Yes
var parameters = new { city = "Seattle" };
var context = new AgentToolContext<object>(parameters);

Properties

Name Description Type Required
Parameters Gets the parameters supplied to the constructor. T No