.agents/skills/opik-external-integrations/workflow.md
End-to-end playbook for building an Opik integration that lives in an external repo or package. Runs autonomously by default; pause at the design gate only if the user asks to review first. Always end with the Phase 8 report, and back every "supported" claim with a passing test or an MCP-verified trace.
Ask the user, in plain language, and wait for answers. Do not propose a target.
opik-openclaw).opik-* package/plugin · upstream contribution into a third-party project (LiteLLM, Dify, …) · tool/IDE plugin.CONTRIBUTING/AGENTS.md; its test framework; its docs location.Before acquiring, check references.md — known external integrations (standalone opik-* plugins + the cookiecutter template, and third-party hosts like LiteLLM / Dify / n8n / Flowise / Langflow) with their repo and Opik-docs URLs. If the target is listed or resembles one, start from those links and pick the closest as the clone source; a brand-new standalone package starts from opik-project-template.
Then acquire the repo: clone/checkout into the scratchpad (or add it to the session if supported). Confirm it builds/installs before changing anything. Restate the answers in one line and proceed.
Pick the public Opik API to use — never this repo's internals:
import opik, @opik.track, track_* wrappers, or opik.Opik() client; opik.opik_context for span data; client.flush().opik package — Opik client, track, domain objects; flushAll().Confirm the published SDK version to depend on, and how the host will configure Opik (env vars: OPIK_API_KEY, base URL, workspace, project).
Write down: the host extension point used; how the Opik client is created/configured and flushed; the mapping from host data → Opik trace/span fields (input/output/model/provider/usage/error/span-type); the file layout inside the host (mirroring its sibling); and the public registration the host user performs to enable it. In autonomous mode, record this in the report; in interactive mode, present and wait for approval.
Mirror the host's closest sibling and its style. Depend on the published Opik SDK. Keep the integration transparent (wrap, capture, re-raise; no behavior change when Opik is unconfigured). Flush appropriately for the host's lifecycle (request end, process exit, explicit hook).
The proof the integration logs correctly — do not rely on reading code.
list then read).type; input/output well-shaped; usage with token counts; model/provider set; errors recorded and re-raised.Use the host's test framework and conventions (not fake_backend/testlib, which are this repo's). Mirror how the host tests its other integrations — mock the Opik client/HTTP at the host's boundary where the host does, or assert against captured calls. Cover the same flows you verified in Phase 5.
Follow the host's docs conventions (its README / docs site / examples dir). Optionally add or update an Opik-side docs page that points to the external integration, using the write-docs skill. Credential placeholders only.
Produce a high-level report:
Implementation merged-quality in the host checkout, MCP verification passed, tests added per host conventions and passing, host docs updated, report produced. If you changed files under .agents/ in this repo, run make claude.