Prerequisites

  • Parallel API key (from console.parallel.ai)

  • Python 3.7+ and requests library

  • curl for command-line examples

  • If you would prefer to use the Python SDK, you can find more information here

Step 1: Authentication

Set your API key as an environment variable:

export PARALLEL_API_KEY="your-api-key"

Test authentication with a simple API request:

curl -H "x-api-key: $PARALLEL_API_KEY" \
  https://api.parallel.ai/v0/tasks

Step 2: Design Your Task

Let’s create a task that gathers basic company information. The task will:

  1. Find key company details

  2. Research funding and size

  3. Return structured, verified information

First, let’s define our task specification, which is our prompt:

task_spec = """
Find and summarize basic information about this company:
- Year founded
- Current funding stage
- Approximate number of employees
- Official website
- Brief company description

Focus on consolidating information from:
- Company website
- Press releases
- Official announcements
- Business registrations
"""

Step 3: Define Schemas

Create input and output schemas based on what structure is most applicable to your use case. In this example, we consider company as being the required input for this task, and can also include the optional input location where applicable.

For the output schema, we consider the various fundraising stage classifications that are most useful to us, as well as other information that an analyst may look for, such as the year founded, the company description, the number of employees, and the company website URL.

input_schema = {
    "properties": {
        "company": {
            # you can include multiple inputs and outputs in your schema
            "type": "string",
            "description": "Company name or website"
        }
        "location": {
            "type": "string",
            "description": "Company state, city or country"
        }
    }
}

output_schema = {
    "properties": {
        "founded": {
            "type": "integer",
            "description": "Year company was founded"
        },
        "fundingStage": {
            "type": "string",
            "enum": ["Pre-seed", "Seed", "Series A", "Series B", "Late-stage Private", "Public"],
            "description": "Current funding stage"
        },
        "employees": {
            "type": "string",
            "enum": ["1-10", "11-100", "101-1000", "1001+"],
            "description": "Employee count range"
        },
        "website": {
            "type": "string",
            "description": "Company website"
        },
        "aboutTheCompany": {
            "type": "string",
            "description": "Brief company description"
        }
    }
}

Step 4: Create the Task

Submit your task definition to the API, so that it has the information required to run the task in the future:

import requests
import os

API_KEY = os.environ["PARALLEL_API_KEY"]
HEADERS = {
    "x-api-key": API_KEY,
    "Content-Type": "application/json"
}

# Task creation request
task_data = {
    "name": "Company Info Task",
    "description": "Get basic company information",
    "prompt": task_spec,
    "processor": "rhodium",
    "input_schema": input_schema,
    "output_schema": output_schema
}

# Create task
response = requests.post(
    "https://api.parallel.ai/v0/tasks",
    headers=HEADERS,
    json=task_data
)

task_id = response.json()["task_id"]
print(f"Created task: {task_id}")

Or using curl:

curl -X POST "https://api.parallel.ai/v0/tasks" \
-H "x-api-key: $PARALLEL_API_KEY" \
-H "Content-Type: application/json" \
-d @- <<EOF
{
"name": "Company Info Task",
"description": "Get basic company information",
"prompt": "Find and summarize basic information about this company:\n- \
    Year founded\n- Current funding stage\n- Approximate number of employees\n- \
    Official website\n- Brief company description\n\nFocus on consolidating information \
    from:\n- Company website\n- Press releases\n- Official announcements\n- Business registrations",
"processor": "rhodium",
"input_schema": {
        "properties": {
            "company": {
                "type": "string",
                "description": "Company name or website"
            }
        }
    },
    "output_schema": {
        "properties": {
            "founded": {"type": "integer"},
            "fundingStage": {
                "type": "string",
                "enum": ["Pre-seed", "Seed", "Series A", "Series B", "Late-stage Private", "Public"]
            },
            "employees": {
                "type": "string",
                "enum": ["1-10", "11-100", "101-1000", "1001+"]
            },
            "website": {"type": "string"},
            "aboutTheCompany": {"type": "string"}
        }
    }
}
EOF

After you have created your task, you can find the task ID in the response. This is the ID that you will use to run your task. When executing your task, the Task ID and your chosen Runner is required.

Step 5: Execute the Task

Now let’s run the task with a series of companies that we are interested in learning about — notice that this can be as many companies as we like. In this way, the same Task can be applied to thousands of different companies, outputting information on each based on our required input and output schema.

# Example companies to analyze
companies = [
    "Anthropic",
    "Stripe",
    "OpenAI",
    "Stability AI",
    "Mistral AI"
]

# Run task for multiple companies
for company in companies:
    run_data = {
        "arguments": {
            "company": company
        },
        "runner": "rhodium"
    }

    response = requests.post(
        f"https://api.parallel.ai/v0/tasks/{task_id}/runs",
        headers=HEADERS,
        json=run_data
    )

    result = response.json()

Or using curl:

# List of companies to analyze
companies=("Anthropic" "Stripe" "OpenAI" "Stability AI" "Mistral AI")

# Run analysis for each company
for company in "${companies[@]}"; do
    echo -e "\nAnalyzing $company..."

    curl -X POST "https://api.parallel.ai/v0/tasks/$TASK_ID/runs" \
        -H "x-api-key: $PARALLEL_API_KEY" \
        -H "Content-Type: application/json" \
        -d "{
            \"arguments\": {
                \"company\": \"$company\"
            },
            \"runner\": \"rhodium\"
        }" | jq .
done

Next Steps

Now that you have a working company research task, you can:

  1. Experiment with different Runners: In addition to the Rhodium runner, we have a range of other runners available that vary in complexity and capabilities.

  2. Adjust your Task Specification: Design your Task specification to be aligned with your use case.

  3. Scale your Task: Run your Task on a list of companies or a csv document.

  4. Explore Additional Features: Explore Parallel’s ability to continuously monitor and update your Task as new information becomes available (Active Monitoring), run your Task asynchronously (Async API), and more.

Research tasks can take anywhere from a few seconds to a minute or more, depending on the runner and complexity of the company being researched.