max_iter=3 is a useful loop guard, but it is the wrong unit for budgeting a hardware workflow. For a proposed CrewAI controller using CometAPI for model access and MHS for device execution, keep three limits separate: agent iterations, model-request expenditure, and physical work.
The distinction matters before choosing a cheaper model or increasing the iteration allowance.
A single dispatch can contain substantial work
Anthropic’s MHS research preview describes chaining driver commands from one or more devices into code files. Devices can then carry out operations without the agent reasoning at every step. Its laser-alignment example packages the learned procedure into a deterministic script that runs as a single command.
That does not demonstrate a CrewAI integration. It does establish why counting the controller’s reasoning turns cannot, by itself, measure the work inside a dispatched script. Reaching an agent iteration limit is not evidence that an already-running device job has stopped.
Put the CometAPI budget at the model-access boundary
The official CrewAI + CometAPI guide uses https://api.cometapi.com/v1 with per-agent model configurations. It explicitly warns that max_iter=3 bounds the iteration loop, not exactly three API calls or three token budgets. It also recommends recording usage and fallback information, and warns that whole-crew retries can repeat completed tasks.
For this proposed controller, I would implement the following split:
| Boundary | What to count | What reaching the limit should do |
|---|---|---|
| CrewAI agent | Iterations | End further reasoning under the configured loop policy |
| Application’s CometAPI request wrapper | Request attempts, returned usage, selected model, fallback route and elapsed time | Refuse additional model requests when the reserved workflow allowance is exhausted |
| Local device executor | Validated command allowance and elapsed execution time | Apply an equipment-specific, validated stop procedure independently of the model loop |
These are application controls to build and test, not claims that CometAPI supplies a hard billing cap or that MHS guarantees a particular emergency-stop behavior.
For the CometAPI row, attach a workflow ID and attempt ID to the application’s accounting record. Include primary requests, retries and fallback requests—not just the route that eventually succeeds. Record unavailable usage as unknown, not zero. Keep sensitive prompts and credentials out of those records.
Use dated prices for the actual selected routes and all applicable usage categories to estimate expenditure. Before admitting another call, reserve a conservative allowance for it; reconcile that reservation when usage becomes available. If you cannot establish an upper estimate for a request, do not describe this as a hard monetary bound. No price or savings estimate follows from setting max_iter alone.
A timeout is not permission to repeat a device action
The CometAPI guide’s checkpoint and side-effect-confirmation advice becomes especially important here. If a model request or tool response times out after a device script was dispatched, a full crew retry could repeat completed physical work.
My proposed stop condition is: do not redispatch an uncertain device job until its execution ID and actual device state have been reconciled. A checkpoint helps preserve orchestration progress; it does not prove that the instrument stopped or that repeating a command is safe.
Before allowing a fallback model to continue this controller, test its required tool and output contract. A shared CometAPI endpoint is not proof of feature parity. Judge a route by cost per accepted completed workflow together with latency and task quality, rather than cost per iteration. A cheaper request is not necessarily a cheaper completed job.
MHS remains a research preview in the cited announcement. Neither source establishes a tested CometAPI-backed MHS deployment, so this is a budgeting and recovery design—not a hardware runbook. The practical question for a prototype is: can you stop new model spend, stop new device dispatches, and account for already-running device work as three separate operations?