Class ProcessRunTool
Executes a program with arguments and captures its output.
Use AllowedCommands to restrict which programs can be launched.
public sealed class ProcessRunTool : IBuiltInTool, ITool, IToolMetadata
- Inheritance
-
ProcessRunTool
- Implements
- Inherited Members
Examples
Letting an agent run a whitelisted program (e.g., git) and report the result:
using LMKit.Agents;
using LMKit.Agents.Tools.BuiltIn.IO;
var options = new ProcessToolOptions
{
AllowedCommands = new HashSet<string> { "git" }
};
var agent = Agent.CreateBuilder(model)
.WithTools(t => t.Register(new ProcessRunTool(options)))
.Build();
var result = await agent.RunAsync(@"Run 'git status' in C:\src\app.");
Constructors
- ProcessRunTool()
Initializes a new instance with default settings.
- ProcessRunTool(ProcessToolOptions)
Initializes a new instance with custom options.
Properties
- Description
Gets a concise description of what the tool does.
- InputSchema
Gets the JSON Schema defining the expected input arguments.
- Name
Gets the stable, unique identifier for this tool.
Methods
- InvokeAsync(string, CancellationToken)
Executes the tool with the specified JSON arguments.