Integration Parallel
Parallel Integration
In this guide, we'll show you how to integrate Langfuse with Parallel to trace your AI task operations. By leveraging Langfuse's tracing capabilities, you can automatically capture details such as inputs, outputs, and execution times of your Parallel tasks.
What is Parallel? Parallel develops a suite of web search and web agent APIs that connect AI agents, applications, and workflows to the open internet, enabling programmable tasks from simple searches to complex knowledge work.
What is Langfuse? Langfuse is an open source LLM engineering platform that helps teams trace API calls, monitor performance, and debug issues in their AI applications.
Get Started
First, install the necessary Python packages:
Next, configure your environment with your Parallel and Langfuse API keys. You can get these keys by signing up for a free Langfuse Cloud account or by self-hosting Langfuse and from the Parallel dashboard.
Example 1: Tracing the Parallel Task API
To monitor the Task API requests, we use the Langfuse @observe() decorator. In this example, the @observe() decorator captures the inputs, outputs, and execution time of the parallel_task() function. For more control over the data you are sending to Langfuse, you can use the Context Manager or create manual observations using the Python SDK.
Example 2: Tracing the Parallel Chat API
You can trace the interactions with the Parallel Chat API by using the Langfuse OpenAI wrapper:
Example 3: Parallel Search API and OpenAI
You can also trace more complex workflows that involve summarizing the search results with OpenAI. Here we use the Langfuse @observe() decorator to group both the Parallel search and the OpenAI generation into one trace.
See Traces in Langfuse
After executing the traced functions, log in to your Langfuse Dashboard to view detailed trace logs. You'll be able to see:
- Individual task creation and retrieval operations
- Parallel execution patterns and timing
- Input prompts and output results
- Performance metrics for each task
