AgentToolBase
Base Classes · AiDotNet.Agentic.Tools
Base class for tools that implements the common metadata plumbing, leaving only the behavior
(InvokeCoreAsync) for subclasses.
Implements: IAgentTool
Known derived types: DelegateAgentTool, FunctionAgentTool, ModelPredictionTool
For Beginners
Inherit from this to make a custom tool. You provide the name, the description, the input schema, and one method that does the work. The base class handles the rest, including turning an accidental crash into a clean “this tool failed” message the model can read.
How It Works
Follows the template-method pattern used across AiDotNet: this base validates and stores the name,
description, and parameter schema, and builds the AiToolDefinition; subclasses supply
only the execution logic. InvokeAsync wraps InvokeCoreAsync so unexpected
exceptions become a failed ToolInvocationResult instead of crashing the agent loop.
Properties
| Property | Summary |
|---|---|
JObject ParametersSchema { get; } |
|
string Description { get; } |
|
string Name { get; } |
Methods
| Method | Summary |
|---|---|
AiToolDefinition ToDefinition() |
|
Task<ToolInvocationResult> InvokeAsync(JObject arguments, CancellationToken cancellationToken) |