firecrawl-sdk 1.17.1 → 1.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2b500556e1d7b0d222ae8937ae86dccdcf8c6499871c0202608a46b4611ef17
4
- data.tar.gz: 2e4913c995ed97d8b55f295ab6adb0e61fe42cc0f08aff1f8aa12763f765b2be
3
+ metadata.gz: b19bf99b95d02f2cd346f1450cf9d897d7d0e1cf473454dbb242d46f96dc9620
4
+ data.tar.gz: '0911ec19579abe8d1f9221d2626538c82a0444a4502615b892887b556c571e2d'
5
5
  SHA512:
6
- metadata.gz: d138c5083321098460e7ab5777201300ba0b1701f93361e97a27e0b87c88c9bd3163e56124d9b2da94536855a99e41522d13002c73379d1c67dd7bfb280b9624
7
- data.tar.gz: 64e7178e770554abd242289756c2de70fcd3d76d2104002e36c2d8773065aa14f1e4ca161b60a72ed063da9fb4f5fa1a050d49f79809fbedf951ce2d481909fe
6
+ metadata.gz: 8992eb0b4b39bb40477a531026482ed83ad43d2b7649c5bc8c520b1ffdf5350e7026213e3bdec11274e51460e0e191a84aacf166d3c72a4c1a4b68e8a1c3c9cb
7
+ data.tar.gz: '09e58c68ae722cf65e2130dabe424f78c29dfa51b805d04bbbecc8fce13730099e83b27ae14f7f63d7a45b703ba64fb30700a1195ee7dc480521c6ffc7ca0fa4'
data/README.md CHANGED
@@ -203,6 +203,17 @@ status = client.agent(
203
203
  urls: ["https://example.com"]
204
204
  ))
205
205
  puts status.data
