firecrawl-sdk 1.14.0 → 1.15.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 +4 -4
- data/lib/firecrawl/client.rb +25 -0
- data/lib/firecrawl/models/agent_options.rb +5 -1
- data/lib/firecrawl/models/agent_snapshot_response.rb +22 -0
- data/lib/firecrawl/models/agent_status_response.rb +3 -1
- data/lib/firecrawl/models/agent_trace_response.rb +28 -0
- data/lib/firecrawl/models/query_format.rb +24 -0
- data/lib/firecrawl/version.rb +1 -1
- data/lib/firecrawl.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c7e11ff05113a301d334412a0aea3f1d421aa93cd45756c0546193d1cc3839e
|
|
4
|
+
data.tar.gz: 46b8f0dc763344c1372212a1e612812292c67efc6042a3ff5a45c66a4e63dcee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7f29c1250ccac6a0b7aece8951bc655dd3b55aee9f4d18dd66a987829514490c350dde4865527e0a48bf52fa1362c5d2d7bcd0ae168b319bbff51c824148d190
|
|
7
|
+
data.tar.gz: 1e907fd282ee7314cafe5223fc63571ada85ce45381de830f99baf2dcf41c7cb9b45d4a5ad45863cb1b1d0b812918a1bcda778e57886eea12811b421196932f9
|
data/lib/firecrawl/client.rb
CHANGED
|
@@ -493,6 +493,31 @@ module Firecrawl
|
|
|
493
493
|
@http.delete("/v2/agent/#{job_id}")
|
|
494
494
|
end
|
|
495
495
|
|
|
496
|
+
# Gets the trace of an agent task.
|
|
497
|
+
#
|
|
498
|
+
# @param job_id [String] the agent job ID
|
|
499
|
+
# @param live_view [Boolean] include live view URLs for active browser sessions
|
|
500
|
+
# @return [Models::AgentTraceResponse]
|
|
501
|
+
def get_agent_trace(job_id, live_view: false)
|
|
502
|
+
raise ArgumentError, "Job ID is required" if job_id.nil?
|
|
503
|
+
|
|
504
|
+
raw = @http.get("/v2/agent/#{job_id}/trace#{query(liveView: live_view ? true : nil)}")
|
|
505
|
+
Models::AgentTraceResponse.new(raw)
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
# Gets a snapshot of an agent task.
|
|
509
|
+
#
|
|
510
|
+
# @param job_id [String] the agent job ID
|
|
511
|
+
# @param snapshot_id [String] the snapshot ID
|
|
512
|
+
# @return [Models::AgentSnapshotResponse]
|
|
513
|
+
def get_agent_snapshot(job_id, snapshot_id)
|
|
514
|
+
raise ArgumentError, "Job ID is required" if job_id.nil?
|
|
515
|
+
raise ArgumentError, "Snapshot ID is required" if snapshot_id.nil?
|
|
516
|
+
|
|
517
|
+
raw = @http.get("/v2/agent/#{job_id}/snapshots/#{snapshot_id}")
|
|
518
|
+
Models::AgentSnapshotResponse.new(raw)
|
|
519
|
+
end
|
|
520
|
+
|
|
496
521
|
# ================================================================
|
|
497
522
|
# USAGE & METRICS
|
|
498
523
|
# ================================================================
|
|
@@ -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"
|
data/lib/firecrawl/version.rb
CHANGED
data/lib/firecrawl.rb
CHANGED
|
@@ -25,6 +25,8 @@ require_relative "firecrawl/models/parse_options"
|
|
|
25
25
|
require_relative "firecrawl/models/agent_options"
|
|
26
26
|
require_relative "firecrawl/models/agent_response"
|
|
27
27
|
require_relative "firecrawl/models/agent_status_response"
|
|
28
|
+
require_relative "firecrawl/models/agent_trace_response"
|
|
29
|
+
require_relative "firecrawl/models/agent_snapshot_response"
|
|
28
30
|
require_relative "firecrawl/models/concurrency_check"
|
|
29
31
|
require_relative "firecrawl/models/credit_usage"
|
|
30
32
|
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.
|
|
4
|
+
version: 1.15.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-
|
|
11
|
+
date: 2026-08-26 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.
|
|
@@ -26,7 +26,9 @@ files:
|
|
|
26
26
|
- lib/firecrawl/http_client.rb
|
|
27
27
|
- lib/firecrawl/models/agent_options.rb
|
|
28
28
|
- lib/firecrawl/models/agent_response.rb
|
|
29
|
+
- lib/firecrawl/models/agent_snapshot_response.rb
|
|
29
30
|
- lib/firecrawl/models/agent_status_response.rb
|
|
31
|
+
- lib/firecrawl/models/agent_trace_response.rb
|
|
30
32
|
- lib/firecrawl/models/audit_metadata.rb
|
|
31
33
|
- lib/firecrawl/models/batch_scrape_job.rb
|
|
32
34
|
- lib/firecrawl/models/batch_scrape_options.rb
|