@dealcrawl/sdk 2.2.0 → 2.4.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.
- package/dist/index.d.mts +443 -2
- package/dist/index.d.ts +443 -2
- package/dist/index.js +299 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +299 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.d.mts
CHANGED
|
@@ -776,6 +776,82 @@ interface UpdatePreferencesResponse {
|
|
|
776
776
|
success: boolean;
|
|
777
777
|
preferences: ClientPreferences;
|
|
778
778
|
}
|
|
779
|
+
/** Agent job creation response */
|
|
780
|
+
interface AgentJobResponse extends JobResponse {
|
|
781
|
+
/** Estimated completion time based on maxSteps */
|
|
782
|
+
estimatedTime?: string;
|
|
783
|
+
}
|
|
784
|
+
/** Agent step in execution trace */
|
|
785
|
+
interface AgentStepResponse {
|
|
786
|
+
/** Step number (1-indexed) */
|
|
787
|
+
step: number;
|
|
788
|
+
/** Agent's reasoning before action */
|
|
789
|
+
thought: string;
|
|
790
|
+
/** Type of action taken */
|
|
791
|
+
actionType: string;
|
|
792
|
+
/** Action details */
|
|
793
|
+
action: Record<string, unknown>;
|
|
794
|
+
/** Whether the action succeeded */
|
|
795
|
+
result: "success" | "failed" | "skipped";
|
|
796
|
+
/** Duration of this step in ms */
|
|
797
|
+
durationMs: number;
|
|
798
|
+
/** Error message if failed */
|
|
799
|
+
error?: string;
|
|
800
|
+
/** Screenshot URL if captured */
|
|
801
|
+
screenshotUrl?: string;
|
|
802
|
+
/** Current URL after action */
|
|
803
|
+
currentUrl?: string;
|
|
804
|
+
}
|
|
805
|
+
/** Agent completion reason */
|
|
806
|
+
type AgentCompletionReason = "goal_achieved" | "max_steps_reached" | "stuck" | "error" | "cancelled";
|
|
807
|
+
/** Agent result (from completed job) */
|
|
808
|
+
interface AgentResultResponse {
|
|
809
|
+
/** Extracted/collected data (matches provided schema if given) */
|
|
810
|
+
data: Record<string, unknown>;
|
|
811
|
+
/** Steps executed by the agent */
|
|
812
|
+
steps: AgentStepResponse[];
|
|
813
|
+
/** Final URL after all navigation */
|
|
814
|
+
finalUrl: string;
|
|
815
|
+
/** Credits/tokens used */
|
|
816
|
+
creditsUsed: number;
|
|
817
|
+
/** Total execution time in ms */
|
|
818
|
+
totalDurationMs: number;
|
|
819
|
+
/** Screenshots captured (if takeScreenshots enabled) */
|
|
820
|
+
screenshots?: string[];
|
|
821
|
+
/** Completion reason */
|
|
822
|
+
completionReason: AgentCompletionReason;
|
|
823
|
+
/** Agent metadata */
|
|
824
|
+
metadata: {
|
|
825
|
+
model: string;
|
|
826
|
+
stepsExecuted: number;
|
|
827
|
+
tokensUsed?: number;
|
|
828
|
+
timestamp: string;
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
/** Agent status response (extended from JobStatusResponse) */
|
|
832
|
+
interface AgentStatusResponse extends JobStatusResponse {
|
|
833
|
+
/** Partial result with steps so far */
|
|
834
|
+
partialResult?: {
|
|
835
|
+
steps: AgentStepResponse[];
|
|
836
|
+
currentUrl?: string;
|
|
837
|
+
extractedData?: Record<string, unknown>;
|
|
838
|
+
};
|
|
839
|
+
/** Final result when completed */
|
|
840
|
+
result?: AgentResultResponse;
|
|
841
|
+
}
|
|
842
|
+
/** Schema generation response from /v1/agent/schema */
|
|
843
|
+
interface SchemaGenerationResponse {
|
|
844
|
+
/** Generated JSON Schema for data extraction */
|
|
845
|
+
schema: Record<string, unknown>;
|
|
846
|
+
/** Refined prompt optimized for agent execution */
|
|
847
|
+
refinedPrompt: string;
|
|
848
|
+
/** Human-readable description of the schema */
|
|
849
|
+
schemaDescription: string;
|
|
850
|
+
/** Suggested follow-up questions if prompt was ambiguous */
|
|
851
|
+
suggestedQuestions?: string[];
|
|
852
|
+
/** Confidence score (0-1) in the generated schema */
|
|
853
|
+
confidence: number;
|
|
854
|
+
}
|
|
779
855
|
|
|
780
856
|
/**
|
|
781
857
|
* Polling Utilities
|
|
@@ -1197,7 +1273,7 @@ interface UpdateWebhookOptions {
|
|
|
1197
1273
|
* API key scope - Must match @dealcrawl/shared/src/types/api-key.types.ts
|
|
1198
1274
|
* These are the actual scopes enforced by the backend via requireScope() middleware
|
|
1199
1275
|
*/
|
|
1200
|
-
type ApiKeyScope = "scrape" | "crawl" | "dork" | "extract" | "status" | "data:read" | "data:export" | "keys:manage" | "webhooks:manage";
|
|
1276
|
+
type ApiKeyScope = "scrape" | "crawl" | "dork" | "extract" | "agent" | "status" | "data:read" | "data:export" | "keys:manage" | "webhooks:manage";
|
|
1201
1277
|
/**
|
|
1202
1278
|
* All available scopes (for reference and validation)
|
|
1203
1279
|
*/
|
|
@@ -1250,6 +1326,131 @@ interface UpdatePreferencesOptions {
|
|
|
1250
1326
|
/** Enable webhook notifications */
|
|
1251
1327
|
webhookEnabled?: boolean;
|
|
1252
1328
|
}
|
|
1329
|
+
/** LLM provider for agent */
|
|
1330
|
+
type AgentModel = "openai" | "anthropic";
|
|
1331
|
+
/** Browser action types */
|
|
1332
|
+
type AgentActionType = "click" | "scroll" | "write" | "wait" | "press" | "screenshot" | "hover" | "select";
|
|
1333
|
+
/** Base action interface */
|
|
1334
|
+
interface BaseAgentAction {
|
|
1335
|
+
type: AgentActionType;
|
|
1336
|
+
optional?: boolean;
|
|
1337
|
+
retries?: number;
|
|
1338
|
+
delayBefore?: number;
|
|
1339
|
+
}
|
|
1340
|
+
/** Click action */
|
|
1341
|
+
interface ClickAction extends BaseAgentAction {
|
|
1342
|
+
type: "click";
|
|
1343
|
+
selector: string;
|
|
1344
|
+
waitAfter?: number;
|
|
1345
|
+
button?: "left" | "right" | "middle";
|
|
1346
|
+
clickCount?: number;
|
|
1347
|
+
force?: boolean;
|
|
1348
|
+
}
|
|
1349
|
+
/** Scroll action */
|
|
1350
|
+
interface ScrollAction extends BaseAgentAction {
|
|
1351
|
+
type: "scroll";
|
|
1352
|
+
direction: "up" | "down" | "left" | "right" | "to-element";
|
|
1353
|
+
selector?: string;
|
|
1354
|
+
amount?: number;
|
|
1355
|
+
smooth?: boolean;
|
|
1356
|
+
}
|
|
1357
|
+
/** Write action */
|
|
1358
|
+
interface WriteAction extends BaseAgentAction {
|
|
1359
|
+
type: "write";
|
|
1360
|
+
selector: string;
|
|
1361
|
+
text: string;
|
|
1362
|
+
clearFirst?: boolean;
|
|
1363
|
+
pressEnter?: boolean;
|
|
1364
|
+
typeDelay?: number;
|
|
1365
|
+
}
|
|
1366
|
+
/** Wait action */
|
|
1367
|
+
interface WaitAction extends BaseAgentAction {
|
|
1368
|
+
type: "wait";
|
|
1369
|
+
milliseconds?: number;
|
|
1370
|
+
selector?: string;
|
|
1371
|
+
condition?: "visible" | "hidden" | "attached" | "detached";
|
|
1372
|
+
timeout?: number;
|
|
1373
|
+
}
|
|
1374
|
+
/** Press action */
|
|
1375
|
+
interface PressAction extends BaseAgentAction {
|
|
1376
|
+
type: "press";
|
|
1377
|
+
key: string;
|
|
1378
|
+
modifiers?: Array<"Alt" | "Control" | "Meta" | "Shift">;
|
|
1379
|
+
}
|
|
1380
|
+
/** Screenshot action */
|
|
1381
|
+
interface ScreenshotAgentAction extends BaseAgentAction {
|
|
1382
|
+
type: "screenshot";
|
|
1383
|
+
fullPage?: boolean;
|
|
1384
|
+
selector?: string;
|
|
1385
|
+
format?: "png" | "jpeg";
|
|
1386
|
+
quality?: number;
|
|
1387
|
+
name?: string;
|
|
1388
|
+
}
|
|
1389
|
+
/** Hover action */
|
|
1390
|
+
interface HoverAction extends BaseAgentAction {
|
|
1391
|
+
type: "hover";
|
|
1392
|
+
selector: string;
|
|
1393
|
+
duration?: number;
|
|
1394
|
+
}
|
|
1395
|
+
/** Select action */
|
|
1396
|
+
interface SelectAction extends BaseAgentAction {
|
|
1397
|
+
type: "select";
|
|
1398
|
+
selector: string;
|
|
1399
|
+
value: string | string[];
|
|
1400
|
+
byLabel?: boolean;
|
|
1401
|
+
}
|
|
1402
|
+
/** All agent action types */
|
|
1403
|
+
type AgentAction = ClickAction | ScrollAction | WriteAction | WaitAction | PressAction | ScreenshotAgentAction | HoverAction | SelectAction;
|
|
1404
|
+
/** Options for creating an AI agent job */
|
|
1405
|
+
interface AgentOptions {
|
|
1406
|
+
/** Starting URL for the agent (required) */
|
|
1407
|
+
url: string;
|
|
1408
|
+
/** Additional URLs to process */
|
|
1409
|
+
urls?: string[];
|
|
1410
|
+
/** Natural language instructions for the agent (required, 10-2000 chars) */
|
|
1411
|
+
prompt: string;
|
|
1412
|
+
/** JSON Schema for structured output */
|
|
1413
|
+
schema?: Record<string, unknown>;
|
|
1414
|
+
/** Maximum number of steps (default: 10, max: 25) */
|
|
1415
|
+
maxSteps?: number;
|
|
1416
|
+
/** Preset actions to execute before agent reasoning */
|
|
1417
|
+
actions?: AgentAction[];
|
|
1418
|
+
/** LLM provider (default: openai) */
|
|
1419
|
+
model?: AgentModel;
|
|
1420
|
+
/** Per-step timeout in milliseconds (default: 30000, max: 60000) */
|
|
1421
|
+
timeout?: number;
|
|
1422
|
+
/** Extract only main content area (default: true) */
|
|
1423
|
+
onlyMainContent?: boolean;
|
|
1424
|
+
/** Take screenshots at each step (default: false) */
|
|
1425
|
+
takeScreenshots?: boolean;
|
|
1426
|
+
/** Custom headers for HTTP requests */
|
|
1427
|
+
headers?: Record<string, string>;
|
|
1428
|
+
/** Webhook for async notification */
|
|
1429
|
+
webhook?: {
|
|
1430
|
+
url: string;
|
|
1431
|
+
headers?: Record<string, string>;
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
/** Context for schema generation from conversation */
|
|
1435
|
+
interface SchemaGenerationContext {
|
|
1436
|
+
/** Specific domains/topics mentioned (e.g., ['marketing', 'web development']) */
|
|
1437
|
+
domains?: string[];
|
|
1438
|
+
/** Types of data to extract (e.g., ['free courses', 'discounts']) */
|
|
1439
|
+
dataTypes?: string[];
|
|
1440
|
+
/** Preferred output format */
|
|
1441
|
+
format?: "json" | "csv" | "table";
|
|
1442
|
+
/** Additional clarifications from user */
|
|
1443
|
+
clarifications?: string[];
|
|
1444
|
+
}
|
|
1445
|
+
/** Options for generating a JSON Schema from natural language */
|
|
1446
|
+
interface SchemaGenerationOptions {
|
|
1447
|
+
/** Natural language description of what data to extract (required, 5-2000 chars) */
|
|
1448
|
+
prompt: string;
|
|
1449
|
+
/** Optional context from conversation to refine the schema */
|
|
1450
|
+
context?: SchemaGenerationContext;
|
|
1451
|
+
/** LLM provider for generation (default: openai) */
|
|
1452
|
+
model?: AgentModel;
|
|
1453
|
+
}
|
|
1253
1454
|
|
|
1254
1455
|
/**
|
|
1255
1456
|
* Account Resource
|
|
@@ -1392,6 +1593,208 @@ declare class AccountResource {
|
|
|
1392
1593
|
isPremium(): Promise<boolean>;
|
|
1393
1594
|
}
|
|
1394
1595
|
|
|
1596
|
+
/**
|
|
1597
|
+
* Agent Resource
|
|
1598
|
+
* Handles AI agent operations for autonomous web navigation and data extraction
|
|
1599
|
+
*/
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* Agent resource class
|
|
1603
|
+
* Provides methods for creating and managing AI agent jobs
|
|
1604
|
+
*
|
|
1605
|
+
* The agent uses the ReAct pattern (Observation → Thought → Action → Evaluation)
|
|
1606
|
+
* to navigate web pages and extract structured data based on natural language instructions.
|
|
1607
|
+
*
|
|
1608
|
+
* @example
|
|
1609
|
+
* ```ts
|
|
1610
|
+
* // Create an agent to search and extract product info
|
|
1611
|
+
* const job = await client.agent.create({
|
|
1612
|
+
* url: "https://amazon.com",
|
|
1613
|
+
* prompt: "Search for wireless headphones under $50 and extract the top 5 results with name, price, and rating",
|
|
1614
|
+
* schema: {
|
|
1615
|
+
* type: "object",
|
|
1616
|
+
* properties: {
|
|
1617
|
+
* products: {
|
|
1618
|
+
* type: "array",
|
|
1619
|
+
* items: {
|
|
1620
|
+
* type: "object",
|
|
1621
|
+
* properties: {
|
|
1622
|
+
* name: { type: "string" },
|
|
1623
|
+
* price: { type: "number" },
|
|
1624
|
+
* rating: { type: "number" }
|
|
1625
|
+
* }
|
|
1626
|
+
* }
|
|
1627
|
+
* }
|
|
1628
|
+
* }
|
|
1629
|
+
* },
|
|
1630
|
+
* maxSteps: 15
|
|
1631
|
+
* });
|
|
1632
|
+
*
|
|
1633
|
+
* // Wait for result
|
|
1634
|
+
* const result = await client.waitForResult(job.jobId);
|
|
1635
|
+
* ```
|
|
1636
|
+
*/
|
|
1637
|
+
declare class AgentResource {
|
|
1638
|
+
private ctx;
|
|
1639
|
+
constructor(ctx: RequestContext);
|
|
1640
|
+
/**
|
|
1641
|
+
* Create a new AI agent job
|
|
1642
|
+
*
|
|
1643
|
+
* @param options - Agent configuration options
|
|
1644
|
+
* @returns Job creation response with jobId and status URL
|
|
1645
|
+
*
|
|
1646
|
+
* @example
|
|
1647
|
+
* ```ts
|
|
1648
|
+
* const job = await client.agent.create({
|
|
1649
|
+
* url: "https://booking.com",
|
|
1650
|
+
* prompt: "Find hotels in Paris for 2 adults, March 15-17, sort by price and extract the 3 cheapest options",
|
|
1651
|
+
* maxSteps: 20,
|
|
1652
|
+
* takeScreenshots: true
|
|
1653
|
+
* });
|
|
1654
|
+
* ```
|
|
1655
|
+
*/
|
|
1656
|
+
create(options: AgentOptions): Promise<AgentJobResponse>;
|
|
1657
|
+
/**
|
|
1658
|
+
* Get the status of an agent job
|
|
1659
|
+
*
|
|
1660
|
+
* @param jobId - The job ID to check
|
|
1661
|
+
* @returns Agent status with progress and partial results
|
|
1662
|
+
*
|
|
1663
|
+
* @example
|
|
1664
|
+
* ```ts
|
|
1665
|
+
* const status = await client.agent.getStatus(jobId);
|
|
1666
|
+
* console.log(`Step ${status.partialResult?.steps.length}/${status.totalSteps}`);
|
|
1667
|
+
* ```
|
|
1668
|
+
*/
|
|
1669
|
+
getStatus(jobId: string): Promise<AgentStatusResponse>;
|
|
1670
|
+
/**
|
|
1671
|
+
* Create an agent with preset actions
|
|
1672
|
+
* Useful for handling common scenarios like cookie consent, popups, etc.
|
|
1673
|
+
*
|
|
1674
|
+
* @example
|
|
1675
|
+
* ```ts
|
|
1676
|
+
* const job = await client.agent.withPresetActions(
|
|
1677
|
+
* "https://shop.com",
|
|
1678
|
+
* "Find the best discount and extract product details",
|
|
1679
|
+
* [
|
|
1680
|
+
* { type: "click", selector: "#accept-cookies" },
|
|
1681
|
+
* { type: "wait", milliseconds: 1000 }
|
|
1682
|
+
* ]
|
|
1683
|
+
* );
|
|
1684
|
+
* ```
|
|
1685
|
+
*/
|
|
1686
|
+
withPresetActions(url: string, prompt: string, actions: AgentOptions["actions"], options?: Omit<AgentOptions, "url" | "prompt" | "actions">): Promise<AgentJobResponse>;
|
|
1687
|
+
/**
|
|
1688
|
+
* Create an agent with a JSON schema for structured output
|
|
1689
|
+
* The agent will extract data matching the provided schema
|
|
1690
|
+
*
|
|
1691
|
+
* @example
|
|
1692
|
+
* ```ts
|
|
1693
|
+
* const job = await client.agent.withSchema(
|
|
1694
|
+
* "https://linkedin.com/company/example",
|
|
1695
|
+
* "Extract company information",
|
|
1696
|
+
* {
|
|
1697
|
+
* type: "object",
|
|
1698
|
+
* properties: {
|
|
1699
|
+
* name: { type: "string" },
|
|
1700
|
+
* employees: { type: "number" },
|
|
1701
|
+
* description: { type: "string" },
|
|
1702
|
+
* website: { type: "string" }
|
|
1703
|
+
* },
|
|
1704
|
+
* required: ["name"]
|
|
1705
|
+
* }
|
|
1706
|
+
* );
|
|
1707
|
+
* ```
|
|
1708
|
+
*/
|
|
1709
|
+
withSchema(url: string, prompt: string, schema: Record<string, unknown>, options?: Omit<AgentOptions, "url" | "prompt" | "schema">): Promise<AgentJobResponse>;
|
|
1710
|
+
/**
|
|
1711
|
+
* Create an agent optimized for deal/product extraction
|
|
1712
|
+
* Pre-configured for e-commerce scenarios
|
|
1713
|
+
*
|
|
1714
|
+
* @example
|
|
1715
|
+
* ```ts
|
|
1716
|
+
* const job = await client.agent.forDeals(
|
|
1717
|
+
* "https://slickdeals.net",
|
|
1718
|
+
* "Find the top 10 tech deals posted today"
|
|
1719
|
+
* );
|
|
1720
|
+
* ```
|
|
1721
|
+
*/
|
|
1722
|
+
forDeals(url: string, prompt: string, options?: Omit<AgentOptions, "url" | "prompt" | "schema">): Promise<AgentJobResponse>;
|
|
1723
|
+
/**
|
|
1724
|
+
* Create an agent to fill and submit a form
|
|
1725
|
+
* Useful for search forms, login forms, etc.
|
|
1726
|
+
*
|
|
1727
|
+
* @example
|
|
1728
|
+
* ```ts
|
|
1729
|
+
* const job = await client.agent.fillForm(
|
|
1730
|
+
* "https://kayak.com",
|
|
1731
|
+
* "Search for flights from Paris to New York on March 20, return March 27",
|
|
1732
|
+
* { takeScreenshots: true }
|
|
1733
|
+
* );
|
|
1734
|
+
* ```
|
|
1735
|
+
*/
|
|
1736
|
+
fillForm(url: string, instructions: string, options?: Omit<AgentOptions, "url" | "prompt">): Promise<AgentJobResponse>;
|
|
1737
|
+
/**
|
|
1738
|
+
* Create an agent using Claude (Anthropic) instead of GPT
|
|
1739
|
+
*
|
|
1740
|
+
* @example
|
|
1741
|
+
* ```ts
|
|
1742
|
+
* const job = await client.agent.withClaude(
|
|
1743
|
+
* "https://complex-site.com",
|
|
1744
|
+
* "Navigate through the multi-step checkout process"
|
|
1745
|
+
* );
|
|
1746
|
+
* ```
|
|
1747
|
+
*/
|
|
1748
|
+
withClaude(url: string, prompt: string, options?: Omit<AgentOptions, "url" | "prompt" | "model">): Promise<AgentJobResponse>;
|
|
1749
|
+
/**
|
|
1750
|
+
* Generate a JSON Schema from a natural language prompt
|
|
1751
|
+
*
|
|
1752
|
+
* This is useful for building extraction schemas without manual JSON writing.
|
|
1753
|
+
* The generated schema can be used with the main agent.create() method.
|
|
1754
|
+
*
|
|
1755
|
+
* @param options - Schema generation options
|
|
1756
|
+
* @returns Generated schema with refined prompt and confidence score
|
|
1757
|
+
*
|
|
1758
|
+
* @example Basic usage:
|
|
1759
|
+
* ```ts
|
|
1760
|
+
* const result = await client.agent.generateSchema({
|
|
1761
|
+
* prompt: "Find the best student deals on Coursera for marketing courses"
|
|
1762
|
+
* });
|
|
1763
|
+
*
|
|
1764
|
+
* console.log(result.schema);
|
|
1765
|
+
* // { type: "object", properties: { courses: { ... } } }
|
|
1766
|
+
*
|
|
1767
|
+
* console.log(result.refinedPrompt);
|
|
1768
|
+
* // "Extract student offers for marketing courses..."
|
|
1769
|
+
*
|
|
1770
|
+
* // Use the generated schema with an agent
|
|
1771
|
+
* const job = await client.agent.create({
|
|
1772
|
+
* url: "https://coursera.org",
|
|
1773
|
+
* prompt: result.refinedPrompt,
|
|
1774
|
+
* schema: result.schema
|
|
1775
|
+
* });
|
|
1776
|
+
* ```
|
|
1777
|
+
*
|
|
1778
|
+
* @example With context from conversation:
|
|
1779
|
+
* ```ts
|
|
1780
|
+
* const result = await client.agent.generateSchema({
|
|
1781
|
+
* prompt: "Find student deals on online courses",
|
|
1782
|
+
* context: {
|
|
1783
|
+
* domains: ["marketing", "web development"],
|
|
1784
|
+
* dataTypes: ["free courses", "discounts"],
|
|
1785
|
+
* format: "json"
|
|
1786
|
+
* }
|
|
1787
|
+
* });
|
|
1788
|
+
*
|
|
1789
|
+
* if (result.confidence < 0.7 && result.suggestedQuestions) {
|
|
1790
|
+
* // Ask user for clarification
|
|
1791
|
+
* console.log("Please clarify:", result.suggestedQuestions);
|
|
1792
|
+
* }
|
|
1793
|
+
* ```
|
|
1794
|
+
*/
|
|
1795
|
+
generateSchema(options: SchemaGenerationOptions): Promise<SchemaGenerationResponse>;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1395
1798
|
/**
|
|
1396
1799
|
* Crawl Resource
|
|
1397
1800
|
* Handles website crawling operations
|
|
@@ -2504,6 +2907,29 @@ declare class DealCrawl {
|
|
|
2504
2907
|
* ```
|
|
2505
2908
|
*/
|
|
2506
2909
|
readonly dork: DorkResource;
|
|
2910
|
+
/**
|
|
2911
|
+
* Agent resource - AI-powered autonomous web navigation
|
|
2912
|
+
*
|
|
2913
|
+
* The agent uses ReAct pattern (Observation → Thought → Action → Evaluation)
|
|
2914
|
+
* to navigate web pages and extract structured data based on natural language.
|
|
2915
|
+
*
|
|
2916
|
+
* @example
|
|
2917
|
+
* ```ts
|
|
2918
|
+
* const job = await client.agent.create({
|
|
2919
|
+
* url: "https://amazon.com",
|
|
2920
|
+
* prompt: "Search for wireless headphones under $50 and extract top 5 results",
|
|
2921
|
+
* maxSteps: 15
|
|
2922
|
+
* });
|
|
2923
|
+
*
|
|
2924
|
+
* // With schema for structured output
|
|
2925
|
+
* const job = await client.agent.withSchema(
|
|
2926
|
+
* "https://example.com",
|
|
2927
|
+
* "Extract product info",
|
|
2928
|
+
* { type: "object", properties: {...} }
|
|
2929
|
+
* );
|
|
2930
|
+
* ```
|
|
2931
|
+
*/
|
|
2932
|
+
readonly agent: AgentResource;
|
|
2507
2933
|
/**
|
|
2508
2934
|
* Status resource - Job status management
|
|
2509
2935
|
*
|
|
@@ -2683,6 +3109,21 @@ declare class DealCrawl {
|
|
|
2683
3109
|
* ```
|
|
2684
3110
|
*/
|
|
2685
3111
|
searchAndWait(options: Parameters<SearchResource["create"]>[0]): Promise<ReturnType<SearchResource["create"]>>;
|
|
3112
|
+
/**
|
|
3113
|
+
* Create an agent job and wait for result
|
|
3114
|
+
* Combines create and waitForResult
|
|
3115
|
+
*
|
|
3116
|
+
* @example
|
|
3117
|
+
* ```ts
|
|
3118
|
+
* const result = await client.agentAndWait({
|
|
3119
|
+
* url: "https://booking.com",
|
|
3120
|
+
* prompt: "Find hotels in Paris for March 15-17",
|
|
3121
|
+
* maxSteps: 20
|
|
3122
|
+
* });
|
|
3123
|
+
* console.log(result.data);
|
|
3124
|
+
* ```
|
|
3125
|
+
*/
|
|
3126
|
+
agentAndWait<T = unknown>(options: Parameters<AgentResource["create"]>[0], waitOptions?: WaitOptions): Promise<WaitResult<T>>;
|
|
2686
3127
|
}
|
|
2687
3128
|
|
|
2688
3129
|
/**
|
|
@@ -2766,4 +3207,4 @@ declare class DealCrawlError extends Error {
|
|
|
2766
3207
|
}, retryAfter?: number | string | null): DealCrawlError;
|
|
2767
3208
|
}
|
|
2768
3209
|
|
|
2769
|
-
export { ALL_API_KEY_SCOPES, type AccountInfoResponse, type AccountMetricsResponse, AccountResource, type ApiError, type ApiKeyInfo, type ApiKeyScope, type ApiResponse, type BatchScrapeDefaults, type BatchScrapeItem, type BatchScrapeOptions, type BatchScrapeResponse, type BatchScrapeResultItem, type BatchStatusResponse, type CancelJobResponse, type CheckpointInfo, type ClientPreferences, type ClientStatsResponse, type CrawlAnalysisResponse, type CrawlJobResponse, type CrawlOptions, type CrawlRecommendation, CrawlResource, type CrawlResult, type CrawlTemplate, type CrawlTemplateId, type CreateApiKeyOptions, type CreateKeyResponse, type CreateWebhookOptions, type CreateWebhookResponse, type CreatedApiKey, DEFAULT_API_KEY_SCOPES, DEFAULT_CONFIG, DataResource, DealCrawl, type DealCrawlConfig, DealCrawlError, type DealDetails, type DealItem, type DealMetrics, type DealScoreSummary, type DealSummary, type DealUpMetrics, type DealUpMetricsResponse, type DeleteKeyResponse, type DeleteWebhookResponse, type DiscountSignal, type DorkJobResponse, type DorkOptions, DorkResource, type DorkResult, ERROR_CODES, type ErrorCode, type ExportDealsOptions, type ExportFormat, type ExportJobsOptions, type ExtractJobResponse, type ExtractModel, type ExtractOptions, ExtractResource, type ExtractedDeal, type GetApiKeyStatsOptions, type GetDealsOptions, type JobDealsResponse, type JobMetricsResponse, type JobResponse, type JobStatus, type JobStatusFilter, type JobStatusResponse, type JobSummary, type JobTypeFilter, type KeyStatsResponse, KeysResource, type ListApiKeysOptions, type ListDealsOptions, type ListDealsResponse, type ListJobsOptions, type ListJobsResponse, type ListKeysResponse, type ListWebhooksResponse, type PaginatedResponse, type PaginationInfo, type ParsedPage, type PreferencesResponse, type PriceSignal, type PricingInfo, type ProductCategory, type ProductInfo, type RateLimitInfo, type RecommendationsResponse, type RequestContext, type ResumeJobResponse, type RevokeApiKeyOptions, type RotateApiKeyOptions, type RotateKeyResponse, type ScrapeJobResponse, type ScrapeOptions, ScrapeResource, type ScrapeResult, type ScreenshotOptions, type SearchAiModel, type SearchAiProvider, type SearchData, type SearchDateRange, type SearchFilters, type SearchJobResponse, type SearchOptions, SearchResource, type SearchResultItem, type SearchStatusResponse, type Signal, type SortOrder, StatusResource, type TestWebhookResponse, type UpdatePreferencesOptions, type UpdatePreferencesResponse, type UpdateWebhookOptions, type UpdateWebhookResponse, type UsageStats, type WaitOptions, type WaitResult, type WebhookEvent, type WebhookItem, WebhooksResource, DealCrawl as default, pollUntil, waitForAll, waitForAny, waitForResult };
|
|
3210
|
+
export { ALL_API_KEY_SCOPES, type AccountInfoResponse, type AccountMetricsResponse, AccountResource, type AgentAction, type AgentActionType, type AgentCompletionReason, type AgentJobResponse, type AgentModel, type AgentOptions, AgentResource, type AgentResultResponse, type AgentStatusResponse, type AgentStepResponse, type ApiError, type ApiKeyInfo, type ApiKeyScope, type ApiResponse, type BatchScrapeDefaults, type BatchScrapeItem, type BatchScrapeOptions, type BatchScrapeResponse, type BatchScrapeResultItem, type BatchStatusResponse, type CancelJobResponse, type CheckpointInfo, type ClickAction, type ClientPreferences, type ClientStatsResponse, type CrawlAnalysisResponse, type CrawlJobResponse, type CrawlOptions, type CrawlRecommendation, CrawlResource, type CrawlResult, type CrawlTemplate, type CrawlTemplateId, type CreateApiKeyOptions, type CreateKeyResponse, type CreateWebhookOptions, type CreateWebhookResponse, type CreatedApiKey, DEFAULT_API_KEY_SCOPES, DEFAULT_CONFIG, DataResource, DealCrawl, type DealCrawlConfig, DealCrawlError, type DealDetails, type DealItem, type DealMetrics, type DealScoreSummary, type DealSummary, type DealUpMetrics, type DealUpMetricsResponse, type DeleteKeyResponse, type DeleteWebhookResponse, type DiscountSignal, type DorkJobResponse, type DorkOptions, DorkResource, type DorkResult, ERROR_CODES, type ErrorCode, type ExportDealsOptions, type ExportFormat, type ExportJobsOptions, type ExtractJobResponse, type ExtractModel, type ExtractOptions, ExtractResource, type ExtractedDeal, type GetApiKeyStatsOptions, type GetDealsOptions, type HoverAction, type JobDealsResponse, type JobMetricsResponse, type JobResponse, type JobStatus, type JobStatusFilter, type JobStatusResponse, type JobSummary, type JobTypeFilter, type KeyStatsResponse, KeysResource, type ListApiKeysOptions, type ListDealsOptions, type ListDealsResponse, type ListJobsOptions, type ListJobsResponse, type ListKeysResponse, type ListWebhooksResponse, type PaginatedResponse, type PaginationInfo, type ParsedPage, type PreferencesResponse, type PressAction, type PriceSignal, type PricingInfo, type ProductCategory, type ProductInfo, type RateLimitInfo, type RecommendationsResponse, type RequestContext, type ResumeJobResponse, type RevokeApiKeyOptions, type RotateApiKeyOptions, type RotateKeyResponse, type ScrapeJobResponse, type ScrapeOptions, ScrapeResource, type ScrapeResult, type ScreenshotAgentAction, type ScreenshotOptions, type ScrollAction, type SearchAiModel, type SearchAiProvider, type SearchData, type SearchDateRange, type SearchFilters, type SearchJobResponse, type SearchOptions, SearchResource, type SearchResultItem, type SearchStatusResponse, type SelectAction, type Signal, type SortOrder, StatusResource, type TestWebhookResponse, type UpdatePreferencesOptions, type UpdatePreferencesResponse, type UpdateWebhookOptions, type UpdateWebhookResponse, type UsageStats, type WaitAction, type WaitOptions, type WaitResult, type WebhookEvent, type WebhookItem, WebhooksResource, type WriteAction, DealCrawl as default, pollUntil, waitForAll, waitForAny, waitForResult };
|