Getting Started

Installing the SDK client

To get started, reach out to our team for access to the SDK.

pip install -U <path to your .whl file>

Initialize the client

To begin using the SDK, initialize the client with your API key:

from parallel_beta import Parallel

client = Parallel(api_key="your-api-key")

Tasks

Create a task

Creates a new task with a specification and input/output schemas:

task = client.tasks.create(
    name="Budget",
    description="Get budget for a city",
    prompt="What was the budget for {city} in {year}?",
    input_schema={
        "properties": {
            "city": {"type": "string"},
            "year": {"type": "string"}
        },
        "required": ["city", "year"],
        "additionalProperties": False,
        "type": "object"
    },
    output_schema={
        "properties": {
            "budget": {"type": "string"},
            "evidence": {"type": "string"},
            "reasoning": {"type": "string"}
        },
        "type": "object"
    }
)

Retrieve Task

Fetches an existing task by its ID:

task = client.tasks.retrieve(task_id="task_id")

Understanding Task Objects

Task objects contain information about the task, including its ID, name, description, and schema:

Task(
    task_id="task-id",
    name="Budget",
    description="Get budget for a city",
    prompt="What was the budget for {city} in {year}?",
    input_schema={
        "additionalProperties": False,
        "type": "object",
        "properties": {
            "city": {"type": "string"},
            "year": {"type": "string"}
        },
        "required": ["city", "year"]
    },
    output_schema={
        "type": "object",
        "properties": {
            "budget": {"type": "string"},
            "evidence": {"type": "string"},
            "reasoning": {"type": "string"}
        }
    },
    functions=[],
    metadata={},
    warnings=[],
)

Task Runs

Create Run

There are several ways to create a task run:

Standard synchronous run - Waits for completion:

task_run = client.tasks.runs.create(
    task_id="task_id",
    runner="helium",
    arguments={
        "city": "New York City",
        "year": "2023"
    }
)

Enqueue run - Returns immediately with a run id and executes the run asynchronously:

task_run = client.tasks.runs.create(
    task_id="task_id",
    runner="helium",
    arguments={
        "city": "New York City",
        "year": "2023"
    },
    enqueue_run=True
)

Retrieve Run

Retrieves the current state and output of a task run:

run = client.tasks.runs.retrieve(
    task_id="task_id",
    run_id="run_id"
)

Understanding Task Run Objects

Task run objects contain information about the task and run status, including IDs, state, and output:

TaskRun(
    # Run Status - possible values: queued, running, complete, failed
    status="queued",

    # Task and Run IDs
    task_id="6e16dd09-92d7-4a72-9541-25cab5d3257a",
    run_id="feb0cae1-8524-12d2-6941-1d7daf63d049",

    # Runner/Processor used
    runner="neon",

    # Task output (if completed)
    output={
        "budget": "$232.9 billion",
        "evidence": "https://nyassembly.gov/Reports/...",
        "reasoning": "The budget for New York in 2023 consists of both ..."
    },  # or None if not completed

    modified_at=datetime.datetime(2025, 1, 31, 21, 12, 54, 907024)
)

The output will correspond to the output schema provided during task creation.

City Budget document finder

This example demonstrates how to create a task to find the most recent official budget document for a city/town. It first creates a task, then runs it for a list of cities, and finally displays the results in a table.

Note: The python code example requires the package rich to be installed. The TypeScript code example requires the package cli-table3 to be installed.

Example output: