Overview
The Lookout API enables you to create scheduled research agents that automatically run searches at specified intervals. This is a Pro-only feature that leverages QStash for reliable cron-based scheduling.Lookout is a Pro-only feature. Users must have an active subscription to create and run scheduled searches.
POST /api/lookout
Create or trigger a lookout (scheduled research agent).Request Body
Unique identifier for the lookout. Use UUIDv7 format.
User ID of the lookout owner. Must match an existing user with Pro subscription.
The research prompt/query to execute. This will be sent to the AI model for processing.
Lookout Configuration Fields
When creating a new lookout, additional fields are stored in the database:Human-readable title for the lookout (e.g., “Daily AI News Digest”)
Schedule frequency. Options:
"once"- Run once and pause"hourly"- Run every hour"daily"- Run daily"weekly"- Run weekly"custom"- Custom cron schedule
Cron expression for scheduling (required for recurring lookouts).Format:
CRON_TZ={timezone} {cron_expression}Example: CRON_TZ=America/New_York 0 9 * * * (9 AM daily in New York)IANA timezone identifier (e.g.,
"America/New_York", "Europe/London")Lookout status:
"active", "paused", or "running". Defaults to "active".Example Request
Response Format
The endpoint returns a Server-Sent Events (SSE) stream similar to the Search API:Cron Schedule Format
Lookouts use standard cron expressions with timezone support:| Expression | Description |
|---|---|
0 9 * * * | Every day at 9:00 AM |
0 */6 * * * | Every 6 hours |
0 9 * * 1 | Every Monday at 9:00 AM |
0 0 1 * * | First day of every month at midnight |
0 9 * * 1-5 | Every weekday at 9:00 AM |
Execution Details
Model and Configuration
Lookouts use the following configuration:- Model:
scira-grok-4-fast-think(xAI Grok-4 with reasoning) - Tools:
extreme_searchonly (focused deep research) - Stop Condition: Maximum 2 tool execution steps
- Max Retries: 10 (for reliability)
Research Quality
Lookouts are optimized for comprehensive research reports:- Format: 3-page research paper format with markdown
- Citations: Mandatory inline citations for all factual claims
- Structure: Key points, detailed sections, analysis, and conclusion
- Depth: Detailed paragraphs (4-6 sentences minimum) with technical depth
Email Notifications
Upon completion, lookouts send an email notification to the user containing:- Chat title (auto-generated)
- Response summary (first 2000 characters)
- Link to full chat/results
Metrics Tracking
Each lookout run tracks:- Duration: Total execution time in milliseconds
- Tokens Used: Total tokens consumed (input + output)
- Searches Performed: Count of extreme_search tool calls
- Run Status:
"success"or"error" - Error Message: If applicable
Status Management
Status Flow
- active - Scheduled and ready to run
- running - Currently executing
- active - Returns to active after completion
- paused - One-time lookouts after execution, or manually paused
Status Transitions
Next Run Calculation
For recurring lookouts, the next run time is automatically calculated:QStash Integration
Lookouts leverage QStash for reliable scheduling:- Reliability: Automatic retries on failure
- Timezone Support: Runs in user’s specified timezone
- Scalability: Handles thousands of concurrent schedules
- Monitoring: Built-in metrics and logging
Usage Tracking
Lookout runs consume resources from your Pro subscription:- Each run increments extreme search usage counter
- Token usage is tracked per run
- All runs are logged with metrics
Response Structure
Successful lookout executions create:- New Chat: Each run creates a new chat with title “Scheduled: ”
- Messages: User message (prompt) and assistant response
- Metadata: Includes model, tokens, completion time
Database Records
Error Handling
Common Errors
404 Not Found
Lookout not found
404 Not Found
User not found
403 Forbidden
Pro subscription required
500 Internal Server Error
Execution failed
Error Recovery
When a lookout run fails:- Status is set back to
"active" - Error message is logged to database
- Next scheduled run proceeds normally
- No email notification is sent
Retry Logic
Lookouts include retry logic:- Lookout validation: 3 retries with exponential backoff
- AI generation: 10 max retries via AI SDK
- QStash: Built-in delivery retries
Best Practices
Use specific, focused prompts
Use specific, focused prompts
Lookouts work best with well-defined research questions. Be specific about what information you want and in what format.Good: “Summarize daily AI safety papers from arXiv, focusing on alignment research with citations”Poor: “Tell me about AI”
Set appropriate frequencies
Set appropriate frequencies
Consider the rate of change in your topic:
- Fast-moving topics: hourly or daily
- Academic research: daily or weekly
- Industry trends: weekly or monthly
Monitor your usage
Monitor your usage
Even as a Pro user, monitor your lookout usage:
- Check run metrics (duration, tokens, searches)
- Review generated content quality
- Adjust prompts and frequency as needed
Use appropriate timezones
Use appropriate timezones
Set lookouts to run in your local timezone for better scheduling:
- Morning briefings: 8-9 AM local time
- End-of-day summaries: 5-6 PM local time
- Weekly reports: Monday mornings
Handle one-time vs recurring
Handle one-time vs recurring
Use
"once" frequency for:- Testing lookout configurations
- One-off deep research tasks
- Event-specific research
- Ongoing monitoring
- Regular briefings
- Continuous learning
Example Use Cases
Daily AI News Digest
Weekly Academic Research Summary
Market Intelligence
Next Steps
Search API
Learn about the underlying search API
Rate Limits
Understand Pro subscription limits
