ToolResultMode
NexusLabs.Needlr.AgentFramework¶
NexusLabs.Needlr.AgentFramework.Iterative¶
ToolResultMode Enum¶
Controls how tool call results are fed back to the model within a single iteration of an IIterativeAgentLoop.
Fields¶
MultiRound 0
Tool results are sent back to the model, which may request additional tool calls. This continues until the model produces a text response or MaxToolRoundsPerIteration is reached.
Remarks¶
Best for simple agents where tool chaining is natural and the per-iteration conversation is expected to be short. Set MaxToolRoundsPerIteration to prevent unbounded growth.
SingleCall 1
Tool results are NOT sent back to the model. They are stored in LastToolResults and the iteration ends immediately. Exactly one LLM call per iteration.
Remarks¶
Maximum cost control. The prompt factory has full authority over what the model sees in the next iteration — it can selectively embed tool results, summarize them, or omit them entirely.
OneRoundTrip 2
Tool results are sent back to the model exactly once. The model gets one chance to produce a text response or request more tool calls. Any additional tool call requests are executed and stored in LastToolResults for the next iteration. Maximum two LLM calls per iteration.
Remarks¶
The recommended default. The model sees its results (matching how models are trained to interact with tools), but accumulation is bounded to at most one round-trip of tool results within a single iteration.
Remarks¶
The choice of mode determines the cost profile and interaction pattern of each iteration: - SingleCall — Maximum cost control — one LLM call per iteration, always. - OneRoundTrip — Balanced default — model sees its results once, bounded to two LLM calls. - MultiRound — Natural tool chaining within an iteration, bounded by MaxToolRoundsPerIteration.
Regardless of mode, tool results from the final round of an iteration are always available via LastToolResults for the next iteration's prompt factory.