Skip to main content

Crate spider_agent_types

Crate spider_agent_types 

Source
Expand description

§Spider Agent Types

Pure data types and constants for spider_agent automation.

This crate contains all the type definitions, system prompts, and helper utilities extracted from spider_agent that have minimal dependencies. Use this crate when you need automation types without the full agent runtime.

§Dependencies

Only serde, serde_json, aho-corasick, and llm_models_spider — no heavy runtime deps like tokio, reqwest, dashmap, or chromey.

§Feature Highlights

  • Action types and results
  • Page observation and interactive element types
  • Chain execution types (sync data structures)
  • Confidence tracking
  • Configuration types (AutomationConfig, RemoteMultimodalConfig)
  • Content analysis (with aho-corasick)
  • HTML diff types
  • Memory operations
  • Planning types
  • System prompt constants
  • Schema generation types
  • Self-healing selector types
  • Synthesis types
  • Tool calling types
  • JSON/text helper utilities

Modules§

categories
URL category constants.

Structs§

ActResult
Result of a single action execution via act().
ActionRecord
Record of an action taken during automation.
ActionResult
Result of an action execution.
ActionToolSchemas
Generator for automation action tool schemas.
Alternative
An alternative action with its confidence score.
AutomationConfig
Main automation configuration.
AutomationMemory
In-memory storage for agentic automation sessions.
AutomationResult
Result of an automation operation.
AutomationUsage
Token usage tracking for automation operations with granular call tracking.
CaptureProfile
Capture profile for screenshots and HTML.
ChainBuilder
Builder for creating action chains.
ChainContext
Context for evaluating chain conditions.
ChainResult
Result of an action chain execution.
ChainStep
A single step in an action chain.
ChainStepResult
Result of a single step in an action chain.
Checkpoint
A checkpoint condition to verify after a step.
CheckpointResult
Result of a checkpoint verification.
ClipViewport
Clip viewport for screenshots.
ConcurrentChainConfig
Configuration for concurrent chain execution.
ConcurrentChainResult
Result of executing a concurrent chain.
ConfidenceRetryStrategy
Strategy for retrying based on confidence.
ConfidenceSummary
Summary of confidence statistics.
ConfidenceTracker
Tracker for confidence statistics across an automation session.
ConfidentStep
A step with confidence score and alternatives.
ContentAnalysis
Result of analyzing HTML content.
DependencyGraph
Dependency graph for managing step execution order.
DependentStep
A step in a dependency chain.
DiffStats
Statistics about HTML diff performance.
DiscoveredUrl
A discovered URL with AI-generated metadata.
ElementChange
A single element change.
ExecutionPlan
An execution plan from the LLM.
ExtractionSchema
Schema for structured data extraction.
FormField
A field in a form.
FormInfo
Information about a form on the page.
FunctionCall
A function call from the LLM.
FunctionDefinition
OpenAI-compatible function definition.
GeneratedSchema
A generated JSON schema.
HealedSelectorCache
Cache for healed selectors.
HealingDiagnosis
Diagnosis and suggested fix from the LLM.
HealingRequest
A request to heal a failed selector.
HealingResult
Result of a healing attempt.
HealingStats
Statistics about healing operations.
HtmlDiffResult
Result of computing an HTML diff.
InteractiveElement
An interactive element on the page.
MapResult
Result of the map() API call for page discovery.
ModelCapabilities
Re-exports from llm_models_spider for auto-updated model intelligence.
ModelEndpoint
A model endpoint override for dual-model routing.
ModelInfoEntry
Re-exports from llm_models_spider for auto-updated model intelligence.
ModelPolicy
Policy for selecting models based on cost/quality tradeoffs.
ModelPricing
Re-exports from llm_models_spider for auto-updated model intelligence.
ModelProfile
Re-exports from llm_models_spider for auto-updated model intelligence.
ModelRanks
Re-exports from llm_models_spider for auto-updated model intelligence.
MultiPageContext
Multi-page context for synthesis.
NavigationOption
A navigation option on the page.
PageContext
Context for a single page in multi-page synthesis.
PageContribution
Contribution of a single page to the synthesis.
PageObservation
Observation of a page’s current state.
PageState
Current page state for re-planning context.
PageStateDiff
Tracker for page state changes across rounds.
PlanExecutionState
State of plan execution.
PlannedStep
A single step in an execution plan.
PlanningModeConfig
Configuration for planning mode.
PromptUrlGate
URL-based prompt gating for per-URL config overrides.
RemoteMultimodalConfig
Runtime configuration for RemoteMultimodalEngine.
ReplanContext
Context for re-planning after a failure.
RetryPolicy
Retry policy for automation operations.
SchemaCache
Cache for generated schemas.
SchemaGenerationRequest
Request to generate a schema from examples.
SelectorCache
Self-healing selector cache.
SelectorCacheEntry
A single entry in the selector cache.
SelfHealingConfig
Configuration for self-healing behavior.
StepResult
Result of executing a single step.
StructuredOutputConfig
Configuration for structured output mode.
SynthesisConfig
Configuration for multi-page synthesis.
SynthesisResult
Result of multi-page synthesis.
ToolCall
A tool call from the LLM response.
ToolDefinition
OpenAI-compatible tool definition.
Verification
Verification to run after an action.

