Property MaxCallsPerTurn
MaxCallsPerTurn
Gets or sets the maximum number of tool invocations allowed per turn.
public int MaxCallsPerTurn { get; set; }
Property Value
- int
The upper bound on tool calls. Default is 3.
Examples
Example: Configuring tool call limits for different scenarios
using LMKit.Agents.Tools;
// Simple lookup: one tool call should suffice
var simpleLookup = new ToolCallPolicy
{
MaxCallsPerTurn = 1
};
// Research task: may need multiple searches and lookups
var researchTask = new ToolCallPolicy
{
MaxCallsPerTurn = 5
};
// Complex reasoning: allow extensive tool chaining
var complexReasoning = new ToolCallPolicy
{
MaxCallsPerTurn = 8
};
Remarks
This limit prevents infinite tool-call loops where the model continuously calls tools without ever producing a final response. When the limit is reached, the runtime should force the model to generate a response using the information gathered so far.
Choosing a Limit
- Low values (1-2)Suitable for simple, single-tool tasks with predictable behavior.
- Medium values (3-5)Good for most general-purpose agents that may need to chain a few tools.
- High values (6-10)For complex reasoning tasks requiring multiple tool interactions.
Values less than 1 effectively prevent any tool chaining beyond the first attempt. Consider your model's reliability and latency budgets when setting this value.