Skip to content

Conversation

@drfarrell
Copy link
Collaborator

@drfarrell drfarrell commented Dec 1, 2025

Description

This PR introduces a step limit mechanism to prevent AI agents from running endlessly, thereby controlling potential high costs and giving users more control over long-running tasks. The agent will now pause after a set number of steps (tool calls) and prompt the user to explicitly continue the task.

Key changes include:

  • Setting a maximum step limit of 10 for the root AI agent.
  • Detecting when the step limit is reached within the chat hook.
  • Introducing a new UI banner that appears when the limit is hit, allowing users to either "Continue" the task or "Stop here".
  • Implementing functions to handle continuing the task (sending a follow-up message) or dismissing the banner.

Related Issues

N/A

Type of Change

  • New feature

Testing

To verify these changes:

  1. Initiate a chat conversation that requires the AI agent to perform multiple tool calls (more than 10).
  2. Verify that the agent pauses after 10 steps and the "Task paused" banner appears in the chat.
  3. Click the "Continue" button and observe the agent resuming its task.
  4. Click the "Stop here" button and verify the banner is dismissed without the agent continuing.

Screenshots (if applicable)

N/A

Additional Notes

The current step limit is set to 10 tool calls, defined by MAX_AGENT_STEPS in packages/ai/src/agents/root.ts. This value can be adjusted as needed.


Open in Cursor Open in Web


Important

Introduces a step limit mechanism to pause AI agents after 10 tool calls, with UI for user control, in use-chat/index.tsx and chat-tab-content/index.tsx.

  • Behavior:
    • Introduces step limit mechanism in use-chat/index.tsx to pause AI agent after 10 tool calls.
    • Adds hitStepLimit, continueAfterStepLimit, and dismissStepLimit functions to manage step limit state.
  • UI:
    • Adds StepLimitBanner component in step-limit-banner.tsx to display when step limit is reached.
    • Integrates StepLimitBanner in chat-tab-content/index.tsx to allow users to continue or stop the task.
  • Constants:
    • Defines MAX_AGENT_STEPS in root.ts to set server-side step limit to 20.

This description was created by Ellipsis for 69dfe03. You can customize this summary. It will automatically update as commits are pushed.

cursoragent and others added 2 commits December 1, 2025 03:14
Co-authored-by: daniel <daniel@onlook.dev>
Co-authored-by: daniel <daniel@onlook.dev>
@cursor
Copy link

cursor bot commented Dec 1, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
web Ready Ready Preview Comment Dec 1, 2025 8:02pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Dec 1, 2025 8:02pm

@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/limit-agent-response-length-and-cost-claude-4.5-opus-high-thinking-7157

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@supabase
Copy link

supabase bot commented Dec 1, 2025

This pull request has been ignored for the connected project wowaemfasoptxrdjhilu because there are no changes detected in apps/backend/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Co-authored-by: daniel <daniel@onlook.dev>
Co-authored-by: daniel <daniel@onlook.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants