Orchestrator step limit increased to 60
The main AI orchestrator was stopping after only 5 inference steps — too few for complex workflows — while sub-agents had 30-300 steps configured. A fix and constants refactor ensure all agents have appropriate limits.
The orchestrator agent, which coordinates all AI tasks in n8n's instance AI feature, was relying on Mastra's default step limit of 5. For multi-step operations like browser automation or workflow building, this meant the AI would stop mid-task and wait for users to say "continue."
Sub-agents already had appropriate limits configured — the builder agent allowed 60 steps, the browser agent allowed 300, the planner allowed 30 — but the orchestrator itself was left at the framework default. When the orchestrator handled direct tool calls or coordinated complex tasks, it would run out of steps before completing the work.
The fix passes maxSteps: 60 to both streaming paths in the orchestrator. Additionally, all step limits across the codebase are now centralized in a single constants file, making it easy to see and adjust limits for any agent role.
View Original GitHub Description
Summary
Mastra's Agent.stream() defaults to stopWhen: stepCountIs(5), meaning the orchestrator stops after only 5 LLM steps per turn. This causes the AI to stop mid-task during multi-step operations like browser automation (computer use), forcing users to repeatedly say "continue" to make progress.
Every sub-agent already sets its own maxSteps (builder=60, browser=300, planner=30, etc.), but the orchestrator was left at the framework default of 5.
This fix:
- Passes
maxSteps: 60in thestreamOptionsfor bothstreamAgentRun()calls (tracing and non-tracing paths), matching the builder agent's limit. - Centralizes all
maxStepsconstants into a single file (packages/@n8n/instance-ai/src/constants/max-steps.ts) so every agent's step limit is visible in one place.
Related Linear tickets, Github issues, and Community forum posts
- https://www.notion.so/n8n/Instance-AI-with-Computer-Use-stopped-after-4-5-messages-with-no-understandable-reason-so-I-had--33d5b6e0c94f8046a735dcd33cf296cb
- https://github.com/mastra-ai/mastra/issues/2930 — upstream Mastra issue for the low default
maxSteps
Review / Merge checklist
- I have seen this code, I have run this code, and I take responsibility for this code.
- PR title and summary are descriptive. (conventions)
- Docs updated or follow-up ticket created.
- Tests included.
- PR Labeled with
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)