# Parallel Research Agent

Deploy a durable web-research agent on Render Workflows and Parallel. Demonstrates Search and Extract API and sub-questions fan-out pattern. Generates a report with citations.

## Why deploy Parallel Research Agent on Render?

Parallel Research Agent is an open-source research pipeline that turns a single question into a cited report. It uses an LLM to break the question into independent sub-questions, researches each one on the live web with Parallel Search and Extract, then synthesizes the findings into one answer with sources.

This template is built for production-style agent runs, not a single long chat session. A FastAPI gateway accepts research requests, authenticates callers, and dispatches work to Render Workflows. The workflow plans the investigation, fans out each sub-question into its own branch, and merges successful results in a final synthesis step. Each investigate branch runs as its own workflow run on its own instance with its own retry budget. If one branch hits a rate limit or times out, Render retries that branch—not the entire job. Branches that still fail are reported explicitly while the agent synthesizes whatever succeeded.

Deploying from the Blueprint creates the gateway web service with health checks, generated API secret, and environment wiring for Parallel, your LLM provider, and Render API access. You then add a Workflow service from the same repository (a short dashboard step documented in the README) and connect it with `RENDER_WORKFLOW_SLUG`. LiteLLM supports Anthropic, OpenAI, Bedrock, and many other providers, so you can swap models without rewriting the agent.

## Architecture

```
POST /research
  dispatch run
  Search + Extract
  plan / tool loop / synthesize

GET /research/run_id
```  
User
parallel-research-gateway
research_agent Workflow
Parallel API
LLM provider

The gateway exposes an inbound interface over HTTP. The Workflow runs `plan_research`, parallel investigate tasks (each sub-question gets Search and Extract plus an LLM tool loop), then synthesize to produce the final report.

## What you can build

After deploy, you have a Bearer-protected research API on Render plus an optional demo form on the gateway root for local development. Submit a natural-language question, receive a `run_id`, poll until the workflow completes, and get a structured result with a cited report. Failed branches appear in the response so you can see gaps instead of a silent partial failure.

The agent defaults to Anthropic models but works with any LiteLLM-supported provider. Typical runs use several parallel branches; README cost guidance is on the order of $0.33 per four-branch run, mostly LLM tokens, depending on model, branch count, and search depth. Hosting adds your Render web service and Workflow usage on top of Parallel and LLM API charges.

## Key Features

- Fan-out / fan-in on Render Workflows: The research_agent orchestrator plans sub-questions, runs each investigation as a separate workflow branch, then synthesizes branch outputs into one report.
- Branch-level retries: Timeouts and transient failures retry per branch with configurable backoff, so one slow or flaky thread does not restart the whole investigation.
- Parallel Search and Extract: Live web search returns LLM-oriented excerpts; Extract pulls focused content from specific URLs, including JavaScript-rendered pages and PDFs when you need more detail than search snippets provide.
- Provider-flexible LLMs via LiteLLM: Set `LLM_MODEL` and `PLANNER_MODEL` with standard LiteLLM model strings and supply the matching API keys (Anthropic by default, OpenAI or others with a config change).
- Gateway + Workflow split: The gateway handles auth, rate limiting, run dispatch, and status polling; heavy research runs in Workflow workers where Render manages durability and scaling semantics.
- Tunable research behavior: Control breadth with `MAX_SUB_QUESTIONS`, depth with `MAX_AGENT_TURNS`, search quality with `PARALLEL_SEARCH_MODE` (turbo, fast, or advanced), and specialty via `PLANNER_PROMPT` and `RESEARCH_SYSTEM_PROMPT`.

## Use cases

- Analyst splits a market question into competitors, pricing, and regulation threads, then receives one reconciled brief with citations.
- Founder stress-tests a launch thesis with sourced web evidence before an investor or board memo.
- Product manager evaluates several tools in parallel—each criterion gets its own investigate branch—then reads a single synthesized comparison.
- Platform engineer forks the repo as a reference for durable, multi-branch agents on Render Workflows instead of a monolithic web process.

## Prerequisites

- Parallel API key: Powers Search and Extract. Get one at platform.parallel.ai.
- LLM provider API key: Default configuration expects Anthropic; use OpenAI or another provider by setting the appropriate key and LiteLLM model strings.
- Render API key: Lets the gateway create and poll workflow runs. Create one in Render API keys.
- Workflow service: Added manually after Blueprint deploy; copy its slug into `RENDER_WORKFLOW_SLUG` on the gateway.
- API secret: The Blueprint generates `API_SECRET` on the gateway; send it as `Authorization: Bearer ` on research requests in production.

## Next steps

1. Deploy the template and enter your Parallel, Render, and LLM keys when prompted. Open `https://<your-gateway>/health` — you should see a successful health response confirming the web service is live.

2. In the Render Dashboard, create a **Workflow** from the same repository with start command `python -m workflow.main`. Add `PARALLEL_API_KEY` and your LLM credentials to the Workflow environment, then copy the Workflow slug into `RENDER_WORKFLOW_SLUG` on the gateway — the gateway should redeploy and be ready to dispatch runs.

3. Start a research job with a POST to `/research`:

```bash
curl -X POST "https://<your-gateway>/research" \
     -H "Authorization: Bearer $API_SECRET" \
     -H "Content-Type: application/json" \
     -d '{"query": "What are the leading open-source alternatives to Elasticsearch in 2026?"}'
```

You should receive JSON with a `run_id` and an in-progress status.

4. Poll `GET /research/<run_id>` until the status completes — you should see a cited report in the result payload and multiple investigate branches in the Render Workflow run view for that job.

5. Optional: tighten `MAX_SUB_QUESTIONS` or `MAX_AGENT_TURNS` in the Workflow environment and rerun — you should see faster, cheaper runs with proportionally narrower coverage.

## Resources

- [Parallel](https://parallel.ai/)
- [Parallel platform documentation](https://docs.parallel.ai/getting-started/overview)
- [Render Workflows docs](/content/docs/workflows/index.html)
- [LiteLLM providers](https://docs.litellm.ai/docs/providers)

### Repository

[render-examples/parallel-research-agent](https://github.com/render-examples/parallel-research-agent)

### Stack

python

fastapi

render-workflows

parallel

### Tags

render-workflows

ai-agent

### For AI agents

Drop into your coding agent to explore and deploy this template.