206
+
207
+ # Use Alexandria data providers connected in the dashboard
208
+ status = client.agent(
209
+ Firecrawl::Models::AgentOptions.new(
210
+ prompt: "Find the work email of the CEO of example.com",
211
+ exchange: Firecrawl::Models::AgentExchangeOptions.new(
212
+ enabled: true,
213
+ toolkits: ["apollo"]
214
+ )
215
+ ))
216
+ puts status.exchange&.paid_calls
206
217
  ```
207
218
 
208
219
  ### Usage & Metrics
@@ -81,6 +81,10 @@ module Firecrawl
81
81
  body.merge!(options.to_h) if options
82
82
  body["origin"] ||= "ruby-sdk@#{Firecrawl::VERSION}"
83
83
  raw = @http.post("/v2/scrape", body)
84
+ # Some scrape failures (e.g. SCRAPE_DNS_RESOLUTION_ERROR) arrive as HTTP 200 with success: false.
85
+ if raw["success"] == false
86
+ raise FirecrawlError.new(raw["error"] || "Scrape failed", status_code: 200, error_code: raw["code"], details: raw["details"])
87
+ end
84
88
  data = raw["data"] || raw
85
89
  Models::Document.new(data)
86
90
  end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Firecrawl
4
+ module Models
5
+ # Alexandria (Exchange) options for an agent run, forwarded verbatim; the
6
+ # server owns every default and limit. On a follow-up turn, omitting the
7
+ # exchange options inherits the previous turn's settings.
8
+ #
9
+ # on_terms_required: "skip" or "ask".
10
+ class AgentExchangeOptions
11
+ # Answers the previous turn's pending approval. A "terms" approval is
12
+ # accepted as a whole, so call_ids and always are ignored on it.
13
+ class Approve
14
+ attr_reader :approval_id, :call_ids, :always
15
+
16
+ def initialize(approval_id:, call_ids: nil, always: nil)
17
+ @approval_id = approval_id
18
+ @call_ids = call_ids
19
+ @always = always
20
+ end
21
+
22
+ def to_h
23
+ {
24
+ "approvalId" => approval_id,
25
+ "callIds" => call_ids,
26
+ "always" => always,
27
+ }.compact
28
+ end
29
+ end
30
+
31
+ # Refuses the previous turn's pending approval.
32
+ class Decline
33
+ attr_reader :approval_id
34
+
35
+ def initialize(approval_id:)
36
+ @approval_id = approval_id
37
+ end
38
+
39
+ def to_h
40
+ { "approvalId" => approval_id }
41
+ end
42
+ end
43
+
44
+ FIELDS = %i[
45
+ enabled toolkits max_calls require_approval approve decline
46
+ on_terms_required
47
+ ].freeze
48
+
49
+ attr_reader(*FIELDS)
50
+
51
+ def initialize(**kwargs)
52
+ FIELDS.each { |f| instance_variable_set(:"@#{f}", kwargs[f]) }
53
+ end
54
+
55
+ def to_h
56
+ {
57
+ "enabled" => enabled,
58
+ "toolkits" => toolkits,
59
+ "maxCalls" => max_calls,
60
+ "requireApproval" => require_approval,
61
+ "approve" => approve&.to_h,
62
+ "decline" => decline&.to_h,
63
+ "onTermsRequired" => on_terms_required,
64
+ }.compact
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Firecrawl
4
+ module Models
5
+ # What an agent run did with Alexandria (Exchange). toolkits and
6
+ # require_approval are what the run resolved to after thread inheritance.
7
+ class AgentExchangeSummary
8
+ # A provider that needs data terms the team has not accepted, so the run
9
+ # did not use it.
10
+ class SkippedProvider
11
+ attr_reader :provider, :name, :capability, :adds, :reason, :version,
12
+ :terms_url
13
+
14
+ def initialize(data)
15
+ @provider = data["provider"]
16
+ @name = data["name"]
17
+ @capability = data["capability"]
18
+ @adds = data["adds"]
19
+ @reason = data["reason"]
20
+ @version = data["version"]
21
+ @terms_url = data["termsUrl"]
22
+ end
23
+ end
24
+
25
+ # The Exchange calls to view and accept providers' terms ("ask" mode).
26
+ # Nothing here runs for you; only call accept after your user agrees.
27
+ class TermsRequiredAction
28
+ # show and accept are the raw Exchange calls ("provider",
29
+ # "capability", "options").
30
+ class Provider
31
+ attr_reader :provider, :name, :capability, :adds, :version, :digest,
32
+ :url, :show, :accept
33
+
34
+ def initialize(data)
35
+ @provider = data["provider"]
36
+ @name = data["name"]
37
+ @capability = data["capability"]
38
+ @adds = data["adds"]
39
+ @version = data["version"]
40
+ @digest = data["digest"]
41
+ @url = data["url"]
42
+ @show = data["show"]
43
+ @accept = data["accept"]
44
+ end
45
+ end
46
+
47
+ attr_reader :type, :approval_id, :providers
48
+
49
+ def initialize(data)
50
+ @type = data["type"]
51
+ @approval_id = data["approvalId"]
52
+ @providers = data["providers"]&.map { |p| Provider.new(p) }
53
+ end
54
+ end
55
+
56
+ attr_reader :enabled, :toolkits, :require_approval, :on_terms_required,
57
+ :paid_calls, :credits_used, :skipped_providers,
58
+ :requires_action
59
+
60
+ def initialize(data)
61
+ @enabled = data["enabled"]
62
+ @toolkits = data["toolkits"]
63
+ @require_approval = data["requireApproval"]
64
+ @on_terms_required = data["onTermsRequired"]
65
+ @paid_calls = data["paidCalls"]
66
+ @credits_used = data["creditsUsed"]
67
+ @skipped_providers = data["skippedProviders"]&.map { |p| SkippedProvider.new(p) }
68
+ @requires_action = data["requiresAction"] && TermsRequiredAction.new(data["requiresAction"])
69
+ end
70
+ end
71
+ end
72
+ end
@@ -6,10 +6,14 @@ module Firecrawl
6
6
  #
7
7
  # effort: valid values are "low", "medium", and "high"; sets the reasoning
8
8
  # budget for the run (every level runs spark-2).
9
+ #
10
+ # thread_id continues an existing thread as its next turn; omitted starts a
11
+ # new thread. mode: "extract" or "chat".
9
12
  class AgentOptions
10
13
  FIELDS = %i[
11
14
  urls prompt schema integration max_credits
12
15
  strict_constrain_to_urls model effort webhook audit_metadata
16
+ thread_id mode exchange
13
17
  ].freeze
14
18
 
15
19
  attr_reader(*FIELDS)
@@ -34,6 +38,9 @@ module Firecrawl
34
38
  "effort" => effort,
35
39
  "webhook" => webhook.is_a?(Hash) ? webhook : webhook&.to_h,
36
40
  "auditMetadata" => audit_metadata&.to_h,
41
+ "threadId" => thread_id,
42
+ "mode" => mode,
43
+ "exchange" => exchange&.to_h,
37
44
  }.compact
38
45
  end
39
46
  end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Firecrawl
4
+ module Models
5
+ # A turn that ended waiting for the caller. kind "calls" (or nil on older
6
+ # runs) holds paid calls to allow or refuse; kind "terms" lists providers
7
+ # whose data terms need accepting, with calls empty. Answer it on the next
8
+ # turn of the thread with AgentExchangeOptions approve or decline.
9
+ class AgentPendingApproval
10
+ # input and more are the raw call arguments.
11
+ class Call
12
+ attr_reader :id, :provider, :capability, :input, :more,
13
+ :credits_estimate
14
+
15
+ def initialize(data)
16
+ @id = data["id"]
17
+ @provider = data["provider"]
18
+ @capability = data["capability"]
19
+ @input = data["input"]
20
+ @more = data["more"]
21
+ @credits_estimate = data["creditsEstimate"]
22
+ end
23
+ end
24
+
25
+ class TermsGate
26
+ attr_reader :provider, :name, :logo, :capability, :adds, :version,
27
+ :digest, :url
28
+
29
+ def initialize(data)
30
+ @provider = data["provider"]
31
+ @name = data["name"]
32
+ @logo = data["logo"]
33
+ @capability = data["capability"]
34
+ @adds = data["adds"]
35
+ @version = data["version"]
36
+ @digest = data["digest"]
37
+ @url = data["url"]
38
+ end
39
+ end
40
+
41
+ class Resolution
42
+ attr_reader :approved, :call_ids, :always, :by_run_id
43
+
44
+ def initialize(data)
45
+ @approved = data["approved"]
46
+ @call_ids = data["callIds"]
47
+ @always = data["always"]
48
+ @by_run_id = data["byRunId"]
49
+ end
50
+ end
51
+
52
+ attr_reader :id, :kind, :reason, :calls, :terms, :resolution
53
+
54
+ def initialize(data)
55
+ @id = data["id"]
56
+ @kind = data["kind"]
57
+ @reason = data["reason"]
58
+ @calls = data["calls"]&.map { |c| Call.new(c) }
59
+ @terms = data["terms"]&.map { |t| TermsGate.new(t) }
60
+ @resolution = data["resolution"] && Resolution.new(data["resolution"])
61
+ end
62
+ end
63
+ end
64
+ end
@@ -4,12 +4,15 @@ module Firecrawl
4
4
  module Models
5
5
  # Response from starting an agent task.
6
6
  class AgentResponse
7
- attr_reader :success, :id, :error
7
+ attr_reader :success, :id, :error, :thread_id, :thread_turn
8
8
 
9
9
  def initialize(data)
10
10
  @success = data["success"]
11
11
  @id = data["id"]
12
12
  @error = data["error"]
13
+ # Pass thread_id back in AgentOptions to continue the conversation.
14
+ @thread_id = data["threadId"]
15
+ @thread_turn = data["threadTurn"]
13
16
  end
14
17
 
15
18
  def to_s
@@ -4,7 +4,9 @@ module Firecrawl
4
4
  module Models
5
5
  # Status response for monitoring agent tasks.
6
6
  class AgentStatusResponse
7
- attr_reader :status, :data, :credits_used, :expires_at, :effort
7
+ attr_reader :status, :data, :credits_used, :expires_at, :effort,
8
+ :thread_id, :thread_turn, :mode, :message, :pending_approval,
9
+ :exchange
8
10
 
9
11
  def initialize(raw)
10
12
  @status = raw["status"]
@@ -13,6 +15,13 @@ module Firecrawl
13
15
  @expires_at = raw["expiresAt"]
14
16
  # The effort the job ran with; only present for runs that specified it.
15
17
  @effort = raw["effort"]
18
+ @thread_id = raw["threadId"]
19
+ @thread_turn = raw["threadTurn"]
20
+ @mode = raw["mode"]
21
+ # Chat-mode runs answer here instead of in data.
22
+ @message = raw["message"]
23
+ @pending_approval = raw["pendingApproval"] && AgentPendingApproval.new(raw["pendingApproval"])
24
+ @exchange = raw["exchange"] && AgentExchangeSummary.new(raw["exchange"])
16
25
  end
17
26
 
18
27
  def done?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Firecrawl
4
- VERSION = "1.17.1"
4
+ VERSION = "1.17.4"
5
5
  end
data/lib/firecrawl.rb CHANGED
@@ -23,9 +23,12 @@ require_relative "firecrawl/models/search_data"
23
23
  require_relative "firecrawl/models/parse_file"
24
24
  require_relative "firecrawl/models/parse_options"
25
25
  require_relative "firecrawl/models/parse_format"
26
+ require_relative "firecrawl/models/agent_exchange_options"
26
27
  require_relative "firecrawl/models/agent_options"
27
28
  require_relative "firecrawl/models/agent_response"
28
29
  require_relative "firecrawl/models/agent_list_response"
30
+ require_relative "firecrawl/models/agent_exchange_summary"
31
+ require_relative "firecrawl/models/agent_pending_approval"
29
32
  require_relative "firecrawl/models/agent_status_response"
30
33
  require_relative "firecrawl/models/agent_trace_response"
31
34
  require_relative "firecrawl/models/agent_snapshot_response"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firecrawl-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.1
4
+ version: 1.17.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firecrawl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-02 00:00:00.000000000 Z
11
+ date: 2026-10-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A type-safe Ruby client for the Firecrawl v2 API. Supports scraping,
14
14
  crawling, batch scraping, URL mapping, web search, and AI agent operations.
@@ -24,8 +24,11 @@ files:
24
24
  - lib/firecrawl/client.rb
25
25
  - lib/firecrawl/errors.rb
26
26
  - lib/firecrawl/http_client.rb
27
+ - lib/firecrawl/models/agent_exchange_options.rb
28
+ - lib/firecrawl/models/agent_exchange_summary.rb
27
29
  - lib/firecrawl/models/agent_list_response.rb
28
30
  - lib/firecrawl/models/agent_options.rb
31
+ - lib/firecrawl/models/agent_pending_approval.rb
29
32
  - lib/firecrawl/models/agent_response.rb
30
33
  - lib/firecrawl/models/agent_snapshot_response.rb
31
34
  - lib/firecrawl/models/agent_status_response.rb