LangChain integration for Parallel's Task API.
Four primary surfaces:
ParallelTaskRunTool — agent-callable tool that runs a single
Parallel Task synchronously (via client.task_run.execute) and
returns the structured result with citations.ParallelDeepResearch — high-level :class:~langchain_core.runnables.Runnable
wrapper for deep-research tasks. Defaults to the core processor and
always returns the full basis (citations + reasoning + confidence).ParallelTaskGroup — batch executor backed by the Task Group
API. The general building block for fan-out/fan-in workloads.ParallelEnrichment — the structured-batch counterpart to
:class:ParallelDeepResearch. A typed Runnable that enriches a list
of records against a pydantic input/output schema using the Task
Group API under the hood.Helpers: :func:build_task_spec constructs a Task Spec dict from
pydantic classes; :func:verify_webhook validates HMAC signatures on
incoming Parallel webhooks.
Retrieve the Parallel API key from argument or environment variables.
Returns a configured async Parallel SDK client.
Returns a configured sync Parallel SDK client.
Build a TaskSpecParam dict from pydantic classes / schemas / text.
Mirrors the helper used in https://docs.parallel.ai/task-api/examples/task-enrichment.
Verify a Parallel webhook signature (Standard Webhooks scheme).
Parallel signs webhook payloads using HMAC-SHA256 over
"<webhook-id>.<webhook-timestamp>.<body>", base64-encoded
with padding. The signature is delivered as the webhook-signature
header (possibly with multiple space-delimited v1,<sig> entries).
See https://docs.parallel.ai/resources/webhook-setup.
The verification flow is:
tolerance_seconds from now
(replay protection).v1,<sig> entry in the header.Extract citations, low-confidence fields, and interaction_id.
Saves Task-API consumers the boilerplate of walking the result shape to
pull out per-field citations, find which fields the model wasn't sure
about, and grab the interaction_id for multi-turn chaining.
Works on results from :class:ParallelTaskRunTool,
:class:ParallelDeepResearch, and individual entries from
:class:ParallelTaskGroup / :class:ParallelEnrichment batches.
One BYOMCP server description for a Task Run.
Mirrors :class:parallel.types.McpServerParam so callers don't have to
import from the SDK directly.
Input schema for :class:ParallelTaskRunTool.
Run a single Parallel Task synchronously and return the structured result.
This is the agent-friendly path: an LLM calls the tool with input, the
tool blocks until the Parallel Task Run completes, and returns a dict
containing the output, citations (basis), and run metadata.
For long-running deep-research tasks, prefer :class:ParallelDeepResearch,
which is a :class:~langchain_core.runnables.Runnable and returns the same
result shape.
High-level Runnable for Parallel deep-research tasks.
Defaults to the pro-fast processor -- the -fast variant of
pro ("Exploratory web research") at 2-5x the speed for similar
accuracy. Drop the -fast suffix (processor="pro", 2-10 min)
or step up to processor="ultra" (5-25 min) for the most thorough
multi-source investigative reports. For shorter, enrichment-style
structured tasks, use :class:ParallelEnrichment or pass
processor="core-fast" here.
Always returns the full basis (citations + reasoning + confidence)
on the result; lower friction than wiring up
:class:ParallelTaskRunTool manually when all you want is "do deep
research on this question."
Batch task runner backed by the Task Group API.
Use when you have a list of inputs and want them all processed in parallel. Returns a list of result dicts in the same order as the input list.
High-level Runnable for the structured-batch enrichment pattern.
Wraps :class:ParallelTaskGroup with a default_task_spec so callers
can pass a list of records (pydantic instances or dicts) and get back a
list of enriched output dicts. Mirrors the canonical enrichment pattern
documented at
https://docs.parallel.ai/task-api/examples/task-enrichment.
Defaults to the core processor (the docs' recommendation for
enrichment workflows).