spider_agent_types 2.45.7

Pure data types and constants for spider_agent automation. Zero heavy dependencies.
Documentation

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 TypesActionType (30+ variants), ActionResult, ActionRecord
  • Chain ExecutionChainStep, ChainCondition, ChainBuilder for sequential action chains
  • Concurrent ChainsDependencyGraph, DependentStep for parallel execution with dependency ordering
  • Confidence TrackingConfidenceTracker, ConfidenceRetryStrategy for smarter retry decisions
  • ConfigurationRemoteMultimodalConfig, AutomationConfig, ModelProfile, ModelCapabilities
  • Content AnalysisContentAnalysis with aho-corasick for fast HTML structure detection
  • HTML DiffPageStateDiff, HtmlDiffResult for 50-70% token reduction between rounds
  • Memory OperationsAutomationMemory, MemoryOperation for session state
  • Page ObservationPageObservation, InteractiveElement, FormInfo
  • PlanningPlanningModeConfig, ExecutionPlan, PlannedStep with checkpoints
  • System PromptsDEFAULT_SYSTEM_PROMPT, CHROME_AI_SYSTEM_PROMPT, and 6 more
  • Schema Generationgenerate_schema(), infer_schema(), SchemaCache
  • Selector CacheSelectorCache with LRU eviction and reliability scoring
  • Self-HealingSelfHealingConfig, HealingRequest, HealedSelectorCache
  • SynthesisSynthesisConfig, MultiPageContext for multi-page analysis
  • Tool CallingToolCallingMode, 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