Musterby Elitery
Integrations

Parallel AI

Trace Parallel AI task and search operations in Muster via the @observe decorator.

Parallel AI runs research and search tasks at scale. Wrap its calls with Muster's @observe() decorator to capture inputs, outputs, and execution metrics.

Setup

%pip install langfuse parallel-web openai
import os

os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-lf-..."
os.environ["LANGFUSE_SECRET_KEY"] = "sk-lf-..."
os.environ["LANGFUSE_BASE_URL"] = "https://app.getmuster.io"
os.environ["PARALLEL_API_KEY"] = "..."

Trace a Parallel task

from parallel import Parallel
from langfuse import observe

@observe(as_type="retriever")
def parallel_task(input: str):
    client = Parallel(api_key=os.environ["PARALLEL_API_KEY"])
    task_run = client.task_run.create(input=input)
    return client.task_run.result(task_run.run_id)

Combined: search + summarise

from langfuse.openai import OpenAI

@observe()
def search_and_summarize(objective: str):
    parallel_client = Parallel(api_key=os.environ["PARALLEL_API_KEY"])
    results = parallel_client.beta.search(objective=objective)

    openai_client = OpenAI()
    return openai_client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": f"Summarise:\n{results}"}],
    )

See also