Enums§

ActionType
Types of actions that can be performed.
ChainCondition
Condition for conditional execution in action chains.
ChangeType
Type of change to an element.
CheckpointType
Type of checkpoint verification.
CleaningIntent
Intent for HTML cleaning decisions.
CostTier
Cost tier for model selection.
HtmlCleaningProfile
HTML cleaning profile for content processing.
HtmlDiffMode
Mode for HTML diffing.
MemoryOperation
Memory operation requested by the LLM.
ReasoningEffort
Reasoning effort level for models that support explicit reasoning controls.
RecoveryStrategy
Recovery strategy for handling failures during automation.
SelectorIssueType
Types of selector issues.
ToolCallingMode
Mode for how actions should be formatted in LLM requests.
VerificationType
Types of verification checks.
VisionRouteMode
Routing mode that decides when to use the vision vs text model.

Constants§

ACT_SYSTEM_PROMPT
System prompt for the act() single-action API.
CHROME_AI_SYSTEM_PROMPT
Compact system prompt for Chrome’s built-in LanguageModel (Gemini Nano).
CONFIGURATION_SYSTEM_PROMPT
System prompt for configuring a web crawler from natural language.
DEFAULT_SYSTEM_PROMPT
Default system prompt for web automation (iterative). This is the foundation for all web automation tasks - kept lean with core action bindings and agentic reasoning only. Challenge-specific strategies should be injected via system_prompt_extra or skill modules.
EXTRACTION_ONLY_SYSTEM_PROMPT
Focused system prompt for extraction-only mode (extra_ai_data=true, max_rounds<=1).
EXTRACT_SYSTEM_PROMPT
System prompt for the extract() data extraction API.
MAP_SYSTEM_PROMPT
System prompt for the map() URL discovery API.
MODEL_INFO
Re-exports from llm_models_spider for auto-updated model intelligence.
OBSERVE_SYSTEM_PROMPT
System prompt for the observe() page understanding API.

Functions§

arena_rank
Re-exports from llm_models_spider for auto-updated model intelligence.
build_schema_generation_prompt
Build a prompt for LLM-assisted schema generation.
extract_assistant_content
Extract the assistant’s text content from an OpenAI-compatible response.
extract_html_context
Extract HTML context around a selector’s expected location.
extract_last_code_block
Extract the LAST json or ``` code block from text.
extract_last_json_array
Extract the last JSON array from text with proper brace matching.
extract_last_json_boundaries
Extract the last balanced JSON object or array from text.
extract_last_json_object
Extract the last JSON object from text with proper brace matching.
extract_usage
Extract token usage from an OpenAI-compatible response.
fnv1a64
FNV-1a 64-bit hash function for cheap content hashing.
generate_schema
Generate a schema from a request.
infer_schema
Infer a JSON schema from a value.
infer_schema_from_examples
Infer a schema from multiple examples, merging field information.
is_url_allowed
Check if a URL is allowed by the gate.
merged_config
Merge a base config with an override config.
model_profile
Re-exports from llm_models_spider for auto-updated model intelligence.
parse_tool_calls
Parse tool calls from an OpenAI-compatible response.
reasoning_payload
Build a provider-compatible reasoning payload when configured.
refine_schema
Refine a schema by adding more examples.
supports_pdf
Re-exports from llm_models_spider for auto-updated model intelligence.
supports_video
Re-exports from llm_models_spider for auto-updated model intelligence.
supports_vision
Re-exports from llm_models_spider for auto-updated model intelligence.
tool_calls_to_steps
Convert tool calls to automation step actions.
truncate_utf8_tail
Take the last max_bytes of a UTF-8 string without splitting code points.