struct-sdk 0.2.15__tar.gz → 0.2.23__tar.gz
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.
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/PKG-INFO +26 -2
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/README.md +24 -1
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/pyproject.toml +8 -2
- struct_sdk-0.2.23/src/struct_sdk/_genai_content.py +580 -0
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/src/struct_sdk/anthropic.py +262 -103
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/src/struct_sdk/core.py +105 -8
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/src/struct_sdk/langchain.py +73 -10
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/src/struct_sdk/openai.py +98 -81
- struct_sdk-0.2.15/src/struct_sdk/_genai_content.py +0 -265
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/.gitignore +0 -0
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/LICENSE +0 -0
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/src/struct_sdk/__init__.py +0 -0
- {struct_sdk-0.2.15 → struct_sdk-0.2.23}/src/struct_sdk/claude_agent.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: struct-sdk
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.23
|
|
4
4
|
Summary: Struct agent observability SDK — auto-instruments AI agent frameworks with OpenTelemetry
|
|
5
5
|
Project-URL: Homepage, https://struct.ai
|
|
6
6
|
Project-URL: Documentation, https://struct.ai/docs
|
|
@@ -28,6 +28,7 @@ Provides-Extra: anthropic
|
|
|
28
28
|
Requires-Dist: anthropic>=0.30.0; extra == 'anthropic'
|
|
29
29
|
Provides-Extra: claude-agent-sdk
|
|
30
30
|
Requires-Dist: claude-agent-sdk>=0.1.59; extra == 'claude-agent-sdk'
|
|
31
|
+
Requires-Dist: mcp>=1.28.1; extra == 'claude-agent-sdk'
|
|
31
32
|
Provides-Extra: demo
|
|
32
33
|
Requires-Dist: langchain-anthropic>=1.4.6; extra == 'demo'
|
|
33
34
|
Requires-Dist: langchain-core>=1.3.3; extra == 'demo'
|
|
@@ -380,7 +381,7 @@ backlink still renders.
|
|
|
380
381
|
Emits attributes per the OTel GenAI semantic conventions:
|
|
381
382
|
|
|
382
383
|
- `gen_ai.operation.name` — `chat`, `execute_tool`, `invoke_agent`, `retrieval`
|
|
383
|
-
- `gen_ai.provider.name` — `anthropic`, `openai`, `
|
|
384
|
+
- `gen_ai.provider.name` — the GenAI provider on inference spans (`anthropic`, `openai`, …); platform-routed calls report the platform value (`aws.bedrock`, `gcp.vertex_ai`, `azure.ai.openai`) when detectable from the client. `invoke_agent` spans inherit the provider from their first child inference call (omitted when no model is reached); `execute_tool`/`retrieval` spans carry no provider.
|
|
384
385
|
- `gen_ai.request.{model, max_tokens, temperature, top_p, top_k, stop_sequences}`
|
|
385
386
|
- `gen_ai.response.{model, id, finish_reasons}`
|
|
386
387
|
- `gen_ai.usage.{input_tokens, output_tokens, cache_read.input_tokens, cache_creation.input_tokens}`
|
|
@@ -388,6 +389,29 @@ Emits attributes per the OTel GenAI semantic conventions:
|
|
|
388
389
|
- `gen_ai.tool.{name, call.id, call.arguments, call.result}`
|
|
389
390
|
- `error.type` + `StatusCode.ERROR` on failures
|
|
390
391
|
|
|
392
|
+
### `error.type` values emitted
|
|
393
|
+
|
|
394
|
+
The OTel conventions ask instrumentations to document the error values
|
|
395
|
+
they report ("Instrumentations SHOULD document the list of errors they
|
|
396
|
+
report"). This SDK emits exactly two kinds of value, both alongside
|
|
397
|
+
span `StatusCode.ERROR`:
|
|
398
|
+
|
|
399
|
+
| Value | When | Meaning |
|
|
400
|
+
| --- | --- | --- |
|
|
401
|
+
| exception class name (e.g. `RuntimeError`, `httpx.ConnectError`) | the instrumented call raised | We failed to execute the request. Also records an OTel exception event. |
|
|
402
|
+
| `tool_error` | an `execute_tool` span whose result signalled failure **in band** — Anthropic `tool_result` blocks with `is_error: true`, MCP `CallToolResult.isError`, or a LangChain `ToolMessage` with `status="error"` | The tool ran and reported a failure back to the model (bad arguments, a domain "no"), so the model can self-correct. No exception object exists, so no class name is available. |
|
|
403
|
+
|
|
404
|
+
`tool_error` is a deliberate low-cardinality sentinel, which the
|
|
405
|
+
`error.type` convention explicitly permits ("another low-cardinality
|
|
406
|
+
error identifier"; a custom value MAY be used where no well-known one
|
|
407
|
+
applies). The same split is used by OpenTelemetry's MCP instrumentation
|
|
408
|
+
in OpenLLMetry, which likewise reports `error.type="tool_error"` for the
|
|
409
|
+
`isError` path and the exception class name otherwise.
|
|
410
|
+
|
|
411
|
+
The distinction is what lets a monitor page on genuine execution
|
|
412
|
+
failures while excluding failures the model already saw and can recover
|
|
413
|
+
from.
|
|
414
|
+
|
|
391
415
|
Note: `gen_ai.usage.input_tokens` for Anthropic is the true total — the
|
|
392
416
|
SDK adds back `cache_read_input_tokens` and
|
|
393
417
|
`cache_creation_input_tokens`, which Anthropic's raw response excludes
|
|
@@ -332,7 +332,7 @@ backlink still renders.
|
|
|
332
332
|
Emits attributes per the OTel GenAI semantic conventions:
|
|
333
333
|
|
|
334
334
|
- `gen_ai.operation.name` — `chat`, `execute_tool`, `invoke_agent`, `retrieval`
|
|
335
|
-
- `gen_ai.provider.name` — `anthropic`, `openai`, `
|
|
335
|
+
- `gen_ai.provider.name` — the GenAI provider on inference spans (`anthropic`, `openai`, …); platform-routed calls report the platform value (`aws.bedrock`, `gcp.vertex_ai`, `azure.ai.openai`) when detectable from the client. `invoke_agent` spans inherit the provider from their first child inference call (omitted when no model is reached); `execute_tool`/`retrieval` spans carry no provider.
|
|
336
336
|
- `gen_ai.request.{model, max_tokens, temperature, top_p, top_k, stop_sequences}`
|
|
337
337
|
- `gen_ai.response.{model, id, finish_reasons}`
|
|
338
338
|
- `gen_ai.usage.{input_tokens, output_tokens, cache_read.input_tokens, cache_creation.input_tokens}`
|
|
@@ -340,6 +340,29 @@ Emits attributes per the OTel GenAI semantic conventions:
|
|
|
340
340
|
- `gen_ai.tool.{name, call.id, call.arguments, call.result}`
|
|
341
341
|
- `error.type` + `StatusCode.ERROR` on failures
|
|
342
342
|
|
|
343
|
+
### `error.type` values emitted
|
|
344
|
+
|
|
345
|
+
The OTel conventions ask instrumentations to document the error values
|
|
346
|
+
they report ("Instrumentations SHOULD document the list of errors they
|
|
347
|
+
report"). This SDK emits exactly two kinds of value, both alongside
|
|
348
|
+
span `StatusCode.ERROR`:
|
|
349
|
+
|
|
350
|
+
| Value | When | Meaning |
|
|
351
|
+
| --- | --- | --- |
|
|
352
|
+
| exception class name (e.g. `RuntimeError`, `httpx.ConnectError`) | the instrumented call raised | We failed to execute the request. Also records an OTel exception event. |
|
|
353
|
+
| `tool_error` | an `execute_tool` span whose result signalled failure **in band** — Anthropic `tool_result` blocks with `is_error: true`, MCP `CallToolResult.isError`, or a LangChain `ToolMessage` with `status="error"` | The tool ran and reported a failure back to the model (bad arguments, a domain "no"), so the model can self-correct. No exception object exists, so no class name is available. |
|
|
354
|
+
|
|
355
|
+
`tool_error` is a deliberate low-cardinality sentinel, which the
|
|
356
|
+
`error.type` convention explicitly permits ("another low-cardinality
|
|
357
|
+
error identifier"; a custom value MAY be used where no well-known one
|
|
358
|
+
applies). The same split is used by OpenTelemetry's MCP instrumentation
|
|
359
|
+
in OpenLLMetry, which likewise reports `error.type="tool_error"` for the
|
|
360
|
+
`isError` path and the exception class name otherwise.
|
|
361
|
+
|
|
362
|
+
The distinction is what lets a monitor page on genuine execution
|
|
363
|
+
failures while excluding failures the model already saw and can recover
|
|
364
|
+
from.
|
|
365
|
+
|
|
343
366
|
Note: `gen_ai.usage.input_tokens` for Anthropic is the true total — the
|
|
344
367
|
SDK adds back `cache_read_input_tokens` and
|
|
345
368
|
`cache_creation_input_tokens`, which Anthropic's raw response excludes
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "struct-sdk"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.23"
|
|
8
8
|
description = "Struct agent observability SDK — auto-instruments AI agent frameworks with OpenTelemetry"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -37,7 +37,11 @@ Issues = "https://struct.ai/support"
|
|
|
37
37
|
|
|
38
38
|
[project.optional-dependencies]
|
|
39
39
|
anthropic = ["anthropic>=0.30.0"]
|
|
40
|
-
|
|
40
|
+
# mcp>=1.28.1 pinned directly (not just in override-dependencies below) so it
|
|
41
|
+
# ships in this extra's published wheel metadata — CVE-2026-52870,
|
|
42
|
+
# CVE-2026-52869, CVE-2026-59950 (GHSA-hvrp-rf83-w775, GHSA-jpw9-pfvf-9f58,
|
|
43
|
+
# GHSA-vj7q-gjh5-988w).
|
|
44
|
+
claude-agent-sdk = ["claude-agent-sdk>=0.1.59", "mcp>=1.28.1"]
|
|
41
45
|
langchain = ["langchain-core>=1.3.3"]
|
|
42
46
|
# Responses API (openai.resources.responses) exists from 1.66.0 onward.
|
|
43
47
|
openai = ["openai>=1.66.0"]
|
|
@@ -80,6 +84,8 @@ override-dependencies = [
|
|
|
80
84
|
"starlette>=1.3.1",
|
|
81
85
|
"langsmith>=0.8.18",
|
|
82
86
|
"pydantic-settings>=2.14.2",
|
|
87
|
+
# CVE-2026-52870, CVE-2026-52869, CVE-2026-59950 (GHSA-hvrp-rf83-w775, GHSA-jpw9-pfvf-9f58, GHSA-vj7q-gjh5-988w)
|
|
88
|
+
"mcp>=1.28.1",
|
|
83
89
|
]
|
|
84
90
|
|
|
85
91
|
[tool.pytest.ini_options]
|