firecrawl-sdk 1.14.0 → 1.16.0

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: 361f6ab9151b9481824965c07081793bb5a21aa99ef9b5e8ad61ff3db58b64e8
4
- data.tar.gz: d99e0a59c24b8cda8618a0d2fa83225c3869dea31768eb9846e4dad7173ab305
3
+ metadata.gz: 6f3695aabd644bab09a7baa7c340d72fe38f376cba6d2f2cc1635d9df2f3d66e
4
+ data.tar.gz: 445c52d6c75a8a3ba54b751a00b6ccf3d09745693bbee5462f6253eba3f7eb8d
5
5
  SHA512:
6
- metadata.gz: 145c0ec698d497bbf326157cb304dee1c4e1d42439865d247b60fcb5ff4fa4b7ebcf818ac86dd0048ca192690570ff501052d65f4254464044d18c6e71b22c61
7
- data.tar.gz: 2a2010f8e0b1545d662d782093bfad674be3f1406811ec330e00da0b2addedcd0a9a8e9ccd0821e0c48894e43acf6b72c0beb377e623ba23000b09e7612f8790
6
+ metadata.gz: daaf47ae8bc4b2ae5a549b873c5978fa01e1abf2cd9a4dfd5829da5a0797b2109892885c991830a4aecd6c69b469ac09ecd52a545f278238d57ecb13a779be42
7
+ data.tar.gz: 73433fb46a58926b598d1fee36aadf7551dbfdaf636d484860d81bf65fd7c13ce014272e5b32508db76ecfd6db728ba64e5232d764f6207f2b70b1e6867032ac
@@ -463,6 +463,20 @@ module Firecrawl
463
463
  Models::AgentStatusResponse.new(raw)
464
464
  end
465
465
 
466
+ # Lists agent tasks, most recent first.
467
+ #
468
+ # Pages are fixed at 20 runs. To fetch the next page, pass the before
469
+ # value from the previous page's next URL. This method does not
470
+ # auto-paginate.
471
+ #
472
+ # @param before [Integer, nil] only return agent runs created before this
473
+ # unix millisecond timestamp
474
+ # @return [Models::AgentListResponse]
475
+ def list_agents(before: nil)
476
+ raw = @http.get("/v2/agent#{query(before: before)}")
477
+ Models::AgentListResponse.new(raw)
478
+ end
479
+
466
480
  # Runs an agent task and waits for completion (auto-polling).
467
481
  #
468
482
  # @param options [Models::AgentOptions] agent configuration
@@ -493,6 +507,31 @@ module Firecrawl
493
507
  @http.delete("/v2/agent/#{job_id}")
494
508
  end
495
509
 
510
+ # Gets the trace of an agent task.
511
+ #
512
+ # @param job_id [String] the agent job ID
513
+ # @param live_view [Boolean] include live view URLs for active browser sessions
514
+ # @return [Models::AgentTraceResponse]
515
+ def get_agent_trace(job_id, live_view: false)
516
+ raise ArgumentError, "Job ID is required" if job_id.nil?
517
+
518
+ raw = @http.get("/v2/agent/#{job_id}/trace#{query(liveView: live_view ? true : nil)}")
519
+ Models::AgentTraceResponse.new(raw)
520
+ end
521
+
522
+ # Gets a snapshot of an agent task.
523
+ #
524
+ # @param job_id [String] the agent job ID
525
+ # @param snapshot_id [String] the snapshot ID
526
+ # @return [Models::AgentSnapshotResponse]
527
+ def get_agent_snapshot(job_id, snapshot_id)
528
+ raise ArgumentError, "Job ID is required" if job_id.nil?
529
+ raise ArgumentError, "Snapshot ID is required" if snapshot_id.nil?
530
+
531
+ raw = @http.get("/v2/agent/#{job_id}/snapshots/#{snapshot_id}")
532
+ Models::AgentSnapshotResponse.new(raw)
533
+ end
534
+
496
535
  # ================================================================
497
536
  # USAGE & METRICS
498
537
  # ================================================================
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Firecrawl
4
+ module Models
5
+ # Response from listing agent tasks.
6
+ class AgentListResponse
7
+ attr_reader :success, :agents, :next, :error
8
+
9
+ def initialize(raw)
10
+ @success = raw["success"]
11
+ @agents = raw["agents"]
12
+ @next = raw["next"]
13
+ @error = raw["error"]
14
+ end
15
+
16
+ def to_s
17
+ "AgentListResponse{success=#{success}, agents=#{agents&.size}}"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -3,10 +3,13 @@
3
3
  module Firecrawl
4
4
  module Models
5
5
  # Options for starting an agent task.
6
+ #
7
+ # effort: valid values are "low", "medium", and "high"; sets the reasoning
8
+ # budget for the run (every level runs spark-2).
6
9
  class AgentOptions
7
10
  FIELDS = %i[
8
11
  urls prompt schema integration max_credits
9
- strict_constrain_to_urls model webhook audit_metadata
12
+ strict_constrain_to_urls model effort webhook audit_metadata
10
13
  ].freeze
11
14
 
12
15
  attr_reader(*FIELDS)
