Skip to main content
The Batch API runs many DeepResearch tasks in parallel with shared configuration and unified monitoring. Create a batch, add queries, wait, retrieve.
For individual tasks with unique config or advanced features (files, deliverables, MCP servers), use the standard DeepResearch API.

Run a batch

from valyu import Valyu

valyu = Valyu()

# 1. Create a batch
batch = valyu.batch.create(
    name="Market Research Q4",
    mode="standard",
    output_formats=["markdown"]
)

# 2. Add tasks
valyu.batch.add_tasks(batch.batch_id, [
    {"query": "Analyze AI trends in healthcare"},
    {"query": "Review renewable energy market"},
    {"query": "Research fintech innovations"},
])

# 3. Wait for completion
result = valyu.batch.wait_for_completion(
    batch.batch_id,
    on_progress=lambda s: print(f"{s.batch.counts.completed}/{s.batch.counts.total} done")
)
print(f"Total cost: ${result.batch.cost}")

# 4. Retrieve outputs
for task in valyu.batch.list_tasks(batch.batch_id, status="completed", include_output=True).tasks:
    print(f"{task.query}: {task.output[:200]}...")
import { Valyu } from "valyu-js";

const valyu = new Valyu();

// 1. Create a batch
const batch = await valyu.batch.create({
  name: "Market Research Q4",
  mode: "standard",
  outputFormats: ["markdown"]
});

// 2. Add tasks
await valyu.batch.addTasks(batch.batch_id, {
  tasks: [
    { query: "Analyze AI trends in healthcare" },
    { query: "Review renewable energy market" },
    { query: "Research fintech innovations" }
  ]
});

// 3. Wait for completion
const result = await valyu.batch.waitForCompletion(batch.batch_id, {
  onProgress: (b) => console.log(`${b.counts.completed}/${b.counts.total} done`)
});
console.log(`Total cost: $${result.cost}`);

// 4. Retrieve outputs
const done = await valyu.batch.listTasks(batch.batch_id, {
  status: "completed",
  includeOutput: true,
});
done.tasks.forEach(t => console.log(`${t.query}: ${t.output?.substring(0, 200)}...`));
# Create a batch
curl -X POST "https://api.valyu.ai/v1/deepresearch/batches" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{ "name": "Market Research Q4", "mode": "standard", "output_formats": ["markdown"] }'

# Add tasks (use batch_id from the response)
curl -X POST "https://api.valyu.ai/v1/deepresearch/batches/BATCH_ID/tasks" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "tasks": [
      {"query": "Analyze AI trends in healthcare"},
      {"query": "Review renewable energy market"},
      {"query": "Research fintech innovations"}
    ]
  }'

# Retrieve completed outputs
curl -X GET "https://api.valyu.ai/v1/deepresearch/batches/BATCH_ID/tasks?status=completed&include_output=true" \
  -H "X-API-Key: YOUR_API_KEY"

Next steps

Complete batch guide

Shared config, search filters, webhooks, and limits

Python SDK

Python batch reference

TypeScript SDK

TypeScript batch reference

API reference

REST endpoint documentation