Class SimulatedTool
A tool that answers for another without running it: the call is recorded and a simulated result says it was not executed. Used to preview or evaluate an agent with zero real side effects: tools that only read run for real, so the agent still sees real data, while a tool that writes, sends or cannot be undone is simulated.
public sealed class SimulatedTool : ITool, IToolMetadata
- Inheritance
-
SimulatedTool
- Implements
- Inherited Members
Examples
var tools = myTools.Select(SimulatedTool.Guard).ToList();
// Read-only tools are returned as they are; the others are simulated.
Remarks
A tool that does not declare its side effect (no IToolMetadata) is treated as writing: simulation errs toward doing nothing.
Constructors
- SimulatedTool(ITool)
Creates a simulation of
innerfor testing.
- SimulatedTool(ITool, SimulationPurpose)
Creates a simulation of
innerforpurpose.
Properties
- Calls
Gets the arguments of every call answered so far, in order.
- Category
Gets the category this tool belongs to.
- DefaultApproval
Gets the default approval mode for this tool.
- Description
Gets a concise description of what the tool does.
- Inner
Gets the tool this simulation answers for.
- InputSchema
Gets the JSON Schema defining the expected input arguments.
- IsIdempotent
Gets whether the tool is idempotent (safe to retry without changing outcome).
- IsReadOnly
Gets whether the tool performs only read operations with no state mutation.
- Name
Gets the stable, unique identifier for this tool.
- Purpose
Gets why this tool is simulated.
- RiskLevel
Gets the inherent risk level of this tool.
- SideEffect
Gets the type of side effect this tool may produce.
Methods
- Guard(ITool)
The tool to use when side effects must not happen:
toolitself when it declares that it only reads (None, LocalRead, NetworkRead), otherwise a SimulatedTool answering for it.
- Guard(ITool, SimulationPurpose)
The tool to use when side effects must not happen, simulated for
purpose:toolitself when it only reads, or when it is already a simulation (which keeps its own purpose), otherwise a SimulatedTool answering for it.
- InvokeAsync(string, CancellationToken)
Records the call and answers that it was simulated, echoing the arguments. For Testing the agent continues as if the action had been accepted; for DryRun it is told the action is a proposal. Either way nothing happened.
- OnlyReads(ITool)
Whether
tooldeclares that it changes nothing.