Skip to content

AgentTool

Namespace: E2E

public sealed class AgentTool

A project tool the agent offers to the model beside its own: upstream’s defineTool. It declares whether it changes the application and which platforms it is offered on; the agent owns dispatch and accounting. The tool’s name is its key in Tools.

Inheritance: object

View source

AgentTool(string, JsonObject, bool, Func<JsonObject, AgentToolContext, CancellationToken, Task<string>>, IReadOnlyList<string>?)

Section titled “AgentTool(string, JsonObject, bool, Func<JsonObject, AgentToolContext, CancellationToken, Task<string>>, IReadOnlyList<string>?)”
public AgentTool(string description, JsonObject inputSchema, bool mutates, Func<JsonObject, AgentToolContext, CancellationToken, Task<string>> executeAsync, IReadOnlyList<string>? platforms = null)

A tool that reaches the harness through AgentToolContext: upstream’s getToolContext. It can look at the screen (a read-only tool only) and keep what it saw as a screenshot of the step.

Parameters

Name Type Description
description string What the model is told the tool does.
inputSchema JsonObject The JSON schema of the tool’s input.
mutates bool Whether running the tool can change the application. A mutating tool takes an action slot and ends replay of the step.
executeAsync Func<JsonObject, AgentToolContext, CancellationToken, Task<string>> Runs the tool with its input as the model wrote it and the context of the step, and answers what the model reads.
platforms IReadOnlyList<string> The engine platforms the tool is offered on. Null means every platform.

View source

AgentTool(string, JsonObject, bool, Func<JsonObject, CancellationToken, Task<string>>, IReadOnlyList<string>?)

Section titled “AgentTool(string, JsonObject, bool, Func<JsonObject, CancellationToken, Task<string>>, IReadOnlyList<string>?)”
public AgentTool(string description, JsonObject inputSchema, bool mutates, Func<JsonObject, CancellationToken, Task<string>> executeAsync, IReadOnlyList<string>? platforms = null)

Parameters

Name Type Description
description string What the model is told the tool does.
inputSchema JsonObject The JSON schema of the tool’s input.
mutates bool Whether running the tool can change the application. A mutating tool takes an action slot and ends replay of the step.
executeAsync Func<JsonObject, CancellationToken, Task<string>> Runs the tool with its input as the model wrote it, and answers what the model reads.
platforms IReadOnlyList<string> The engine platforms the tool is offered on. Null means every platform.

View source

public string Description { get; }

Value: string

View source

public Func<JsonObject, CancellationToken, Task<string>> ExecuteAsync { get; }

Runs the tool with no step around it. A tool that reads its AgentToolContext fails there.

Value: Func<JsonObject, CancellationToken, Task<string>>

View source

public JsonObject InputSchema { get; }

Value: JsonObject

View source

public bool Mutates { get; }

Value: bool

View source

public IReadOnlyList<string>? Platforms { get; }

The platforms the tool is offered on. Null means every platform.

Value: IReadOnlyList<string>

View source

public bool AppliesTo(string platform)

True when the tool is offered on <code class=“paramref”>platform</code>.

Parameters

Name Type Description
platform string

Returns: bool

View source