feat(dot-net-sdk): add agent start, status, wait and cancel by erikengervall · Pull Request #5259 · firecrawl/firecrawl · GitHub
Skip to content

feat(dot-net-sdk): add agent start, status, wait and cancel - #5259

Merged
capy-ai[bot] merged 2 commits into
mainfrom
capy/add-agent-start-status
Oct 20, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
capy/add-agent-start-status

Conversation

@erikengervall

@erikengervall erikengervall commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Adds the agent job flow to the .NET SDK, next to the existing ListAgentsAsync.

  • StartAgentAsync(prompt, options) POSTs /v2/agent. AgentOptions follows the API's request schema and the JS SDK: urls, schema, integration, maxCredits, strictConstrainToURLs, model, effort, webhook, auditMetadata, threadId, mode and location. location is a small AgentLocation that holds only country, because the endpoint accepts nothing else there.
  • GetAgentStatusAsync(jobId) GETs /v2/agent/{id}, escaping the id. AgentStatusResponse mirrors the status response: status, error, data, partial, partialSchemaValid, stopReason, model, effort, expiresAt, creditsUsed, the thread fields and message. It also has an IsDone property.
  • AgentAsync(prompt, options, pollIntervalSec, timeoutSec) starts a job and polls it. Like CrawlAsync and BatchScrapeAsync, it returns failed and cancelled jobs instead of throwing, so partial and stopReason stay readable, and it throws JobTimeoutException when the timeout runs out.
  • CancelAgentAsync(jobId) DELETEs /v2/agent/{id}.
  • README: a new Agent section with an example.
  • Tests: AgentTests adds 8 xUnit tests using the stub HttpMessageHandler pattern. They cover the request path and body, the null-prompt guard, the status fields and id escaping, polling to completion, a failed job with a partial result, a start with no id, the timeout and cancel.

Unrelated one-liner: apps/api's knip pre-commit hook fails on main because AGENT_MIN_CREDITS is exported but only used in its own file, so this PR drops that export. The same identical line is in #5257 and #5258.

dotnet build Firecrawl.sln -c Release passes locally, and CI runs the tests. No version bump, since releases bump .NET versions separately.

Open in Capy


Summary by cubic

Adds agent job support to the .NET SDK: start, status, wait, and cancel alongside the existing ListAgentsAsync.

  • Adds StartAgentAsync, GetAgentStatusAsync, AgentAsync (start plus auto-polling), and CancelAgentAsync to FirecrawlClient.
  • AgentAsync returns failed or cancelled jobs instead of throwing so Partial and StopReason stay readable; it throws JobTimeoutException when the timeout runs out.
  • Adds AgentOptions, AgentLocation, AgentResponse, and AgentStatusResponse models reflecting the API's request and status schemas, including exchange settings, threat protection, pending approval, and suggestions.
  • Adds 8 xUnit tests covering request payloads, job id escaping, polling, failed jobs, timeouts, and cancel; adds an Agent example to the README.
  • Drops the export on AGENT_MIN_CREDITS in apps/api; it was only used in its own file and broke the knip pre-commit hook.

Written for commit 9ffdf9d. Summary will update on new commits.

View guided diff Turn on auto-fix

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread apps/dot-net-sdk/Firecrawl/FirecrawlClient.cs
Comment thread apps/dot-net-sdk/Firecrawl/Models/AgentModels.cs
Comment thread apps/dot-net-sdk/Firecrawl/Models/AgentModels.cs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 3 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

View guided diff | Turn on auto-fix | Re-trigger cubic

@capy-ai
capy-ai Bot merged commit f962020 into main Oct 20, 2026
11 checks passed
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.

1 participant