You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -219,7 +219,10 @@ export GOOGLE_API_KEY=your_api_key_here # if anthropic and openai keys are n
219
219
`--max-tokens`can be specified to override the context limit used.
220
220
When using DMR, the default is 16k to limit memory usage. With all other providers the default is 64k
221
221
222
-
Example of provider, model and context size overriding:
222
+
`--max-iterations`can be specified to override how many times the agent is allowed to loop when doing tool calling etc.
223
+
When using DMR, the default is set to 20 (small local models have the highest chance of getting confused and looping endlessly). For all other providers, the default is 0 (unlimited).
224
+
225
+
Example of provider, model, context size and max iterations overriding:
223
226
224
227
```sh
225
228
# Use GPT-5 via OpenAI
@@ -230,6 +233,9 @@ cagent new --model dmr/ai/gemma3-qat:12B
230
233
231
234
# Override the max_tokens used during generation, default is 64k, 16k when using the dmr provider
232
235
cagent new --model openai/gpt-5-mini --max-tokens 32000
236
+
237
+
# Override max_iterations to limit how much the model can loop autonomously
238
+
cagent new --model dmr/ai/gemma3n:2B-F16 --max-iterations 15
cmd.PersistentFlags().StringVar(&modelParam, "model", "", "Model to use, optionally as provider/model where provider is one of: anthropic, openai, google, dmr. If omitted, provider is auto-selected based on available credentials or gateway")
137
154
cmd.PersistentFlags().IntVar(&maxTokensParam, "max-tokens", 0, "Override max_tokens for the selected model (0 = default)")
155
+
cmd.PersistentFlags().IntVar(&maxIterationsParam, "max-iterations", 0, "Maximum number of agentic loop iterations to prevent infinite loops (default: 20 for DMR, unlimited for other providers)")
0 commit comments