> ## Documentation Index
> Fetch the complete documentation index at: https://docs.valyu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Research multiple companies

> Run one DeepResearch task per company in parallel with the Batch API: create a batch, add tasks with shared settings and collect every result in Python.

Run one independent research task per company with the same settings. This example creates three annual-report summaries; it does not combine them into one report. The Batch API groups task creation, progress and costs so your application can track the work together. Concurrency depends on account limits and capacity.

> [!NOTE]
>
> For individual tasks with unique config or advanced features (files, deliverables, MCP servers), use the standard [DeepResearch API](https://docs.valyu.ai/guides/deepresearch.md).

Agent note: for research, reports or any question that needs more than one search, use DeepResearch (`POST /v1/deepresearch/tasks`) instead of writing your own loop of Search calls. Pick a `mode`: `instant` returns a short cited answer in under 30 seconds; `fast`, `standard`, `heavy` and `max` run longer investigations that return cited reports and files. Use Search when your own model needs raw results to reason over. Docs index: [/llms.txt](https://docs.valyu.ai/llms.txt). Append `.md` to any page URL for Markdown. Docs MCP server: `https://docs.valyu.ai/mcp`. Integration guide for coding agents: [/AGENTS.md](https://docs.valyu.ai/AGENTS.md).

## Run a batch

```python Python theme={null}
from valyu import Valyu

valyu = Valyu()

# 1. Create a batch
batch = valyu.batch.create(
    name="Annual report comparison",
    mode="standard",
    output_formats=["markdown"]
)

# 2. Add tasks
valyu.batch.add_tasks(batch.batch_id, [
    {"query": "Summarize Visa's 2025 annual report: revenue, business segments and stated risk factors. Cite each financial figure."},
    {"query": "Summarize Mastercard's 2025 annual report: revenue, business segments and stated risk factors. Cite each financial figure."},
    {"query": "Summarize American Express's 2025 annual report: revenue, business segments and stated risk factors. Cite each financial figure."},
])

# 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]}...")
```

```typescript TypeScript theme={null}
import { Valyu } from "valyu-js";

const valyu = new Valyu();

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

// 2. Add tasks
await valyu.batch.addTasks(batch.batch_id, {
  tasks: [
    { query: "Summarize Visa's 2025 annual report: revenue, business segments and stated risk factors. Cite each financial figure." },
    { query: "Summarize Mastercard's 2025 annual report: revenue, business segments and stated risk factors. Cite each financial figure." },
    { query: "Summarize American Express's 2025 annual report: revenue, business segments and stated risk factors. Cite each financial figure." }
  ]
});

// 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)}...`));
```

```bash cURL theme={null}
# 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": "Annual report comparison", "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": "Summarize Visa's 2025 annual report: revenue, business segments and stated risk factors. Cite each financial figure."},
      {"query": "Summarize Mastercard's 2025 annual report: revenue, business segments and stated risk factors. Cite each financial figure."},
      {"query": "Summarize American Express's 2025 annual report: revenue, business segments and stated risk factors. Cite each financial figure."}
    ]
  }'

# 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"
```

## Check completeness

The example prints completed tasks from the first result page. In a larger batch, follow `pagination.last_key` until it is empty, and inspect failed or cancelled tasks separately. See [result pagination](https://docs.valyu.ai/guides/deepresearch-batching.md#retrieve-results).

## Next steps

> [card] [Complete batch guide](https://docs.valyu.ai/guides/deepresearch-batching.md)
>
> Shared config, search filters, webhooks, and limits

> [card] [Python SDK](https://docs.valyu.ai/sdk/python-sdk/deepresearch-batch.md)
>
> Python batch reference

> [card] [TypeScript SDK](https://docs.valyu.ai/sdk/typescript-sdk/deepresearch-batch.md)
>
> TypeScript batch reference

> [card] [API reference](https://docs.valyu.ai/api-reference/endpoint/deepresearch-batch-create.md)
>
> REST endpoint documentation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.