What You’ll Learn
- Submitting a research request and polling for results
- Streaming research progress in real time
- Handling streaming events (progress updates, source discoveries, content generation)
- Getting structured output with custom schemas
How Does It Work?
Tavily Research is a multi-agent deep research endpoint. You submit a query, and Tavily’s research agents autonomously search, extract, and synthesize information from multiple sources into a comprehensive report. Two consumption patterns are available:| Pattern | Best For | How It Works |
|---|---|---|
| Polling | Background jobs, serverless | Submit request, poll for completion |
| Streaming | Real-time UIs, CLI tools | Receive progress events as they happen |
Getting Started
Get your Tavily API key
Polling
client.research() returns immediately with a pending task. Use client.get_research() to poll until the status is "completed".
Streaming
Stream research progress in real time. The API sends Server-Sent Events (SSE) in an OpenAI-compatiblechat.completion.chunk format as the research agents work. You can display tool activity, show discovered sources, and stream the final report as it generates.
Streaming Event Flow
A typical session progresses through these stages:| Stage | Delta field | What happens |
|---|---|---|
| Planning | tool_calls (type tool_call) | Research plan is initialized |
| Searching | tool_calls (type tool_call / tool_response) | Web searches execute, sources are discovered |
| Subtopics | tool_calls (Pro only) | ResearchSubtopic calls for deeper dives |
| Generating | tool_calls | Final report generation begins |
| Content | content | Report chunks stream incrementally |
| Sources | sources | Complete list of all sources used |
| Done | SSE event: done | Stream complete |
Structured Output
Useoutput_schema to get research results in a custom JSON format. Define your schema as a dictionary of field names to descriptions.
Handling Research Streams in Production
For production applications, use thehandle_research_stream utility from the Agent Toolkit to process streaming events cleanly:
Critical Knobs
model
model
"auto"(default) — Tavily picks based on query complexity"pro"— comprehensive, multi-agent research for complex topics"mini"— faster, targeted research for narrow questions
stream
stream
true— real-time SSE progress eventsfalse(default) — single response, poll for completion
output_schema
output_schema
- Pass a JSON Schema object to get structured data instead of a markdown report
- Write clear field descriptions for best results
citation_format
citation_format
"numbered"(default),"mla","apa","chicago"- Controls how sources are cited in the report
Next Steps
Research API Reference
Full parameter list, response schema, and interactive playground.
Streaming API Reference
Complete SSE event structure, field details, and tool types.
Research Best Practices
Prompting tips, model selection, and structured output guidance.
Python SDK Reference
Python client methods, async support, and type details.