Class BeforeAgentExecutionEventArgs
- Namespace
- LMKit.Agents.Orchestration
- Assembly
- LM-Kit.NET.dll
Event arguments for before agent execution in orchestration.
Allows handlers to modify the input or skip the agent entirely.
public sealed class BeforeAgentExecutionEventArgs : EventArgs
- Inheritance
-
BeforeAgentExecutionEventArgs
- Inherited Members
Examples
Modifying the input or skipping an agent before it runs:
using LMKit.Agents.Orchestration;
orchestrator.BeforeAgentExecution += (sender, e) =>
{
// Truncate inputs that exceed a custom budget:
if (e.OriginalInput.Length > 4000)
{
e.ModifiedInput = e.OriginalInput.Substring(0, 4000);
}
// Skip the agent under a feature flag:
if (e.Agent.Identity?.Persona == "Critic" && !enableCritique)
{
e.SkipAgent("critique disabled by feature flag");
}
};
Constructors
- BeforeAgentExecutionEventArgs(Agent, string, OrchestrationContext)
Initializes a new instance of the BeforeAgentExecutionEventArgs class.
Properties
- Agent
Gets the agent that is about to execute.
- Context
Gets the orchestration context.
- ModifiedInput
Gets or sets modified input to use instead of the original.
Set this to change the input before the agent executes. Leave
nullto use the original input.
- OriginalInput
Gets the original input for the agent.
- Skip
Gets or sets a value indicating whether to skip this agent.
- SkipReason
Gets or sets the reason for skipping.
Methods
- SkipAgent(string)
Skips the agent execution with an optional reason.