feat(agent): exchange options and terms approval on firecrawl_agent - #453
Merged
Merged
Conversation
rakshith48
marked this pull request as ready for review
September 26, 2026 16:04
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Contributor
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Adds exchange to firecrawl_agent to answer pending terms/paid-call approvals on the same thread, with tests and docs. It changes the MCP tool's public request/response shape and adds a terms/paid-call approval flow, so human sign-off is needed.
Re-trigger cubic
firecrawl_agent takes an exchange object that mirrors the gateway's agentExchangeSchema (enabled, toolkits (max 5), maxCalls, requireApproval, approve, decline, onTermsRequired), forwarded through the SDK's startAgent. Pre-send checks: approve/decline need threadId and cannot be sent together; requireApproval needs mode "chat" on the same request. The tool description gives the ask-mode terms flow (show the terms, explicit consent, terms/accept, continue with exchange.approve), and firecrawl_agent_status keeps exchange and pendingApproval in its structured content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; assert the turn's thread Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rakshith48
force-pushed
the
rak/agent-exchange-terms
branch
from
September 27, 2026 12:50
7ef8805 to
9f3805e
Compare
erikengervall
approved these changes
Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
With
exchange.onTermsRequired: "ask", an agent turn can end on a terms offer: apendingApprovalwithkind: "terms", plusexchange.requiresAction. Before this PR, an MCP caller could runterms/acceptbut couldn't answer the offer on the same thread.What changed
firecrawl_agenttakesexchange, a strict object that mirrors the gateway'sagentExchangeSchema(firecrawl#4759). It is forwarded through the SDK'sstartAgent; firecrawl 4.40.0 passesexchangethrough as-is. The fields:enabledtoolkits: at most 5, the agent service's limitmaxCalls: 1 to 30requireApprovalapprove: {approvalId, callIds?, always?}decline: {approvalId}onTermsRequired: "skip" | "ask"approveordeclinewithoutthreadId. Without a thread, the agent service silently ignores them.approveanddeclinetogether. The agent service silently prefersapprove.requireApprovalwithoutmode: "chat"on the same request. The agent service checks the request's own mode, not the thread's inherited one, and the gateway turns its 400 into a 500.skippedProvidersandrequiresAction.terms/acceptthroughfirecrawl_scrape, then callfirecrawl_agentwith the samethreadIdandexchange.approve: {approvalId}.exchange.decline: {approvalId}.CLAUDE_CODE_TEXT_CAP.firecrawl_agent_statuskeepsexchangeandpendingApprovalin its structured content, in both the terms and the paid-call shape.Tests
approve,decline, a paid-call approve andonTermsRequired.pendingApprovalshapes.npm test126/126 pass,tscclean, eslint clean on the changed files (rebased ontomainafter feat(agent): continue a thread from firecrawl_agent #446 merged).Known gaps
approvalId(approval_stale, 409) is rejected by the agent service after the gateway passes the request through, and the gateway returns500 "Failed to passthrough agent request.".promptatmin(1), so callers send a short message such as "I accepted the terms. Continue."🤖 Generated with Claude Code