{{ message }}
Repository navigation
feat(dot-net-sdk): add agent start, status, wait and cancel - #5259
Merged
Merged
Conversation
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.
View guided diff | Turn on auto-fix | Re-trigger cubic
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.

Adds the agent job flow to the .NET SDK, next to the existing
ListAgentsAsync.StartAgentAsync(prompt, options)POSTs/v2/agent.AgentOptionsfollows the API's request schema and the JS SDK: urls, schema, integration, maxCredits, strictConstrainToURLs, model, effort, webhook, auditMetadata, threadId, mode and location.locationis a smallAgentLocationthat holds onlycountry, because the endpoint accepts nothing else there.GetAgentStatusAsync(jobId)GETs/v2/agent/{id}, escaping the id.AgentStatusResponsemirrors the status response: status, error, data, partial, partialSchemaValid, stopReason, model, effort, expiresAt, creditsUsed, the thread fields and message. It also has anIsDoneproperty.AgentAsync(prompt, options, pollIntervalSec, timeoutSec)starts a job and polls it. LikeCrawlAsyncandBatchScrapeAsync, it returns failed and cancelled jobs instead of throwing, sopartialandstopReasonstay readable, and it throwsJobTimeoutExceptionwhen the timeout runs out.CancelAgentAsync(jobId)DELETEs/v2/agent/{id}.AgentTestsadds 8 xUnit tests using the stubHttpMessageHandlerpattern. 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 onmainbecauseAGENT_MIN_CREDITSis exported but only used in its own file, so this PR drops thatexport. The same identical line is in #5257 and #5258.dotnet build Firecrawl.sln -c Releasepasses locally, and CI runs the tests. No version bump, since releases bump .NET versions separately.Summary by cubic
Adds agent job support to the .NET SDK: start, status, wait, and cancel alongside the existing
ListAgentsAsync.StartAgentAsync,GetAgentStatusAsync,AgentAsync(start plus auto-polling), andCancelAgentAsynctoFirecrawlClient.AgentAsyncreturns failed or cancelled jobs instead of throwing soPartialandStopReasonstay readable; it throwsJobTimeoutExceptionwhen the timeout runs out.AgentOptions,AgentLocation,AgentResponse, andAgentStatusResponsemodels reflecting the API's request and status schemas, including exchange settings, threat protection, pending approval, and suggestions.exportonAGENT_MIN_CREDITSinapps/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.