AgentDefinition.StopWhen:
HasToolCall(...) and FinishReasonIs(...) provide event-based limits. Keep a step or duration bound even when using token or cost limits, because those depend on reported usage.
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Bound .NET agent work by steps, tokens, cost, duration, tools, or finish reason.
AgentDefinition.StopWhen:
StopWhen = new[]
{
AgentSdk.StepCountIs(12),
AgentSdk.MaxTokensUsed(40_000),
AgentSdk.MaxCost(2),
AgentSdk.MaxDuration(TimeSpan.FromMinutes(1)),
};
HasToolCall(...) and FinishReasonIs(...) provide event-based limits. Keep a step or duration bound even when using token or cost limits, because those depend on reported usage.
Was this page helpful?