@pronative.ai/opencode-observability-plugin
v0.1.1
Published
OpenCode plugin that sends session telemetry to Langfuse.
Readme
pronative.ai OpenCode Observability Plugin
OpenCode plugin that captures and sends OpenCode session telemetry to Langfuse. It traces user turns, assistant generations, tool calls, retries, reasoning output, compaction output, and failed generation steps.
Quick Start
Enable the plugin and add your telemetry credentials in .opencode/opencode.jsonc (or opencode.json):
{
"experimental": {
"openTelemetry": true,
},
"plugin": ["@pronative.ai/opencode-observability-plugin@latest"],
"otel": {
"publicKey": "pk-lf-...",
"secretKey": "sk-lf-...",
"baseUrl": "https://cloud.langfuse.com",
"environment": "development",
"userId": "your-user-id",
"attributes": "style=adhoc;attempt=1,name=test;",
},
}Restart OpenCode after changing the configuration.
Configuration Reference
The otel section in your .opencode/opencode.jsonc or opencode.json accepts the following properties:
| Property | Type | Required | Default | Description |
| ------------- | -------------------- | -------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| publicKey | string | Yes | — | Your Langfuse public API key (pk-lf-...) |
| secretKey | string | Yes | — | Your Langfuse secret API key (sk-lf-...) |
| baseUrl | string | No | https://cloud.langfuse.com | Langfuse host URL (use your self-hosted URL if applicable) |
| environment | string | No | training | Deployment environment tag (e.g. production, staging) |
| userId | string | No | — | Identifier for attributing traces to a specific user |
| serviceName | string | No | opencode | OpenTelemetry service name |
| attributes | string | object | No | — | Custom OpenTelemetry span/resource attributes. Supports delimited string (, or ;, e.g. "k1=v1;k2=v2") or key-value object |
[!TIP] Both
.jsoncand.jsonfile formats are supported in.opencode/or in the root project folder. Single-line (//) and multi-line (/* */) comments as well as trailing commas are supported in.jsonc.
Sample Configuration (with AgentGateway)
Below is a complete .opencode/opencode.jsonc configured with the observability plugin, Langfuse credentials, and the Pronative AgentGateway provider:
{
"experimental": {
"openTelemetry": true
},
"plugin": ["@pronative.ai/opencode-observability-plugin@latest"],
"otel": {
"publicKey": "pk-lf-...",
"secretKey": "sk-lf-...",
"baseUrl": "https://cloud.langfuse.com",
"environment": "development",
"userId": "your-user-id",
"attributes": {
"k1": "v1",
"k2": "v2"
}
},
"provider": {
"agentgateway": {
"npm": "@ai-sdk/openai-compatible",
"name": "AgentGateway",
"options": {
"baseURL": "https://<your-agent-gateway-url>",
"apiKey": "<your-agentgateway-api-key>"
},
"models": {
"DeepSeek-V4-Pro": {
"name": "DeepSeek V4 Pro"
},
"gpt-5.4": {
"name": "gpt-5.4"
}
}
}
}
}Supported Versions
Validated OpenCode versions:
1.15.131.18.19
Contributing
See the contributing guide.
License
Acknowledgments
This project is a fork of the open-source opencode-observability-plugin originally created by Langfuse GmbH.
