UnSearch Docs

Agent API

Tavily-compatible AI agent endpoints for search, extraction, and research.

Agent API

Drop-in replacements for Tavily's agent endpoints. Switch with a single import change — same request/response format.

POST /api/v1/agent/search

AI-optimized web search with optional answer generation. Fully Tavily-compatible.

Body Parameters

ParameterTypeDefaultDescription
querystringrequiredSearch query
search_depthstring"basic""basic", "advanced", "fast", "ultra-fast"
max_resultsinteger5Max results (1-20)
topicstring"general""general", "news", "finance"
include_answerboolean|stringfalsetrue, "basic", "advanced", "production"
include_raw_contentboolean|stringfalsetrue, "markdown", "text"
include_imagesbooleanfalseInclude image results
include_image_descriptionsbooleanfalseAI-generated image descriptions
include_domainsstring[]Only search these domains
exclude_domainsstring[]Exclude these domains
rerankbooleanfalseRe-rank results by relevance
modelstring"auto", "speed", "quality", "reasoning", "production"
check_safetybooleanfalseRun safety check on query

Example Request

curl -X POST 'https://api.unsearch.dev/api/v1/agent/search' \
  -H 'X-API-Key: sk_live_xxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "What is retrieval augmented generation?",
    "search_depth": "advanced",
    "include_answer": true,
    "max_results": 5
  }'

Response

{
  "query": "What is retrieval augmented generation?",
  "answer": "Retrieval Augmented Generation (RAG) is a technique that combines...",
  "images": [],
  "results": [
    {
      "title": "Understanding RAG",
      "url": "https://example.com/rag",
      "content": "Full content of the page...",
      "score": 0.95,
      "raw_content": "Raw markdown content..."
    }
  ],
  "response_time": 1.23,
  "model_used": "quality",
  "query_complexity": "moderate"
}

Agent Extract

POST /api/v1/agent/extract

Extract structured content from one or more URLs.

Body Parameters

ParameterTypeDefaultDescription
urlsstring[]requiredURLs to extract (max 20)
include_imagesbooleanfalseInclude images
extract_depthstring"basic""basic" or "advanced"

Example Request

curl -X POST 'https://api.unsearch.dev/api/v1/agent/extract' \
  -H 'X-API-Key: sk_live_xxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "urls": ["https://example.com/article"],
    "extract_depth": "advanced"
  }'

Response

{
  "results": [
    {
      "url": "https://example.com/article",
      "raw_content": "# Article Title\n\nFull markdown content...",
      "images": ["https://example.com/img1.png"],
      "failed": false
    }
  ],
  "failed_urls": [],
  "response_time": 0.87
}

Agent Research

POST /api/v1/agent/research

Deep multi-step research with AI analysis. UnSearch exclusive — not available in Tavily.

Body Parameters

ParameterTypeDefaultDescription
querystringrequiredResearch query
depthstring"standard""quick", "standard", "deep", "comprehensive"
max_sourcesinteger10Max sources to analyze
include_analysisbooleantrueInclude detailed analysis
include_summarybooleantrueInclude executive summary
focus_areasstring[]Specific areas to focus on

Example Request

curl -X POST 'https://api.unsearch.dev/api/v1/agent/research' \
  -H 'X-API-Key: sk_live_xxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "State of AI agents in enterprise 2025",
    "depth": "deep",
    "max_sources": 15,
    "focus_areas": ["adoption", "ROI", "challenges"]
  }'

Response

{
  "query": "State of AI agents in enterprise 2025",
  "executive_summary": "AI agents are seeing rapid enterprise adoption...",
  "detailed_analysis": "## Adoption Trends\n\n...",
  "key_findings": [
    "73% of enterprises plan to deploy AI agents by 2026",
    "Average ROI of 340% reported by early adopters"
  ],
  "sources": [
    {
      "title": "Enterprise AI Report 2025",
      "url": "https://example.com/report",
      "content": "...",
      "score": 0.92
    }
  ],
  "methodology": {
    "queries_executed": 8,
    "sources_analyzed": 15,
    "depth": "deep"
  },
  "model_used": "quality",
  "response_time": 12.5
}

Migration from Tavily

# Before (Tavily)
from tavily import TavilyClient
client = TavilyClient(api_key="tvly-...")

# After (UnSearch) — same API
from unsearch import UnSearch
client = UnSearch(api_key="sk_live_...")

# Identical usage
results = client.search("query", include_answer=True)
extracted = client.extract(urls=["https://example.com"])
// Before (Tavily)
import { tavily } from "@tavily/core";
const client = tavily({ apiKey: "tvly-..." });

// After (UnSearch)
import { UnSearch } from "unsearch";
const client = new UnSearch({ apiKey: "sk_live_..." });

// Same methods
const results = await client.search("query", { includeAnswer: true });

On this page