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:
Stream research progress in real time. The API sends Server-Sent Events (SSE) in an OpenAI-compatible chat.completion.chunk format as the research agents work. You can display tool activity, show discovered sources, and stream the final report as it generates.
import jsonimport osfrom tavily import TavilyClientclient = TavilyClient(api_key=os.environ["TAVILY_API_KEY"])stream = client.research( input="What are the key trends in AI agents for 2026?", model="mini", stream=True,)for chunk in stream: text = chunk.decode("utf-8") for line in text.splitlines(): line = line.strip() if not line: continue if line.startswith("event:"): event_name = line.split(":", 1)[1].strip() if event_name == "done": print("\n\n[stream complete]") continue if not line.startswith("data:"): continue payload = line.split(":", 1)[1].strip() if not payload: continue data = json.loads(payload) delta = data.get("choices", [{}])[0].get("delta", {}) if "tool_calls" in delta: tc = delta["tool_calls"] if tc.get("type") == "tool_call": for tool in tc.get("tool_call", []): print(f"[{tool.get('name')}] {tool.get('arguments', '')}") elif tc.get("type") == "tool_response": for tr in tc.get("tool_response", []): for s in tr.get("sources", []): print(f" Source: {s['title']} — {s['url']}") if "content" in delta and isinstance(delta["content"], str): print(delta["content"], end="", flush=True) if "sources" in delta: print("\n\n--- All Sources ---") for s in delta["sources"]: print(f" {s['title']}: {s['url']}")