Opik Integration¶
Overview¶
Comet Opik is a comprehensive observability platform designed for agentic systems. The bridgic-callbacks-trace-opik package enables seamless integration of Opik into your Bridgic-based agentic workflows.
This integration is primarily supported by OpikTraceCallback, a WorkerCallback implementation that automatically instruments the worker execution with Opik tracing, which provides comprehensive observability by:
- Worker Execution Traces Tracking: Record the execution of each worker as a span in Opik, allowing to visualize start/end time, duration.
- Worker Execution Data Reporting: Capture the input, output and other necessary information and then log to the opik platform.
- Hierarchical Trace Structure: Organize execution traces in a hierarchy that reflects the nesting between automa layers, making it straightforward to see how top-level automa is composed of the execution of multiple nested workers.
Prerequisites¶
Comet provides a hosted version of the Opik platform, or you can run the platform locally.
- To use the hosted version, you need to create a Comet account and grab your API Key.
- To run the Opik platform locally, see the installation guide for more information.
Using Opik in Bridgic¶
Step 1: Install package¶
Step 2: Configure Opik¶
The recommended approach to configuring the Python SDK is to use the opik configure command. This will prompt you to set up your API key and Opik instance URL (if applicable) to ensure proper routing and authentication. All details will be saved to a configuration file.
If you are using the Cloud version of the platform, you can configure the SDK by running:
You can also configure the SDK by calling configure from the Command line:
The configure methods will prompt you for the necessary information and save it to a configuration file (~/.opik.config). When using the command line version, you can use the -y or --yes flag to automatically approve any confirmation prompts:
Step 3: Register the callback¶
Just build your application using normal Bridgic-style orchestration and register the callback at the scope that you need. The below example shows how to register OpikTraceCallback to apply opik tracing for all workers application wide.
Once your Bridgic application has finished running, your terminal might display the following message:
You can dive into the Opik app to explore rich visual insights and detailed traces of your workflow.