@@ -28,6 +31,7 @@ module Firecrawl
28
31
  "maxCredits" => max_credits,
29
32
  "strictConstrainToURLs" => strict_constrain_to_urls,
30
33
  "model" => model,
34
+ "effort" => effort,
31
35
  "webhook" => webhook.is_a?(Hash) ? webhook : webhook&.to_h,
32
36
  "auditMetadata" => audit_metadata&.to_h,
33
37
  }.compact
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Firecrawl
4
+ module Models
5
+ # Snapshot response for an agent task.
6
+ class AgentSnapshotResponse
7
+ attr_reader :success, :id, :snapshot_id, :snapshot, :error
8
+
9
+ def initialize(raw)
10
+ @success = raw["success"]
11
+ @id = raw["id"]
12
+ @snapshot_id = raw["snapshotId"]
13
+ @snapshot = raw["snapshot"]
14
+ @error = raw["error"]
15
+ end
16
+
17
+ def to_s
18
+ "AgentSnapshotResponse{id=#{id}, snapshot_id=#{snapshot_id}, success=#{success}}"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -4,13 +4,15 @@ 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
7
+ attr_reader :status, :data, :credits_used, :expires_at, :effort
8
8
 
9
9
  def initialize(raw)
10
10
  @status = raw["status"]
11
11
  @data = raw["data"]
12
12
  @credits_used = raw["creditsUsed"]
13
13
  @expires_at = raw["expiresAt"]
14
+ # The effort the job ran with; only present for runs that specified it.
15
+ @effort = raw["effort"]
14
16
  end
15
17
 
16
18
  def done?
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Firecrawl
4
+ module Models
5
+ # Trace response for an agent task.
6
+ #
7
+ # Events are raw hashes: each carries a "type" (e.g. "run.started",
8
+ # "agent.finished", "tool_call.started") plus base fields like
9
+ # "schemaVersion", "eventId", "runId", "occurredAt", "producerSequence",
10
+ # and "agent".
11
+ class AgentTraceResponse
12
+ attr_reader :success, :id, :events, :active_browser_sessions, :credits_used, :error
13
+
14
+ def initialize(raw)
15
+ @success = raw["success"]
16
+ @id = raw["id"]
17
+ @events = raw["events"]
18
+ @active_browser_sessions = raw["activeBrowserSessions"]
19
+ @credits_used = raw["creditsUsed"]
20
+ @error = raw["error"]
21
+ end
22
+
23
+ def to_s
24
+ "AgentTraceResponse{id=#{id}, success=#{success}}"
25
+ end
26
+ end
27
+ end
28
+ end
@@ -42,6 +42,30 @@ module Firecrawl
42
42
  end
43
43
  end
44
44
 
45
+ # JSON format for extracting structured data from page content using a schema.
46
+ class JsonFormat
47
+ attr_reader :schema, :prompt, :check_prompt_injection
48
+
49
+ def initialize(schema: nil, prompt: nil, check_prompt_injection: nil)
50
+ @schema = schema
51
+ @prompt = prompt
52
+ @check_prompt_injection = check_prompt_injection
53
+ end
54
+
55
+ def to_h
56
+ {
57
+ "type" => "json",
58
+ "schema" => schema,
59
+ "prompt" => prompt,
60
+ "checkPromptInjection" => check_prompt_injection,
61
+ }.compact
62
+ end
63
+
64
+ def type
65
+ "json"
66
+ end
67
+ end
68
+
45
69
  # Deprecated query format for asking a question about page content.
46
70
  class QueryFormat
47
71
  MODE_FREEFORM = "freeform"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Firecrawl
4
- VERSION = "1.14.0"
4
+ VERSION = "1.16.0"
5
5
  end
data/lib/firecrawl.rb CHANGED
@@ -24,7 +24,10 @@ require_relative "firecrawl/models/parse_file"
24
24
  require_relative "firecrawl/models/parse_options"
25
25
  require_relative "firecrawl/models/agent_options"
26
26
  require_relative "firecrawl/models/agent_response"
27
+ require_relative "firecrawl/models/agent_list_response"
27
28
  require_relative "firecrawl/models/agent_status_response"
29
+ require_relative "firecrawl/models/agent_trace_response"
30
+ require_relative "firecrawl/models/agent_snapshot_response"
28
31
  require_relative "firecrawl/models/concurrency_check"
29
32
  require_relative "firecrawl/models/credit_usage"
30
33
  require_relative "firecrawl/models/monitor"
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.14.0
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firecrawl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-21 00:00:00.000000000 Z
11
+ date: 2026-08-31 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,9 +24,12 @@ 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_list_response.rb
27
28
  - lib/firecrawl/models/agent_options.rb
28
29
  - lib/firecrawl/models/agent_response.rb
30
+ - lib/firecrawl/models/agent_snapshot_response.rb
29
31
  - lib/firecrawl/models/agent_status_response.rb
32
+ - lib/firecrawl/models/agent_trace_response.rb
30
33
  - lib/firecrawl/models/audit_metadata.rb
31
34
  - lib/firecrawl/models/batch_scrape_job.rb
32
35
  - lib/firecrawl/models/batch_scrape_options.rb