49 stable releases
| new 2.47.19 | Mar 14, 2026 |
|---|---|
| 2.47.18 | Mar 13, 2026 |
| 2.45.25 | Feb 23, 2026 |
#443 in Data structures
3,950 downloads per month
Used in 19 crates
(3 directly)
400KB
9K
SLoC
Spider Agent Types
Pure data types and constants for spider_agent automation with zero heavy runtime dependencies.
Overview
This crate extracts all type definitions, system prompts, and helper utilities from spider_agent into a lightweight, dependency-minimal package. Use it when you need automation types without the full agent runtime (no tokio, reqwest, dashmap, or chromey).
Installation
[dependencies]
spider_agent_types = "0.1"
What's Included
- Action Types —
ActionType(30+ variants),ActionResult,ActionRecord - Chain Execution —
ChainStep,ChainCondition,ChainBuilderfor sequential action chains - Concurrent Chains —
DependencyGraph,DependentStepfor parallel execution with dependency ordering - Confidence Tracking —
ConfidenceTracker,ConfidenceRetryStrategyfor smarter retry decisions - Configuration —
RemoteMultimodalConfig,AutomationConfig,ModelProfile,ModelCapabilities - Content Analysis —
ContentAnalysiswith aho-corasick for fast HTML structure detection - HTML Diff —
PageStateDiff,HtmlDiffResultfor 50-70% token reduction between rounds - Memory Operations —
AutomationMemory,MemoryOperationfor session state - Page Observation —
PageObservation,InteractiveElement,FormInfo - Planning —
PlanningModeConfig,ExecutionPlan,PlannedStepwith checkpoints - System Prompts —
DEFAULT_SYSTEM_PROMPT,CHROME_AI_SYSTEM_PROMPT, and 6 more - Schema Generation —
generate_schema(),infer_schema(),SchemaCache - Selector Cache —
SelectorCachewith LRU eviction and reliability scoring - Self-Healing —
SelfHealingConfig,HealingRequest,HealedSelectorCache - Synthesis —
SynthesisConfig,MultiPageContextfor multi-page analysis - Tool Calling —
ToolCallingMode,ToolDefinition,parse_tool_calls()for OpenAI-compatible function calling - Helpers — JSON extraction, LLM response parsing, FNV hashing, UTF-8 truncation
Quick Start
use spider_agent_types::{
ActionType, AutomationConfig, RemoteMultimodalConfig,
ToolCallingMode, HtmlDiffMode, ContentAnalysis,
};
// Create automation config
let config = AutomationConfig::new("Extract product data");
// Analyze HTML content
let analysis = ContentAnalysis::analyze("<html>...</html>");
println!("Needs screenshot: {}", analysis.needs_screenshot);
println!("Text ratio: {:.1}%", analysis.text_ratio * 100.0);
// Parse LLM responses
use spider_agent_types::{extract_last_json_object, extract_assistant_content};
let json = extract_last_json_object(r#"Here is the result: {"name": "test"}"#);
Model Registry
Built-in model profiles for 40+ models with capabilities and pricing:
use spider_agent_types::{model_profile, supports_vision, MODEL_INFO};
if let Some(profile) = model_profile("gpt-4o") {
println!("Context: {} tokens", profile.context_window);
println!("Vision: {}", supports_vision("gpt-4o"));
}
Dependencies
| Crate | Purpose |
|---|---|
serde + serde_json |
Serialization |
aho-corasick |
Fast multi-pattern matching for content analysis |
llm_models_spider |
Model capabilities detection |
License
MIT
Dependencies
~1.4–2.5MB
~43K SLoC