Spider Agent
A concurrent-safe multimodal agent for web automation and research.
Features
- Concurrent-safe: Designed to be wrapped in
Arcfor multi-task access - Feature-gated: Only include dependencies you need
- Multiple LLM providers: OpenAI, OpenAI-compatible APIs
- Multiple search providers: Serper, Brave, Bing, Tavily
- HTML extraction: Clean and extract structured data from web pages
- Research synthesis: Combine search + extraction + LLM synthesis
Advanced Automation Features
- Tool Calling Schema: OpenAI-compatible function calling for reliable action parsing
- HTML Diff Mode: 50-70% token reduction by sending only page changes after first round
- Planning Mode: Multi-step planning reduces LLM round-trips
- Parallel Synthesis: Analyze N pages in a single LLM call
- Confidence Tracking: Smarter retry decisions based on LLM confidence scores
- Self-Healing Selectors: Auto-repair failed selectors with LLM diagnosis
- Schema Generation: Auto-generate JSON schemas from example outputs
- Concurrent Chains: Execute independent actions in parallel with dependency graphs
Installation
Add to your Cargo.toml:
[]
= { = "0.1", = ["openai", "search_serper"] }
Quick Start
use ;
use Arc;
async
Concurrent Execution
use Agent;
use Arc;
let agent = new;
// Execute multiple searches concurrently
let queries = vec!;
let mut handles = Vecnew;
for query in queries
// Collect results
for handle in handles
Research with Synthesis
use ;
let agent = builder
.with_openai
.with_search_serper
.build?;
let research = agent.research.await?;
println!;
Feature Flags
| Feature | Description |
|---|---|
openai |
OpenAI/OpenAI-compatible LLM provider |
chrome |
Browser automation via chromiumoxide |
search |
Base search functionality |
search_serper |
Serper.dev search provider |
search_brave |
Brave Search provider |
search_bing |
Bing Search provider |
search_tavily |
Tavily AI Search provider |
full |
All features |
Examples
# Basic search
SERPER_API_KEY=xxx
# Extract data
OPENAI_API_KEY=xxx
# Research
OPENAI_API_KEY=xxx SERPER_API_KEY=xxx
# Concurrent execution
OPENAI_API_KEY=xxx SERPER_API_KEY=xxx
API Reference
Agent
The main struct for all agent operations:
search(query)- Search the websearch_with_options(query, options)- Search with custom optionsfetch(url)- Fetch a URLextract(html, prompt)- Extract data from HTML using LLMextract_structured(html, schema)- Extract data matching a JSON schemaresearch(topic, options)- Research a topic with synthesisprompt(messages)- Send a prompt to the LLMmemory_get/set/clear()- Session memory operations
AgentBuilder
Configure and build agents:
builder
.with_config
.with_system_prompt
.with_max_concurrent_llm_calls
.with_openai
.with_search_serper
.build
Advanced Configuration
RemoteMultimodalConfig
Configure automation features. Use preset configurations for optimal performance:
use RemoteMultimodalConfig;
// Fast mode: All performance-positive features enabled
// - Tool calling (Auto), HTML diff (Auto), Confidence retries, Concurrent execution
let config = fast;
// Fast with planning: Adds multi-step planning and self-healing
// Best for complex multi-step automations
let config = fast_with_planning;
// Manual configuration for fine-grained control:
use ;
let config = default
.with_tool_calling_mode
.with_html_diff_mode
.with_planning_mode
.with_self_healing
.with_confidence_strategy
.with_concurrent_execution;
Concurrent Action Chains
Execute independent actions in parallel using dependency graphs:
use ;
// Define steps with dependencies
let steps = vec!;
// Create dependency graph
let mut graph = new?;
// Execute with parallel-safe actions running concurrently
let config = default;
let result = execute_graph.await;
Schema Generation
Auto-generate JSON schemas from examples:
use ;
let request = SchemaGenerationRequest ;
let schema = generate_schema;
// Use schema.to_extraction_schema() for structured extraction
Performance Features
| Feature | Default | fast() |
Impact |
|---|---|---|---|
| Tool Calling | JsonObject |
Auto |
~30% reduction in parse errors |
| HTML Diff | Disabled |
Auto |
50-70% token reduction |
| Planning Mode | None |
None |
Fewer LLM round-trips |
| Parallel Synthesis | None |
None |
N pages = 1 LLM call |
| Confidence | None |
Enabled |
Smarter retry decisions |
| Self-Healing | None |
None |
Higher success rate on failures |
| Concurrent Execution | false |
true |
Parallel action execution |
Recommended: Use RemoteMultimodalConfig::fast() for optimal performance.
All features are opt-in with zero overhead when disabled.
License
MIT