@cetra-ai/cli 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +48 -0
  2. package/README.md +14 -2
  3. package/dist/cli.js +2816 -0
  4. package/dist/skills/cetra/SKILL.md +95 -0
  5. package/dist/skills/cetra/references/anthropic.md +82 -0
  6. package/dist/skills/cetra/references/attributes.md +178 -0
  7. package/dist/skills/cetra/references/bedrock.md +46 -0
  8. package/dist/skills/cetra/references/crewai.md +38 -0
  9. package/dist/skills/cetra/references/dspy.md +38 -0
  10. package/dist/skills/cetra/references/from-laminar.md +49 -0
  11. package/dist/skills/cetra/references/from-langfuse.md +59 -0
  12. package/dist/skills/cetra/references/google-adk.md +60 -0
  13. package/dist/skills/cetra/references/google-genai.md +50 -0
  14. package/dist/skills/cetra/references/integrations.md +71 -0
  15. package/dist/skills/cetra/references/langchain.md +76 -0
  16. package/dist/skills/cetra/references/litellm.md +45 -0
  17. package/dist/skills/cetra/references/llama-index.md +38 -0
  18. package/dist/skills/cetra/references/metadata-and-tags.md +117 -0
  19. package/dist/skills/cetra/references/openai-agents.md +55 -0
  20. package/dist/skills/cetra/references/openai.md +82 -0
  21. package/dist/skills/cetra/references/openinference.md +51 -0
  22. package/dist/skills/cetra/references/openllmetry.md +42 -0
  23. package/dist/skills/cetra/references/opentelemetry-genai.md +49 -0
  24. package/dist/skills/cetra/references/opentelemetry.md +134 -0
  25. package/dist/skills/cetra/references/otlp.md +73 -0
  26. package/dist/skills/cetra/references/privacy-controls.md +120 -0
  27. package/dist/skills/cetra/references/python-context.md +63 -0
  28. package/dist/skills/cetra/references/python-opentelemetry.md +136 -0
  29. package/dist/skills/cetra/references/python-tracing.md +77 -0
  30. package/dist/skills/cetra/references/python.md +79 -0
  31. package/dist/skills/cetra/references/sessions.md +84 -0
  32. package/dist/skills/cetra/references/sql-schema.md +210 -0
  33. package/dist/skills/cetra/references/troubleshooting.md +90 -0
  34. package/dist/skills/cetra/references/typescript-context.md +22 -0
  35. package/dist/skills/cetra/references/typescript-opentelemetry.md +68 -0
  36. package/dist/skills/cetra/references/typescript-runtimes.md +54 -0
  37. package/dist/skills/cetra/references/typescript-tracing.md +40 -0
  38. package/dist/skills/cetra/references/typescript.md +56 -0
  39. package/dist/skills/cetra/references/users.md +87 -0
  40. package/dist/skills/cetra/references/vercel-ai-sdk.md +82 -0
  41. package/package.json +39 -4
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: cetra
3
+ description: Add LLM tracing with cetra to an app, with the cetra Python or TypeScript SDK or plain OpenTelemetry, then check that the traces arrive. Use when the user asks to add cetra, LLM observability, or tracing of LLM calls, agents, tools or prompts, or to send OpenTelemetry GenAI spans to cetra.
4
+ license: MIT
5
+ allowed-tools: Bash(npx @cetra-ai/cli query:*) Bash(cetra query:*) Bash(cetra traces:*) Bash(cetra projects:*)
6
+ metadata:
7
+ homepage: https://cetra.sh
8
+ ---
9
+
10
+ # cetra
11
+
12
+ cetra is an open-source LLM observability platform. An app sends OpenTelemetry spans to cetra, and cetra shows them as traces with their prompts, answers, tokens and cost. The cetra SDKs for Python and TypeScript set this up in a few lines, and plain OpenTelemetry works from any language.
13
+
14
+ Follow the steps in order. Keep the change small: add tracing, change nothing else in the app.
15
+
16
+ ## 1. Check the key and the URL
17
+
18
+ The app needs two environment variables:
19
+
20
+ - `CETRA_API_KEY`: a project key that starts with `sk-cetra-`.
21
+ - `CETRA_BASE_URL`: the cetra server, for example `https://eu1.cetra.sh` or `http://localhost:8080`.
22
+
23
+ `npx @cetra-ai/cli init` writes both to `.env`. If they are missing, ask the user to run it. Never ask the user to paste a key into the chat, never write a key into code, and never commit `.env`.
24
+
25
+ The SDKs read the process environment, not the `.env` file. Load `.env` the way the app already loads its settings: `python-dotenv`, `node --env-file=.env`, or the framework's own loader. If the app loads nothing yet, use one of those.
26
+
27
+ ## 2. Find the stack
28
+
29
+ Read the project's manifest (`pyproject.toml`, `requirements.txt`, `package.json`) and the code that calls the model. Then read the matching reference pages:
30
+
31
+ | The app uses | Read |
32
+ |---|---|
33
+ | Python | [python.md](references/python.md), [python-tracing.md](references/python-tracing.md) |
34
+ | TypeScript or JavaScript | [typescript.md](references/typescript.md), [typescript-tracing.md](references/typescript-tracing.md) |
35
+ | A serverless or edge runtime | [typescript-runtimes.md](references/typescript-runtimes.md), [python-opentelemetry.md](references/python-opentelemetry.md) |
36
+ | Another language, or its own OpenTelemetry setup | [opentelemetry.md](references/opentelemetry.md), [otlp.md](references/otlp.md), [python-opentelemetry.md](references/python-opentelemetry.md), [typescript-opentelemetry.md](references/typescript-opentelemetry.md) |
37
+ | OpenAI | [openai.md](references/openai.md) |
38
+ | Anthropic | [anthropic.md](references/anthropic.md) |
39
+ | Amazon Bedrock | [bedrock.md](references/bedrock.md) |
40
+ | Google Gen AI | [google-genai.md](references/google-genai.md) |
41
+ | Google ADK | [google-adk.md](references/google-adk.md) |
42
+ | LangChain or LangGraph | [langchain.md](references/langchain.md) |
43
+ | LlamaIndex | [llama-index.md](references/llama-index.md) |
44
+ | LiteLLM | [litellm.md](references/litellm.md) |
45
+ | OpenAI Agents SDK | [openai-agents.md](references/openai-agents.md) |
46
+ | CrewAI | [crewai.md](references/crewai.md) |
47
+ | DSPy | [dspy.md](references/dspy.md) |
48
+ | Vercel AI SDK | [vercel-ai-sdk.md](references/vercel-ai-sdk.md) |
49
+ | OpenInference instrumentation | [openinference.md](references/openinference.md) |
50
+ | OpenLLMetry (Traceloop) | [openllmetry.md](references/openllmetry.md) |
51
+ | OpenTelemetry GenAI instrumentation | [opentelemetry-genai.md](references/opentelemetry-genai.md) |
52
+ | Langfuse today | [from-langfuse.md](references/from-langfuse.md) |
53
+ | Laminar today | [from-laminar.md](references/from-laminar.md) |
54
+
55
+ [integrations.md](references/integrations.md) lists every integration. A library that is not listed is still traced when it calls a listed provider.
56
+
57
+ ## 3. Add tracing
58
+
59
+ - Install the SDK with the project's package manager: `cetra-sdk` with the extras of the libraries the app uses (for example `cetra-sdk[openai]`), or `@cetra-ai/sdk` with the instrumentation packages its reference page names.
60
+ - Call `init` once, at startup, before the app creates its LLM clients. Pass the instrumentations the reference page gives for each library. Leave `api_key` and `base_url` out: the SDK reads `CETRA_API_KEY` and `CETRA_BASE_URL`.
61
+ - Wrap the app's entry point or request handler with `observe`, so each request is one trace with the LLM calls under it.
62
+ - When the app has conversations or signed-in users, set `session_id` and `user_id` with `context` (Python) or `withContext` (TypeScript). See [sessions.md](references/sessions.md) and [users.md](references/users.md).
63
+ - In scripts, tests and serverless handlers, call `flush()` (Python) or `await flush()` (TypeScript) before the process ends. Otherwise the last spans are lost.
64
+ - If the app already has its own OpenTelemetry setup, keep it, and read the OpenTelemetry page of its language before changing anything.
65
+ - To leave prompts and answers out of the traces, set `CETRA_CAPTURE_CONTENT=false` (or `capture_content=False` / `captureContent: false` in `init`); see [privacy-controls.md](references/privacy-controls.md).
66
+
67
+ ## 4. Run the app
68
+
69
+ Run the app or its tests once, so that it makes at least one LLM call. This needs the provider's own key, for example `OPENAI_API_KEY`. If you cannot make a real call, say so and stop here: the user runs it.
70
+
71
+ ## 5. Check the traces
72
+
73
+ Run:
74
+
75
+ ```bash
76
+ npx @cetra-ai/cli query "SELECT trace_id, name, start_time, span_count, llm_count, error_count FROM traces ORDER BY start_time DESC LIMIT 5" --since 15m --json
77
+ ```
78
+
79
+ The command reads the server and the project from `.cetra/project.json`, which `npx @cetra-ai/cli init` wrote. The columns are in [sql-schema.md](references/sql-schema.md).
80
+
81
+ - **Rows come back:** check that `llm_count` is above 0 and `error_count` is 0. To see the spans of a trace, query the `spans` view with `WHERE trace_id = '<id>'`.
82
+ - **No rows:** read "No traces at all" and "A short script loses its last spans" in [troubleshooting.md](references/troubleshooting.md). The usual causes are a missing `flush()`, a key or URL the app did not load, or `init` called after the LLM client was created.
83
+
84
+ If the user has the `cetra` binary and has run `cetra login`, `cetra query "<sql>" --project <org>/<project> --since 15m --format json` works too. An agent connected to cetra's MCP server can run the same SQL with its `query_sql` tool.
85
+
86
+ ## 6. Report
87
+
88
+ Tell the user which files changed, which libraries are traced, and where to see the traces: `<CETRA_BASE_URL>/<org>/<project>/traces`.
89
+
90
+ ## More
91
+
92
+ - The whole documentation for agents: `https://cetra.sh/llms.txt`.
93
+ - Search the docs with the docs MCP server at `https://cetra.sh/mcp`.
94
+ - Span attributes cetra reads, for hand-made spans: [attributes.md](references/attributes.md) and [metadata-and-tags.md](references/metadata-and-tags.md).
95
+ - Tracing the coding agent itself (Claude Code, Codex, Gemini CLI, Copilot) is a different setup, `cetra agents setup`: see [Claude Code](https://cetra.sh/docs/integrations/claude-code/).
@@ -0,0 +1,82 @@
1
+ <!-- Generated from website/src/content/docs/docs/integrations/anthropic.mdx by website/scripts/skill-references.mjs. Do not edit: run `just docs-gen`. -->
2
+
3
+ # Anthropic
4
+
5
+ Trace Anthropic calls with cetra: messages, streaming, tool use, thinking blocks and cache tokens, from Python and TypeScript.
6
+
7
+ cetra traces Anthropic messages, including streamed answers, tool use, thinking blocks and prompt caching.
8
+
9
+ ## Install
10
+
11
+ **Python**
12
+
13
+ ```bash
14
+ pip install "cetra-sdk[anthropic]" anthropic
15
+ ```
16
+
17
+ **TypeScript**
18
+
19
+ ```bash
20
+ npm install @cetra-ai/sdk @arizeai/openinference-instrumentation-anthropic @anthropic-ai/sdk
21
+ ```
22
+
23
+ ## Set up
24
+
25
+ **Python**
26
+
27
+ ```python
28
+ import cetra
29
+ from anthropic import Anthropic
30
+
31
+ cetra.init(instrument=["anthropic"])
32
+
33
+ client = Anthropic()
34
+ client.messages.create(
35
+ model="claude-sonnet-4-5",
36
+ max_tokens=256,
37
+ messages=[{"role": "user", "content": "What is the weather in Paris?"}],
38
+ )
39
+
40
+ cetra.flush()
41
+ ```
42
+
43
+ **TypeScript**
44
+
45
+ ```ts
46
+ import { init } from "@cetra-ai/sdk";
47
+ import { anthropic } from "@cetra-ai/sdk/anthropic";
48
+ import Anthropic from "@anthropic-ai/sdk";
49
+ ```
50
+
51
+ ```ts
52
+ init({ apiKey: process.env.CETRA_API_KEY, instrument: [anthropic(Anthropic)] });
53
+ ```
54
+
55
+ ```ts
56
+ const client = new Anthropic();
57
+ await client.messages.create({
58
+ model: "claude-sonnet-4-5",
59
+ max_tokens: 256,
60
+ messages: [{ role: "user", content: "What is the weather in Paris?" }],
61
+ });
62
+ ```
63
+
64
+ ## What you get
65
+
66
+ - Each message is an `llm` span with the provider `anthropic`, the input and output as chat messages, and the tools you passed.
67
+ - Streamed answers with a tool call are captured as one span with the text and the tool call.
68
+ - Thinking blocks appear in the output.
69
+ - Cache read and cache write tokens are recorded. The input token count includes them, and cetra prices them separately.
70
+ - The cost is computed from cetra's price table.
71
+
72
+ ## Limits
73
+
74
+ - The fixtures were captured with the Anthropic Python SDK 2.4.0 and these instrumentations: OpenInference 3.3.0 and OpenLLMetry 0.62.4. Other versions are not covered.
75
+ - With OpenLLMetry's Anthropic instrumentation the prompt token count can exclude the cache. cetra adds the cache back, so the stored counts follow one rule.
76
+ - The TypeScript helper is covered by an SDK test, not by captured spans.
77
+
78
+ ## Next
79
+
80
+ - [Traces](https://cetra.sh/docs/tracing/traces/): read the trace as a tree and a timeline.
81
+ - [Cost and tokens](https://cetra.sh/docs/tracing/cost-and-tokens/): how cost is computed from the token counts.
82
+ - [Online rules](https://cetra.sh/docs/evaluation/online-rules/): score these traces automatically.
@@ -0,0 +1,178 @@
1
+ <!-- Generated from website/src/content/docs/docs/reference/attributes.md by website/scripts/skill-references.mjs. Do not edit: run `just docs-gen`. -->
2
+
3
+ # Span attributes
4
+
5
+ Every cetra attribute and every convention attribute cetra reads from a span, with its type and meaning.
6
+
7
+ Use this page to look up which span attribute sets which field in cetra. For how the conventions fit together, see [Semantic conventions](https://cetra.sh/docs/concepts/conventions/).
8
+
9
+ ## cetra attributes
10
+
11
+ The cetra SDKs set these attributes. You can also set them yourself on any OpenTelemetry span. cetra reads them before any other convention.
12
+
13
+ | Attribute | Type | Set by | Meaning |
14
+ |---|---|---|---|
15
+ | `cetra.span.kind` | string | `observe`, `span`, `llm_span` | The span kind: `llm`, `embedding`, `tool`, `agent`, `chain`, `retriever`, `reranker`, `guardrail`, `evaluator` or `span`. |
16
+ | `cetra.input` | string | `observe`, `span` | The span's input: text, JSON or a list of chat messages. |
17
+ | `cetra.input.format` | string | `observe`, `span` | How to read `cetra.input`: `messages`, `json` or `text`. |
18
+ | `cetra.output` | string | `observe`, `span` | The span's output, in the same formats as the input. |
19
+ | `cetra.output.format` | string | `observe`, `span` | How to read `cetra.output`: `messages`, `json` or `text`. |
20
+ | `cetra.session.id` | string | `context` and `withContext` | The session the span's trace belongs to. |
21
+ | `cetra.user.id` | string | `context` and `withContext` | The user the span's trace belongs to. |
22
+ | `cetra.tags` | string list | `context` and `withContext` | Tags on the trace. A list of strings, or a string holding a JSON list of strings. |
23
+ | `cetra.metadata.<key>` | string | `context` and `withContext`, `set_metadata` | One metadata entry. The key after the prefix is the metadata key. Keys use letters, digits, `_`, `.` and `-`. |
24
+ | `cetra.environment` | string | `init` | The environment, such as `production`. |
25
+ | `cetra.release` | string | `init` | The release: a version or a Git SHA. |
26
+ | `cetra.ttft_ns` | integer | `record_first_token` | Time to first token, in nanoseconds. |
27
+ | `cetra.cost.total` | float | `set_cost` | The total cost in USD, reported by your code. cetra does not compute a cost when it is present. |
28
+ | `cetra.experiment.id` | string | `evaluate` | The experiment a span belongs to. |
29
+ | `cetra.dataset_item.id` | string | `evaluate` | The dataset item an experiment run used. |
30
+ | `cetra.prompt.name` | string | `context` and `compile` | The registry prompt the span used. |
31
+ | `cetra.prompt.version` | integer | `context` and `compile` | The version of that prompt, 1 or higher. |
32
+
33
+ ## Set by cetra
34
+
35
+ cetra writes these attributes on its own spans, for example the traces of evaluators and the warnings of normalization. You never set them. A value you send under one of these names is replaced.
36
+
37
+ | Attribute | Type | Meaning |
38
+ |---|---|---|
39
+ | `cetra.experiment_id` | string | The experiment of a span, stored in its metadata. Copied from `cetra.experiment.id`. |
40
+ | `cetra.dataset_item_id` | string | The dataset item of a span, stored in its metadata. Copied from `cetra.dataset_item.id`. |
41
+ | `cetra.eval.target_trace_id` | string | On an evaluator's trace: the trace being evaluated. |
42
+ | `cetra.eval.target_span_id` | string | On an evaluator's trace: the span being evaluated, when the target is a span. |
43
+ | `cetra.eval.rule_id` | string | On an evaluator's trace: the online rule that ran it. |
44
+ | `cetra.eval.experiment_id` | string | On an evaluator's trace: the experiment it scored. |
45
+ | `cetra.eval.evaluator_id` | string | On an evaluator's trace: the evaluator. |
46
+ | `cetra.assistant.user` | string | The user whose assistant turn the trace records. Set by the server on `cetra-assistant` traces. |
47
+ | `cetra.assistant.conversation_id` | string | The assistant conversation of the turn. |
48
+ | `cetra.assistant.prompt_version` | string | The version of the assistant's built-in system prompt. |
49
+ | `cetra.playground.run_by` | string | On a playground run's trace: the user who ran it. |
50
+ | `cetra.playground.source` | string | On a playground run's trace: the prompt it used, `prompt:<name>@<version>`, or the span it came from, `span:<trace>:<span>`. |
51
+ | `cetra.normalize_warning` | string list | Warning codes for recoverable problems found while reading the span, such as `end_before_start`. |
52
+ | `cetra.normalize_error` | string | Codes for a payload that cetra recognized but could not convert. The raw value is kept. |
53
+
54
+ ## Conventions cetra reads
55
+
56
+ When a span carries no cetra attribute for a field, cetra reads the field from the first of these conventions that has a value. [Semantic conventions](https://cetra.sh/docs/concepts/conventions/) lists the order.
57
+
58
+ ### OpenTelemetry GenAI
59
+
60
+ | Attribute | Feeds |
61
+ |---|---|
62
+ | `gen_ai.operation.name` | Span kind and the operation |
63
+ | `gen_ai.provider.name`, `gen_ai.system` | Provider |
64
+ | `gen_ai.request.model` | Request model |
65
+ | `gen_ai.response.model` | Response model |
66
+ | `gen_ai.request.*` | Request parameters |
67
+ | `gen_ai.input.messages` | Input messages |
68
+ | `gen_ai.output.messages` | Output messages |
69
+ | `gen_ai.system_instructions` | System instructions |
70
+ | `gen_ai.tool.definitions` | Tool definitions |
71
+ | `gen_ai.tool.call.arguments`, `gen_ai.tool.call.result` | Input and output of a tool span |
72
+ | `gen_ai.response.finish_reasons` | Finish reason of an output message |
73
+ | `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.usage.total_tokens` | Token counts |
74
+ | `gen_ai.usage.cache_read.input_tokens`, `gen_ai.usage.cache_creation.input_tokens` | Cache token counts |
75
+ | `gen_ai.usage.reasoning.output_tokens` | Reasoning token count |
76
+ | `gen_ai.usage.cost`, `gen_ai.usage.total_cost`, `gen_ai.usage.input_cost`, `gen_ai.usage.output_cost` | Reported cost |
77
+ | `gen_ai.response.time_to_first_chunk` | Time to first token |
78
+ | `gen_ai.conversation.id` | Session |
79
+
80
+ ### OpenInference
81
+
82
+ | Attribute | Feeds |
83
+ |---|---|
84
+ | `openinference.span.kind` | Span kind |
85
+ | `llm.model_name`, `embedding.model_name` | Request model |
86
+ | `llm.response.model_name` | Response model |
87
+ | `llm.provider`, `llm.system` | Provider |
88
+ | `llm.input_messages.N.message.*`, `input.value` | Input |
89
+ | `llm.output_messages.N.message.*`, `output.value` | Output |
90
+ | `input.mime_type`, `output.mime_type` | Format of `input.value` and `output.value` |
91
+ | `llm.tools.N.tool.json_schema` | Tool definitions |
92
+ | `llm.invocation_parameters` | Request parameters |
93
+ | `llm.token_count.prompt`, `llm.token_count.completion`, `llm.token_count.total` | Token counts |
94
+ | `llm.token_count.prompt_details.cache_read`, `llm.token_count.prompt_details.cache_write` | Cache token counts |
95
+ | `llm.token_count.completion_details.reasoning` | Reasoning token count |
96
+ | `llm.cost.total`, `llm.cost.prompt`, `llm.cost.completion` | Reported cost |
97
+ | `session.id`, `user.id` | Session and user |
98
+ | `metadata`, `tag.tags` | Metadata and tags |
99
+
100
+ ### OpenLLMetry
101
+
102
+ | Attribute | Feeds |
103
+ |---|---|
104
+ | `traceloop.span.kind` | Span kind |
105
+ | `llm.request.type` | Span kind |
106
+ | `gen_ai.prompt.N.*` | Input messages |
107
+ | `gen_ai.completion.N.*` | Output messages |
108
+ | `traceloop.entity.input`, `traceloop.entity.output` | Input and output when there are no messages |
109
+ | `llm.request.functions.N.*` | Tool definitions |
110
+ | `traceloop.association.properties.session_id`, `traceloop.association.properties.user_id` | Session and user |
111
+ | `traceloop.association.properties.*` | Metadata |
112
+ | `traceloop.workflow.name` | Metadata key `workflow` |
113
+
114
+ ### Vercel AI SDK
115
+
116
+ | Attribute | Feeds |
117
+ |---|---|
118
+ | `ai.operationId` | Span kind |
119
+ | `ai.model.id`, `ai.response.model` | Request and response model |
120
+ | `ai.model.provider` | Provider |
121
+ | `ai.prompt.messages`, `ai.prompt` | Input |
122
+ | `ai.response.text`, `ai.response.toolCalls`, `ai.response.object` | Output |
123
+ | `ai.toolCall.args`, `ai.toolCall.result` | Input and output of a tool span |
124
+ | `ai.prompt.tools` | Tool definitions |
125
+ | `ai.usage.inputTokens`, `ai.usage.outputTokens`, `ai.usage.totalTokens` | Token counts |
126
+ | `ai.usage.inputTokenDetails.cacheReadTokens`, `ai.usage.inputTokenDetails.cacheWriteTokens` | Cache token counts |
127
+ | `ai.usage.outputTokenDetails.reasoningTokens` | Reasoning token count |
128
+ | `ai.response.msToFirstChunk` | Time to first token |
129
+ | `ai.settings.*` | Request parameters |
130
+ | `ai.telemetry.metadata.sessionId`, `ai.telemetry.metadata.userId` | Session and user |
131
+ | `ai.telemetry.metadata.tags` | Tags |
132
+ | `ai.telemetry.metadata.*`, `ai.telemetry.functionId` | Metadata |
133
+
134
+ ### Langfuse
135
+
136
+ | Attribute | Feeds |
137
+ |---|---|
138
+ | `langfuse.observation.type` | Span kind |
139
+ | `langfuse.observation.input`, `langfuse.trace.input` | Input |
140
+ | `langfuse.observation.output`, `langfuse.trace.output` | Output |
141
+ | `langfuse.observation.model.name` | Request model |
142
+ | `langfuse.observation.model.parameters` | Request parameters |
143
+ | `langfuse.observation.usage_details` | Token counts |
144
+ | `langfuse.observation.cost_details` | Reported cost |
145
+ | `langfuse.observation.completion_start_time` | Time to first token |
146
+ | `langfuse.observation.level`, `langfuse.observation.status_message` | Status and status message |
147
+ | `langfuse.session.id`, `langfuse.user.id` | Session and user |
148
+ | `langfuse.trace.tags` | Tags |
149
+ | `langfuse.trace.metadata.*` | Metadata |
150
+ | `langfuse.environment`, `langfuse.release` | Environment and release |
151
+
152
+ ### Laminar
153
+
154
+ | Attribute | Feeds |
155
+ |---|---|
156
+ | `lmnr.span.type` | Span kind |
157
+ | `lmnr.span.input`, `lmnr.span.output` | Input and output |
158
+ | `lmnr.association.properties.session_id`, `lmnr.association.properties.user_id` | Session and user |
159
+ | `lmnr.association.properties.tags` | Tags |
160
+ | `lmnr.association.properties.metadata.*` | Metadata |
161
+ | `lmnr.span.release` | Release |
162
+
163
+ ### Google ADK
164
+
165
+ | Attribute | Feeds |
166
+ |---|---|
167
+ | `gcp.vertex.agent.llm_request` | Input messages, system instructions and tool definitions |
168
+ | `gcp.vertex.agent.llm_response` | Output message, finish reason and token counts |
169
+ | `gcp.vertex.agent.tool_call_args`, `gcp.vertex.agent.tool_response` | Input and output of a tool span |
170
+ | `gcp.vertex.agent.session_id` | Session |
171
+
172
+ ### Resource attributes
173
+
174
+ | Attribute | Feeds |
175
+ |---|---|
176
+ | `service.name` | Service name |
177
+ | `service.version` | Release |
178
+ | `deployment.environment.name`, `deployment.environment` | Environment |
@@ -0,0 +1,46 @@
1
+ <!-- Generated from website/src/content/docs/docs/integrations/bedrock.mdx by website/scripts/skill-references.mjs. Do not edit: run `just docs-gen`. -->
2
+
3
+ # Amazon Bedrock
4
+
5
+ Trace Amazon Bedrock calls with cetra from Python, with the OpenInference Bedrock instrumentation.
6
+
7
+ cetra can trace Amazon Bedrock calls from Python through the OpenInference Bedrock instrumentation.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install "cetra-sdk[bedrock]" boto3
13
+ ```
14
+
15
+ ## Set up
16
+
17
+ ```python
18
+ import boto3
19
+
20
+ import cetra
21
+
22
+ cetra.init(instrument=["bedrock"])
23
+
24
+ client = boto3.client("bedrock-runtime")
25
+ client.converse(
26
+ modelId="anthropic.claude-3-5-sonnet-20240620-v1:0",
27
+ messages=[{"role": "user", "content": [{"text": "What is the weather in Paris?"}]}],
28
+ )
29
+
30
+ cetra.flush()
31
+ ```
32
+
33
+ ## What you get
34
+
35
+ cetra reads the spans of the OpenInference Bedrock instrumentation with the OpenInference convention. See [Semantic conventions](https://cetra.sh/docs/concepts/conventions/).
36
+
37
+ ## Limits
38
+
39
+ - No captured spans of this instrumentation are in the repository. The only check is an SDK test that imports the instrumentor when the extra is installed. This page does not say which Bedrock operations are traced or which fields they fill.
40
+ - If a field is missing, look at the span's **Attributes** tab and compare it with [Span attributes](https://cetra.sh/docs/reference/attributes/).
41
+
42
+ ## Next
43
+
44
+ - [Traces](https://cetra.sh/docs/tracing/traces/): read the trace as a tree and a timeline.
45
+ - [Cost and tokens](https://cetra.sh/docs/tracing/cost-and-tokens/): how cost is computed from the token counts.
46
+ - [Online rules](https://cetra.sh/docs/evaluation/online-rules/): score these traces automatically.
@@ -0,0 +1,38 @@
1
+ <!-- Generated from website/src/content/docs/docs/integrations/crewai.mdx by website/scripts/skill-references.mjs. Do not edit: run `just docs-gen`. -->
2
+
3
+ # CrewAI
4
+
5
+ Trace CrewAI with cetra from Python, with the OpenInference CrewAI instrumentation.
6
+
7
+ cetra can trace CrewAI crews, agents, tasks and tool uses from Python through the OpenInference CrewAI instrumentation.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install "cetra-sdk[crewai]" crewai
13
+ ```
14
+
15
+ ## Set up
16
+
17
+ ```python
18
+ import cetra
19
+
20
+ cetra.init(instrument=["crewai"])
21
+
22
+ # Build and run your crew as usual. CrewAI runs are traced from here on.
23
+ ```
24
+
25
+ ## What you get
26
+
27
+ cetra reads the spans of the OpenInference CrewAI instrumentation with the OpenInference convention. See [Semantic conventions](https://cetra.sh/docs/concepts/conventions/).
28
+
29
+ ## Limits
30
+
31
+ - No captured spans of this instrumentation are in the repository. The only check is an SDK test that imports the instrumentor when the extra is installed. This page does not say which CrewAI operations are traced.
32
+ - If a field is missing, look at the span's **Attributes** tab and compare it with [Span attributes](https://cetra.sh/docs/reference/attributes/).
33
+
34
+ ## Next
35
+
36
+ - [Traces](https://cetra.sh/docs/tracing/traces/): read the trace as a tree and a timeline.
37
+ - [Cost and tokens](https://cetra.sh/docs/tracing/cost-and-tokens/): how cost is computed from the token counts.
38
+ - [Online rules](https://cetra.sh/docs/evaluation/online-rules/): score these traces automatically.
@@ -0,0 +1,38 @@
1
+ <!-- Generated from website/src/content/docs/docs/integrations/dspy.mdx by website/scripts/skill-references.mjs. Do not edit: run `just docs-gen`. -->
2
+
3
+ # DSPy
4
+
5
+ Trace DSPy with cetra from Python, with the OpenInference DSPy instrumentation.
6
+
7
+ cetra can trace DSPy modules and model calls from Python through the OpenInference DSPy instrumentation.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install "cetra-sdk[dspy]" dspy
13
+ ```
14
+
15
+ ## Set up
16
+
17
+ ```python
18
+ import cetra
19
+
20
+ cetra.init(instrument=["dspy"])
21
+
22
+ # Configure and call your DSPy modules as usual. They are traced from here on.
23
+ ```
24
+
25
+ ## What you get
26
+
27
+ cetra reads the spans of the OpenInference DSPy instrumentation with the OpenInference convention. See [Semantic conventions](https://cetra.sh/docs/concepts/conventions/).
28
+
29
+ ## Limits
30
+
31
+ - No captured spans of this instrumentation are in the repository. The only check is an SDK test that imports the instrumentor when the extra is installed. This page does not say which DSPy operations are traced.
32
+ - If a field is missing, look at the span's **Attributes** tab and compare it with [Span attributes](https://cetra.sh/docs/reference/attributes/).
33
+
34
+ ## Next
35
+
36
+ - [Traces](https://cetra.sh/docs/tracing/traces/): read the trace as a tree and a timeline.
37
+ - [Cost and tokens](https://cetra.sh/docs/tracing/cost-and-tokens/): how cost is computed from the token counts.
38
+ - [Online rules](https://cetra.sh/docs/evaluation/online-rules/): score these traces automatically.
@@ -0,0 +1,49 @@
1
+ <!-- Generated from website/src/content/docs/docs/integrations/from-laminar.mdx by website/scripts/skill-references.mjs. Do not edit: run `just docs-gen`. -->
2
+
3
+ # Migrating from Laminar
4
+
5
+ Keep the Laminar SDK and send its spans to cetra: what carries over (sessions, users, tags, metadata) and what changes.
6
+
7
+ cetra reads the spans that the Laminar Python SDK produces, so you can keep your Laminar instrumentation while you move.
8
+
9
+ ## Point the exporter at cetra
10
+
11
+ Laminar can export OpenTelemetry over HTTP to a base URL and a port, and sends your project key as a bearer token. The fixtures were captured with these settings, with the host and the key changed.
12
+
13
+ ```python
14
+ from lmnr import Laminar
15
+
16
+ Laminar.initialize(
17
+ project_api_key="<SK_CETRA_KEY>",
18
+ base_url="http://localhost",
19
+ http_port=8080,
20
+ force_http=True,
21
+ )
22
+ ```
23
+
24
+ Replace `<SK_CETRA_KEY>` with your `sk-cetra-` API key.
25
+
26
+ ## What carries over
27
+
28
+ The fixtures show the Laminar SDK 0.8.8 producing these, and cetra reading them:
29
+
30
+ - `@observe` spans become `chain` spans, and LLM spans become `llm` spans, with the OpenAI messages, the model, the token counts including cache and reasoning tokens, and the cost.
31
+ - Session ID, user ID, tags and metadata set on `@observe` become the cetra session, user, tags and metadata. The LLM child span carries the session and user too.
32
+ - Tool spans keep their input as JSON and their output as text.
33
+ - Streamed completions are captured.
34
+
35
+ ## What changes
36
+
37
+ - Laminar's evaluations, datasets and scores are not spans. Use cetra's [Scores](https://cetra.sh/docs/evaluation/scores/), [Datasets](https://cetra.sh/docs/evaluation/datasets/) and [Experiments](https://cetra.sh/docs/evaluation/experiments/).
38
+ - Spans arrive in cetra under cetra's own names and fields. See [Span attributes](https://cetra.sh/docs/reference/attributes/) for the Laminar attributes cetra reads.
39
+
40
+ ## Limits
41
+
42
+ - The fixtures are Python only.
43
+ - The settings above export over HTTP. Laminar's default export is gRPC. The fixtures were captured over HTTP.
44
+
45
+ ## Next
46
+
47
+ - [Traces](https://cetra.sh/docs/tracing/traces/): read the trace as a tree and a timeline.
48
+ - [Cost and tokens](https://cetra.sh/docs/tracing/cost-and-tokens/): how cost is computed from the token counts.
49
+ - [Online rules](https://cetra.sh/docs/evaluation/online-rules/): score these traces automatically.
@@ -0,0 +1,59 @@
1
+ <!-- Generated from website/src/content/docs/docs/integrations/from-langfuse.mdx by website/scripts/skill-references.mjs. Do not edit: run `just docs-gen`. -->
2
+
3
+ # Migrating from Langfuse
4
+
5
+ Keep the Langfuse Python SDK and send its spans to cetra: what carries over (sessions, users, tags, metadata, cost) and what changes.
6
+
7
+ cetra reads the spans that the Langfuse Python SDK produces, so you can keep your Langfuse instrumentation while you move.
8
+
9
+ ## Point the exporter at cetra
10
+
11
+ The Langfuse SDK builds on OpenTelemetry and installs its own tracer provider. By default it exports to Langfuse. To send its spans to cetra, add an OTLP exporter to that provider after you create the client.
12
+
13
+ ```python
14
+ from langfuse import Langfuse
15
+ from opentelemetry import trace
16
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
17
+ from opentelemetry.sdk.trace.export import BatchSpanProcessor
18
+
19
+ langfuse = Langfuse()
20
+
21
+ trace.get_tracer_provider().add_span_processor(
22
+ BatchSpanProcessor(
23
+ OTLPSpanExporter(
24
+ endpoint="http://localhost:8080/v1/traces",
25
+ headers={"Authorization": "Bearer <SK_CETRA_KEY>"},
26
+ )
27
+ )
28
+ )
29
+ ```
30
+
31
+ Replace `<SK_CETRA_KEY>` with your `sk-cetra-` API key.
32
+
33
+ ## What carries over
34
+
35
+ The fixtures show the Langfuse SDK 5.1.0 producing these, and cetra reading them:
36
+
37
+ - `@observe` spans, with `as_type="tool"` becoming a `tool` span and generations becoming `llm` spans.
38
+ - The input and output of decorated functions, and the messages of the OpenAI drop-in.
39
+ - Session ID, user ID and tags, set at trace level, become the cetra session, user and tags. Trace metadata becomes metadata.
40
+ - The model, model parameters and `usage_details`, including cached and reasoning tokens.
41
+ - A reported cost (`cost_details`) is kept as the reported cost, and cetra does not replace it with a computed one.
42
+ - `completion_start_time` gives the time to first token.
43
+ - An observation with level `ERROR` has the status `error`.
44
+
45
+ ## What changes
46
+
47
+ - Scores and datasets are not spans, so they do not move with the exporter. Write scores with the cetra SDK or the API. See [Scores](https://cetra.sh/docs/evaluation/scores/).
48
+ - Spans arrive in cetra under cetra's own names and fields. See [Span attributes](https://cetra.sh/docs/reference/attributes/) for the Langfuse attributes cetra reads.
49
+
50
+ ## Limits
51
+
52
+ - The fixtures are Python only.
53
+ - The exporter wiring above is not covered by a test. The fixtures cover the spans, not their delivery.
54
+
55
+ ## Next
56
+
57
+ - [Traces](https://cetra.sh/docs/tracing/traces/): read the trace as a tree and a timeline.
58
+ - [Cost and tokens](https://cetra.sh/docs/tracing/cost-and-tokens/): how cost is computed from the token counts.
59
+ - [Online rules](https://cetra.sh/docs/evaluation/online-rules/): score these traces automatically.
@@ -0,0 +1,60 @@
1
+ <!-- Generated from website/src/content/docs/docs/integrations/google-adk.mdx by website/scripts/skill-references.mjs. Do not edit: run `just docs-gen`. -->
2
+
3
+ # Google ADK
4
+
5
+ Trace Google ADK agents with cetra from Python: invocations, agent runs, model calls and tool calls, over OpenTelemetry.
6
+
7
+ cetra reads the spans that Google's Agent Development Kit emits itself, and the spans of OpenInference's ADK instrumentation.
8
+
9
+ ## Point the exporter at cetra
10
+
11
+ ADK emits OpenTelemetry spans through the global tracer provider. Install a provider that exports to cetra before you run the agent. This is the setup the fixtures were captured with, with the endpoint and the key changed.
12
+
13
+ ```python
14
+ from opentelemetry import trace
15
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
16
+ from opentelemetry.sdk.trace import TracerProvider
17
+ from opentelemetry.sdk.trace.export import BatchSpanProcessor
18
+
19
+ provider = TracerProvider()
20
+ provider.add_span_processor(
21
+ BatchSpanProcessor(
22
+ OTLPSpanExporter(
23
+ endpoint="http://localhost:8080/v1/traces",
24
+ headers={"Authorization": "Bearer <SK_CETRA_KEY>"},
25
+ )
26
+ )
27
+ )
28
+ trace.set_tracer_provider(provider)
29
+
30
+ # Build and run your ADK agent as usual, then:
31
+ provider.shutdown()
32
+ ```
33
+
34
+ Replace `<SK_CETRA_KEY>` with your `sk-cetra-` API key. See [Send OpenTelemetry](https://cetra.sh/docs/get-started/opentelemetry/).
35
+
36
+ ## What you get
37
+
38
+ With ADK's own spans, a run with one tool produces:
39
+
40
+ - an `invocation` span, and an `agent` span for the agent;
41
+ - a `chain` span for each `call_llm`, with the model, the instructions and the tool declarations;
42
+ - an `llm` span for each model call, with the provider, token counts and cost;
43
+ - a `tool` span for each `execute_tool`.
44
+
45
+ The session ID of the ADK session is the cetra session. Streaming runs and runs with thinking enabled are captured, and reasoning tokens are added to the output count.
46
+
47
+ ## OpenInference's ADK instrumentation
48
+
49
+ You can use `openinference-instrumentation-google-adk` instead. Its spans carry the session and the user, and the `call_llm` span is the `llm` span.
50
+
51
+ ## Limits
52
+
53
+ - The fixtures were captured with `google-adk` 2.14.0 and `google-genai` 2.34.0, and with `openinference-instrumentation-google-adk` 1.1.0.
54
+ - `cetra-sdk` has no `instrument` name for ADK.
55
+
56
+ ## Next
57
+
58
+ - [Traces](https://cetra.sh/docs/tracing/traces/): read the trace as a tree and a timeline.
59
+ - [Cost and tokens](https://cetra.sh/docs/tracing/cost-and-tokens/): how cost is computed from the token counts.
60
+ - [Online rules](https://cetra.sh/docs/evaluation/online-rules/): score these traces automatically.