Skip to main content

Overview

Interactions let you chain context between API calls. Each response includes an interaction_id, which you can pass as previous_interaction_id in a subsequent request to carry forward the context from the previous call. This enables multi-turn research workflows like follow-up questions, iterative refinement, and conversational agents. Interactions work across both the Task API and Chat API.

How It Works

  1. Make an initial request — the response includes an interaction_id
  2. Pass it forward — include that value as previous_interaction_id in your next request
  3. Continue the chain — each new response returns its own interaction_id, so you can keep building on prior context

Request and Response Fields

FieldLocationDescription
previous_interaction_idRequest (optional)Interaction ID from a prior call to use as context
interaction_idResponseIdentifier for this interaction — pass as previous_interaction_id in follow-ups
These fields are available on both Task API (BetaTaskRunInput) and Chat API (ChatCompletionRequest) requests, and their corresponding responses.

Task API Usage

from parallel import Parallel
from parallel.types import TaskSpecParam, TextSchemaParam

client = Parallel()

# Initial request
task_run = client.task_run.create(
    input="What are the main pricing models used by SaaS companies?",
    processor="core",
    task_spec=TaskSpecParam(output_schema=TextSchemaParam()),
)
result = client.task_run.result(task_run.run_id, api_timeout=3600)

# Follow-up using the interaction ID
followup = client.task_run.create(
    input="Which of these works best for enterprise customers?",
    processor="core",
    previous_interaction_id=task_run.interaction_id,
    task_spec=TaskSpecParam(output_schema=TextSchemaParam()),
)
followup_result = client.task_run.result(followup.run_id, api_timeout=3600)

Cross-Processor Interactions

You can chain interactions across different processors of the Task API.
Interactions are not available for Zero Data Retention (ZDR) customers.

Next Steps