Key Features
- Multi-Agent Architecture: Director-worker agent pattern for coordinated research
- Configurable Models: Support for multiple LLM providers and models
- Image Support: Optional image inputs for visual research tasks
- Batch Processing: Execute multiple research sessions in parallel
- Cost Tracking: Transparent token usage and pricing calculation
- Credit System: Integrated billing and credit deduction
- External Search: Exa search tool integration for web research
Architecture
The Advanced Research system follows a director-worker pattern:- Director Agent: Orchestrates the research process, breaks down tasks, and synthesizes final results
- Worker Agents: Execute specific research tasks assigned by the director
- Search Integration: Exa search tool provides external data sources
- Cost Management: Token counting and credit deduction system
Configuration
AdvancedResearchConfig
The configuration schema defines all parameters for the research session:Configuration Parameters
Parameter | Type | Default | Description |
---|---|---|---|
name | string | ”Advanced Research” | Session identifier name |
description | string | ”Advanced Research” | Session description |
worker_model_name | string | ”gpt-4.1” | Model for worker agents |
director_agent_name | string | ”Director-Agent” | Director agent identifier |
director_model_name | string | ”gpt-4.1” | Model for director agent |
director_max_tokens | integer | 8000 | Maximum output tokens for director |
max_loops | integer | 1 | Number of research loops |
director_max_loops | integer | 1 | Maximum loops for director |
exa_search_num_results | integer | 2 | Number of search results |
exa_search_max_characters | integer | 100 | Max characters per search result |
Input/Output Schemas
Input Schema
Required Fields
config
: Research configuration objecttask
: The research task description
Optional Fields
img
: Base64 encoded image or image URL for visual research tasks
Output Schema
Response Fields
Field | Type | Description |
---|---|---|
id | string | Unique session identifier |
name | string | Session name from config |
description | string | Session description |
outputs | any | Final research results |
timestamp | string | ISO timestamp of completion |
sources | integer | Number of sources used |
characters_per_source | integer | Characters per source |
usage | object | Token usage and cost breakdown |
Pricing and Cost Management
Pricing Structure
The system implements a tiered pricing model:- Input Tokens: $20 per million tokens
- Output Tokens: $60 per million tokens
Token Counting
The system calculates input tokens from:- Configuration name and description
- Task description
- Director agent prompt (550 tokens baseline)
- Worker agent prompts (500 tokens × 5 agents baseline)
Validation and Error Handling
Input Validation
The system validates three critical requirements:- Worker Model Name: Must be specified
- Director Model Name: Must be specified
- Max Loops: Must be greater than 0
Error Types
Error Code | HTTP Status | Description |
---|---|---|
ADVANCED_RESEARCH_MISSING_WORKER_MODEL_NAME | 422 | Worker model not specified |
ADVANCED_RESEARCH_MISSING_DIRECTOR_MODEL_NAME | 422 | Director model not specified |
ADVANCED_RESEARCH_INVALID_MAX_LOOPS | 422 | Invalid max_loops value |
AdvancedResearchRunError | 500 | Runtime execution error |
API Endpoints
Single Research Session
Endpoint:POST /v1/advanced-research/completions
Headers:
Batch Research Sessions
Endpoint:POST /v1/advanced-research/batch/completions
Request Body:
Usage Examples
Basic Research Example
Advanced Configuration Example
Image-Based Research Example
Async Example with httpx
Batch Processing
Batch Request Structure
Batch Processing Benefits
- Parallel Execution: Multiple research sessions run concurrently
- Cost Efficiency: Shared infrastructure overhead
- Consistent Configuration: Apply similar configs across multiple tasks
Batch Example
Best Practices
Configuration Optimization
-
Model Selection:
- Use
gpt-4.1
orclaude-sonnet-4-20250514
for complex research - Consider
gpt-3.5-turbo
for simpler tasks to reduce costs - Match director and worker models for consistency
- Use
-
Loop Configuration:
- Start with
max_loops: 1
for simple tasks - Increase loops for complex, multi-stage research
- Monitor costs as loops multiply token usage
- Start with
-
Search Configuration:
- Adjust
exa_search_num_results
based on research depth needed - Increase
exa_search_max_characters
for detailed source content - Balance thoroughness with cost and processing time
- Adjust
Task Definition
- Clear Objectives: Define specific, measurable research goals
- Scope Boundaries: Limit task scope to avoid excessive token usage
- Context Provision: Include relevant background information
- Output Format: Specify desired output structure when needed
Error Handling
Troubleshooting
Common Issues
- Missing Model Names: Ensure both worker and director models are specified
- Invalid Max Loops: Verify max_loops is greater than 0
- Authentication Errors: Check API key validity and format
- Timeout Issues: Increase timeout for complex research tasks
- Credit Deduction Failures: Verify sufficient credits in account
Support
For additional support:- Review error messages for specific error codes
- Check logs for detailed execution information
- Contact support through Swarms Support
- Refer to the main API documentation for general issues
Model Selection Guidelines
- Research Complexity: More complex models for sophisticated analysis
- Cost Considerations: Balance capability with cost requirements
- Response Time: Consider model speed for time-sensitive tasks
- Special Features: Use vision-capable models for image analysis