wizardflow 0.7.1__tar.gz → 0.8.0__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.
- {wizardflow-0.7.1 → wizardflow-0.8.0}/PKG-INFO +11 -6
- {wizardflow-0.7.1 → wizardflow-0.8.0}/README.md +10 -5
- {wizardflow-0.7.1 → wizardflow-0.8.0}/docs/cli.md +8 -4
- {wizardflow-0.7.1 → wizardflow-0.8.0}/docs/jsonl-file-format.md +4 -1
- {wizardflow-0.7.1 → wizardflow-0.8.0}/docs/opentelemetry.md +179 -40
- {wizardflow-0.7.1 → wizardflow-0.8.0}/docs/recording.md +40 -3
- {wizardflow-0.7.1 → wizardflow-0.8.0}/pyproject.toml +1 -1
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/__init__.py +31 -5
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/404.html +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/__next.__PAGE__.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/__next._full.txt +3 -3
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/__next._head.txt +1 -1
- {wizardflow-0.7.1/src/wizardflow/_ui/why-wizardflow → wizardflow-0.8.0/src/wizardflow/_ui}/__next._index.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/__next._tree.txt +2 -2
- wizardflow-0.7.1/src/wizardflow/_ui/_next/static/chunks/3fxdmyfsnxue6.js → wizardflow-0.8.0/src/wizardflow/_ui/_next/static/chunks/2_iu57vjc6ikq.js +6 -6
- wizardflow-0.7.1/src/wizardflow/_ui/_next/static/chunks/18clj6xsyhc_j.css → wizardflow-0.8.0/src/wizardflow/_ui/_next/static/chunks/301ajw92ycgkd.css +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_not-found/__next._full.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_not-found/__next._head.txt +1 -1
- {wizardflow-0.7.1/src/wizardflow/_ui → wizardflow-0.8.0/src/wizardflow/_ui/_not-found}/__next._index.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_not-found/__next._not-found/__PAGE__.txt +1 -1
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_not-found/__next._not-found.txt +1 -1
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_not-found/__next._tree.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_not-found.html +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_not-found.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/index.html +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/index.txt +3 -3
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/sitemap.xml +1 -1
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/why-wizardflow/__next._full.txt +3 -3
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/why-wizardflow/__next._head.txt +1 -1
- {wizardflow-0.7.1/src/wizardflow/_ui/_not-found → wizardflow-0.8.0/src/wizardflow/_ui/why-wizardflow}/__next._index.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/why-wizardflow/__next._tree.txt +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/why-wizardflow/__next.why-wizardflow/__PAGE__.txt +1 -1
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/why-wizardflow/__next.why-wizardflow.txt +1 -1
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/why-wizardflow.html +2 -2
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/why-wizardflow.txt +3 -3
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/cli.py +16 -3
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/client.py +306 -31
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/constants.py +3 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/otel.py +170 -73
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/otel_file_exporter.py +11 -7
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/otel_mapping.py +130 -23
- wizardflow-0.8.0/tests/helpers.py +74 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/tests/test_cli.py +4 -2
- wizardflow-0.8.0/tests/test_langgraph.py +202 -0
- wizardflow-0.8.0/tests/test_node_lifecycle.py +144 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/tests/test_otel.py +85 -17
- {wizardflow-0.7.1 → wizardflow-0.8.0}/tests/test_otel_file_exporter.py +14 -4
- wizardflow-0.8.0/tests/test_otel_integration.py +178 -0
- wizardflow-0.8.0/tests/test_persistence.py +106 -0
- wizardflow-0.8.0/tests/test_recording.py +348 -0
- wizardflow-0.8.0/tests/test_reinit.py +141 -0
- wizardflow-0.8.0/tests/test_rotation.py +122 -0
- wizardflow-0.8.0/tests/test_workflow.py +569 -0
- wizardflow-0.7.1/tests/test_trace.py +0 -1239
- {wizardflow-0.7.1 → wizardflow-0.8.0}/.gitignore +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/CONTRIBUTING.md +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/LICENSE +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/assets/demo.gif +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/examples/data_types.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/examples/multibranch.html +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/examples/multibranch.md +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/examples/multibranch.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/examples/quickstart.html +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/examples/quickstart.md +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/examples/quickstart.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/scripts/build_ui.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/scripts/live_trace_demo.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_render.py +0 -0
- {wizardflow-0.7.1/src/wizardflow/_ui/_next/static/H81QsKAgLXQMK2H6vyBjb → wizardflow-0.8.0/src/wizardflow/_ui/_next/static/1QfoA382k0nvObP14Huhr}/_buildManifest.js +0 -0
- {wizardflow-0.7.1/src/wizardflow/_ui/_next/static/H81QsKAgLXQMK2H6vyBjb → wizardflow-0.8.0/src/wizardflow/_ui/_next/static/1QfoA382k0nvObP14Huhr}/_clientMiddlewareManifest.js +0 -0
- {wizardflow-0.7.1/src/wizardflow/_ui/_next/static/H81QsKAgLXQMK2H6vyBjb → wizardflow-0.8.0/src/wizardflow/_ui/_next/static/1QfoA382k0nvObP14Huhr}/_ssgManifest.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/05-c3ty_6dwfk.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/09s72r58ijxwx.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/0cz1d0mv5g_q7.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/0d1yav018wi6n.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/0fizjutis9uvx.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/14a18doinx71t.css +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/14mrh2-p_w84d.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/1_way7swvumpv.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/1diz-5jfxjm5x.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/1por0fhggxwcm.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/2-j1b74l3lxxu.css +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/24c18qa28ilul.css +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/27jktro2p5rq9.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/2dclsx_n3obic.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/2gj5bmeov-r8f.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/2l6srvxdnb-io.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/310vm2bl3xxpt.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/32c7h_m2amh5m.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/352yh6c3r6-0k.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/3n7dm2ojtyzwn.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/3q-c23s8gv3du.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/3rdqn8rx95pw7.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/414c1-tn-1aef.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/43x_68q2b6gcs.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/chunks/turbopack-2fblmukzx7kws.js +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/4fa387ec64143e14-s.2tuy5pz7dlieh.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/53b9e256198e5412-s.390ncx5urfkfu.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/5ce348bf30bf5439-s.31988l_ccedte.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/6306c77e7c8268e4-s.2dbetqa9o8jxf.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/7178b3e590c64307-s.21jp631_3pja2.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/797e433ab948586e-s.p.0r6juujl39pe6.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/7d817b4c03b0c5f1-s.1uyisp29ctx0d.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/8a480f0b521d4e75-s.1qq4vpdcun5oj.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/bbc41e54d2fcbd21-s.1rgnod-3esatf.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/caa3a2e1cccd8315-s.p.0wgildi0cnwt9.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/fef07dbb0973bf53-s.3p2_lha1f2xer.woff2 +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/_next/static/media/icon.09qublg69ek7b.svg +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/icon.svg +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/opengraph-image +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/_ui/robots.txt +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/html.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/markdown.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/py.typed +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/src/wizardflow/reader.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/tests/conftest.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/tests/test_html.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/tests/test_markdown.py +0 -0
- {wizardflow-0.7.1 → wizardflow-0.8.0}/tests/test_reader.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: wizardflow
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Python SDK for recording agent flows into the WizardFlow / AgentTrace file format.
|
|
5
5
|
Project-URL: Homepage, https://getwizardflow.com
|
|
6
6
|
Project-URL: Documentation, https://getwizardflow.com
|
|
@@ -145,17 +145,22 @@ trace = wizardflow.init(
|
|
|
145
145
|
name="my-agent",
|
|
146
146
|
otel=True,
|
|
147
147
|
otel_endpoint="http://localhost:4318/v1/traces",
|
|
148
|
-
|
|
148
|
+
otel_workflow_name="answer",
|
|
149
149
|
)
|
|
150
150
|
|
|
151
|
-
with trace.
|
|
152
|
-
|
|
153
|
-
node
|
|
151
|
+
with trace.workflow() as run: # one workflow = one OTel trace
|
|
152
|
+
run.set_info(otel_attributes={"session.id": chat_id})
|
|
153
|
+
with run.node("generator", kind="llm") as node:
|
|
154
|
+
node.log_input(input_value)
|
|
155
|
+
node.log_output(output_value)
|
|
154
156
|
|
|
155
|
-
trace.end_message("msg-1")
|
|
156
157
|
trace.close_otel()
|
|
157
158
|
```
|
|
158
159
|
|
|
160
|
+
`otel_attributes` sets exact keys on the workflow's root span — e.g.
|
|
161
|
+
`session.id` groups traces into Phoenix sessions, `langfuse.session.id` into
|
|
162
|
+
Langfuse sessions.
|
|
163
|
+
|
|
159
164
|
Generic logs can optionally choose an exact application-owned span attribute
|
|
160
165
|
without changing their JSONL/UI label:
|
|
161
166
|
|
|
@@ -98,17 +98,22 @@ trace = wizardflow.init(
|
|
|
98
98
|
name="my-agent",
|
|
99
99
|
otel=True,
|
|
100
100
|
otel_endpoint="http://localhost:4318/v1/traces",
|
|
101
|
-
|
|
101
|
+
otel_workflow_name="answer",
|
|
102
102
|
)
|
|
103
103
|
|
|
104
|
-
with trace.
|
|
105
|
-
|
|
106
|
-
node
|
|
104
|
+
with trace.workflow() as run: # one workflow = one OTel trace
|
|
105
|
+
run.set_info(otel_attributes={"session.id": chat_id})
|
|
106
|
+
with run.node("generator", kind="llm") as node:
|
|
107
|
+
node.log_input(input_value)
|
|
108
|
+
node.log_output(output_value)
|
|
107
109
|
|
|
108
|
-
trace.end_message("msg-1")
|
|
109
110
|
trace.close_otel()
|
|
110
111
|
```
|
|
111
112
|
|
|
113
|
+
`otel_attributes` sets exact keys on the workflow's root span — e.g.
|
|
114
|
+
`session.id` groups traces into Phoenix sessions, `langfuse.session.id` into
|
|
115
|
+
Langfuse sessions.
|
|
116
|
+
|
|
112
117
|
Generic logs can optionally choose an exact application-owned span attribute
|
|
113
118
|
without changing their JSONL/UI label:
|
|
114
119
|
|
|
@@ -84,19 +84,23 @@ does not combine an entire rotation chain.
|
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
86
|
wizardflow otel export run.jsonl --endpoint http://localhost:4318/v1/traces
|
|
87
|
-
wizardflow otel export run.jsonl --
|
|
87
|
+
wizardflow otel export run.jsonl --workflow-name consultation
|
|
88
|
+
wizardflow otel export run.jsonl --trace-scope recording
|
|
88
89
|
```
|
|
89
90
|
|
|
90
91
|
This projects an existing artifact through OTLP/HTTP using the same semantic
|
|
91
92
|
mapping as live export. It creates fresh OTel trace IDs and never modifies the
|
|
92
93
|
source file. By default it discovers and exports the complete rotated
|
|
93
|
-
part-chain and creates one
|
|
94
|
-
creates one `wizardflow.
|
|
94
|
+
part-chain and creates one trace per message, rooted at an `invoke_workflow`
|
|
95
|
+
span; `--trace-scope recording` creates one `wizardflow.run` trace for the
|
|
96
|
+
whole chain. Live `otel_attributes` are not stored in JSONL, so exported roots
|
|
97
|
+
do not carry them.
|
|
95
98
|
|
|
96
99
|
| Option | Default | Meaning |
|
|
97
100
|
| --- | --- | --- |
|
|
98
101
|
| `--endpoint` | OTel environment | OTLP/HTTP traces endpoint |
|
|
99
|
-
| `--trace-scope` | `
|
|
102
|
+
| `--trace-scope` | `workflow` | `workflow` (one trace per message) or `recording` trace boundaries |
|
|
103
|
+
| `--workflow-name` | none | Stable `gen_ai.workflow.name` for workflow roots; match the live `otel_workflow_name` |
|
|
100
104
|
| `--include-content` / `--no-include-content` | on | Export or omit bounded input, output, and structured log content |
|
|
101
105
|
| `--content-max-bytes` | `16_384` | Maximum bytes for each exported content value |
|
|
102
106
|
| `--export-graph` | off | Add the WizardFlow graph event to each root |
|
|
@@ -127,13 +127,16 @@ Explicit keys may extend or override semantic mappings. The structural identity
|
|
|
127
127
|
keys `wizardflow.node.id`, `wizardflow.node.kind`, `wizardflow.message.id`, and
|
|
128
128
|
`wizardflow.trace.name` are protected.
|
|
129
129
|
|
|
130
|
+
On an `input` or `output` semantic payload, `otelAttribute` is additive: the
|
|
131
|
+
semantic projection is kept and the value is also exported under that key.
|
|
132
|
+
|
|
130
133
|
`exportToJsonl` is not stored: a record excluded from JSONL is absent.
|
|
131
134
|
|
|
132
135
|
## Source-of-truth rules
|
|
133
136
|
|
|
134
137
|
- JSON-compatible complex values remain intact.
|
|
135
138
|
- JSONL is transport-neutral by default; `otelAttribute` is an optional explicit
|
|
136
|
-
projection hint for generic logs.
|
|
139
|
+
projection hint for generic logs and for input/output payloads.
|
|
137
140
|
- Exporters, rather than the writer, normalize values for their transport.
|
|
138
141
|
- Content truncation for OTel never mutates the JSONL value.
|
|
139
142
|
- Generic labels do not imply semantic meaning.
|
|
@@ -24,7 +24,7 @@ pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp-prot
|
|
|
24
24
|
```bash
|
|
25
25
|
wizardflow otel export run.jsonl \
|
|
26
26
|
--endpoint http://localhost:4318/v1/traces \
|
|
27
|
-
--
|
|
27
|
+
--workflow-name consultation
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
The command discovers a rotated part-chain even when given a middle part and
|
|
@@ -32,11 +32,13 @@ exports all messages in part order. Use `--current-part-only` to export only
|
|
|
32
32
|
the named file. Input files are never modified.
|
|
33
33
|
|
|
34
34
|
Offline export creates fresh OTel trace IDs; JSONL cannot reconstruct live OTel
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
timestamps and use the same semantic mapper as
|
|
35
|
+
trace IDs or parent contexts. `--trace-scope workflow` (the default) creates one
|
|
36
|
+
new trace per message, rooted at an `invoke_workflow` span built exactly like
|
|
37
|
+
the live one; pass `--workflow-name` to match a live `otel_workflow_name`.
|
|
38
|
+
`--trace-scope recording` creates one new trace rooted at `wizardflow.run`. Both
|
|
39
|
+
modes preserve recorded node timestamps and use the same semantic mapper as
|
|
40
|
+
live export. Application `otel_attributes` are OTel-only and not stored in
|
|
41
|
+
JSONL, so offline roots do not carry them.
|
|
40
42
|
|
|
41
43
|
Content export is enabled by default so the receiving UI shows useful inputs,
|
|
42
44
|
outputs, and structured logs on the first export. Graph export remains opt-in:
|
|
@@ -57,17 +59,37 @@ tracer provider.
|
|
|
57
59
|
import wizardflow
|
|
58
60
|
|
|
59
61
|
trace = wizardflow.init(
|
|
60
|
-
nodes=["
|
|
61
|
-
name="
|
|
62
|
+
nodes=["classifier", "advisor"],
|
|
63
|
+
name="student-advisor", # project (with otel_endpoint)
|
|
62
64
|
otel=True,
|
|
63
65
|
otel_endpoint="http://localhost:4318/v1/traces",
|
|
64
|
-
otel_trace_scope="
|
|
66
|
+
otel_trace_scope="workflow", # default
|
|
67
|
+
otel_workflow_name="consultation", # stable workflow type, optional
|
|
68
|
+
otel_attributes={"deployment.environment": "prod"}, # on every root
|
|
65
69
|
otel_include_content=True, # default; set False to omit recorded content
|
|
66
70
|
otel_content_max_bytes=16_384,
|
|
67
71
|
export_graph_to_otel=False,
|
|
68
72
|
)
|
|
73
|
+
|
|
74
|
+
with trace.workflow() as run:
|
|
75
|
+
run.set_info(
|
|
76
|
+
title="Degree consultation",
|
|
77
|
+
otel_attributes={"session.id": chat_id, "user.id": user_id},
|
|
78
|
+
)
|
|
79
|
+
with run.node("classifier") as node:
|
|
80
|
+
node.log_input(question)
|
|
69
81
|
```
|
|
70
82
|
|
|
83
|
+
How WizardFlow concepts map onto what OTel backends show:
|
|
84
|
+
|
|
85
|
+
| WizardFlow | OTel / backends |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| recording `name` | project (`openinference.project.name` resource, with `otel_endpoint`) |
|
|
88
|
+
| `otel_workflow_name` | workflow type (`gen_ai.workflow.name`) |
|
|
89
|
+
| message = one workflow execution | one trace, rooted at an `invoke_workflow` span |
|
|
90
|
+
| node execution | one span under that root |
|
|
91
|
+
| `otel_attributes` such as `session.id` | session / user grouping of traces |
|
|
92
|
+
|
|
71
93
|
Output modes are independent:
|
|
72
94
|
|
|
73
95
|
| `jsonl` | `otel` | Result |
|
|
@@ -88,8 +110,12 @@ and OTLP/HTTP exporter. This isolates WizardFlow configuration from the host
|
|
|
88
110
|
application. If `name` is set, WizardFlow also uses it as the OpenInference
|
|
89
111
|
project resource name. Backends such as Phoenix therefore group successive
|
|
90
112
|
WizardFlow traces under that project instead of placing them in `default`.
|
|
113
|
+
|
|
91
114
|
Without an endpoint, the application owns the global provider and its resource
|
|
92
|
-
configuration.
|
|
115
|
+
configuration. A resource is fixed per provider, so `name` then does **not**
|
|
116
|
+
become the project: set the project where you configure OTel, for example
|
|
117
|
+
`phoenix.otel.register(project_name="student-advisor")`. Langfuse ignores the
|
|
118
|
+
resource either way; its project comes from the API key.
|
|
93
119
|
|
|
94
120
|
Finish OTel output explicitly:
|
|
95
121
|
|
|
@@ -104,20 +130,62 @@ fresh private provider and trace.
|
|
|
104
130
|
|
|
105
131
|
## Trace scope, shape, and timestamps
|
|
106
132
|
|
|
107
|
-
|
|
133
|
+
A trace is the collection of spans that share one trace ID. `otel_trace_scope`
|
|
134
|
+
controls where WizardFlow draws that boundary:
|
|
108
135
|
|
|
109
136
|
| Value | Trace boundary |
|
|
110
137
|
| --- | --- |
|
|
138
|
+
| `"workflow"` (default) | One independent trace per workflow execution (WizardFlow message), rooted at an `invoke_workflow` span |
|
|
111
139
|
| `"recording"` | One trace from initialization or OTel reinitialization until the next reinitialization or `close_otel()` |
|
|
112
|
-
| `"message"` | One independent trace per WizardFlow message, ended by `end_message()` |
|
|
113
140
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
141
|
+
Workflow scope is the standard request-oriented model used by Phoenix,
|
|
142
|
+
Langfuse, and the GenAI semantic conventions, and the only scope that supports
|
|
143
|
+
session grouping. Recording scope is a specialized whole-recording view: its
|
|
144
|
+
root stays open until `close_otel()` or process exit, and backends show it as
|
|
145
|
+
incomplete until then.
|
|
146
|
+
|
|
147
|
+
In workflow scope, every workflow execution maps to one trace. The root follows
|
|
148
|
+
the OTel GenAI `invoke_workflow` span convention (currently marked
|
|
149
|
+
Development):
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
invoke_workflow consultation INTERNAL root span
|
|
153
|
+
├── classifier node span
|
|
154
|
+
└── advisor node span
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The root span carries:
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
gen_ai.operation.name = "invoke_workflow"
|
|
161
|
+
gen_ai.workflow.name = "consultation" # only with otel_workflow_name
|
|
162
|
+
wizardflow.message.id = <generated or caller-provided message id>
|
|
163
|
+
wizardflow.message.title = "Degree consultation" # when a title is supplied
|
|
164
|
+
wizardflow.message.metadata = <deterministic JSON> # when meta is supplied
|
|
165
|
+
<otel_attributes> # init-level, then per-workflow
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The `invoke_workflow` span is the root operation, not a separate trace object.
|
|
169
|
+
Without `otel_workflow_name` it is named just `invoke_workflow` and omits
|
|
170
|
+
`gen_ai.workflow.name`; WizardFlow never invents a workflow name. The workflow
|
|
171
|
+
name is a stable, low-cardinality type, configured once. The per-execution
|
|
172
|
+
title never renames the root.
|
|
173
|
+
|
|
174
|
+
`trace.workflow()` starts the root when the block begins and makes it the
|
|
175
|
+
current span, so auto-instrumented calls inside the block (HTTP clients, model
|
|
176
|
+
SDKs) are parented under it. Leaving the block ends it. If the block raises,
|
|
177
|
+
the root records the exception, sets `error.type`, and gets error status; the
|
|
178
|
+
exception still propagates.
|
|
179
|
+
|
|
180
|
+
The lower-level `message_id` / `end_message()` API produces the same shape: the
|
|
181
|
+
root is created lazily from the first node's start time and ended by
|
|
182
|
+
`end_message()`. Ending a message that never ran a node still emits a
|
|
183
|
+
zero-child root. Overlapping message IDs remain independent traces, each with
|
|
184
|
+
its own root and context. `close_otel()` ends roots that were never finished
|
|
185
|
+
with unset status, since no failure was observed.
|
|
118
186
|
|
|
119
187
|
In recording scope, one active WizardFlow OTel recording maps to one trace
|
|
120
|
-
rooted at `wizardflow.run
|
|
188
|
+
rooted at `wizardflow.run`, and `trace.workflow()` does not create extra roots:
|
|
121
189
|
|
|
122
190
|
```text
|
|
123
191
|
wizardflow.run
|
|
@@ -126,15 +194,6 @@ wizardflow.run
|
|
|
126
194
|
└── model wizardflow.message.id=m2
|
|
127
195
|
```
|
|
128
196
|
|
|
129
|
-
In message scope, every message maps to a trace rooted at
|
|
130
|
-
`wizardflow.message`:
|
|
131
|
-
|
|
132
|
-
```text
|
|
133
|
-
wizardflow.message wizardflow.message.id=m1
|
|
134
|
-
├── researcher
|
|
135
|
-
└── model
|
|
136
|
-
```
|
|
137
|
-
|
|
138
197
|
Every node span carries:
|
|
139
198
|
|
|
140
199
|
```text
|
|
@@ -144,7 +203,9 @@ wizardflow.node.kind
|
|
|
144
203
|
```
|
|
145
204
|
|
|
146
205
|
Node spans use the resolved WizardFlow `timestamp` and `endTimestamp`, rather
|
|
147
|
-
than the time at which an exporter happens to process them.
|
|
206
|
+
than the time at which an exporter happens to process them. Workflow scope and
|
|
207
|
+
recording scope only change OTel trace boundaries; JSONL files and rotation are
|
|
208
|
+
unaffected.
|
|
148
209
|
|
|
149
210
|
### Span granularity
|
|
150
211
|
|
|
@@ -161,6 +222,57 @@ internal calls require their own instrumentation to appear as child spans.
|
|
|
161
222
|
This is a difference in detail, not an OTLP compatibility issue. The receiving
|
|
162
223
|
backend can still ingest and display the WizardFlow spans normally.
|
|
163
224
|
|
|
225
|
+
## Application attributes on the workflow root
|
|
226
|
+
|
|
227
|
+
`otel_attributes` sets exact, application-chosen keys on workflow root spans.
|
|
228
|
+
It is the counterpart of `log(otel_attribute=...)` for the execution as a
|
|
229
|
+
whole, and the way to make traces groupable by backends:
|
|
230
|
+
|
|
231
|
+
| Purpose | Phoenix / OpenInference | Langfuse | GenAI semconv |
|
|
232
|
+
| --- | --- | --- | --- |
|
|
233
|
+
| Session / conversation | `session.id` | `langfuse.session.id` (or `session.id`) | `gen_ai.conversation.id` |
|
|
234
|
+
| User | `user.id` | `langfuse.user.id` (or `user.id`) | — |
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
trace = wizardflow.init(..., otel_attributes={"deployment.environment": "prod"})
|
|
238
|
+
|
|
239
|
+
with trace.workflow() as run:
|
|
240
|
+
run.set_info(otel_attributes={"session.id": chat_id, "user.id": user_id})
|
|
241
|
+
...
|
|
242
|
+
|
|
243
|
+
# Low-level form:
|
|
244
|
+
trace.end_message(message_id, otel_attributes={"session.id": chat_id})
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
- `init()` / `reinit()` values apply to every workflow root started afterwards
|
|
248
|
+
(in recording scope, to the recording root).
|
|
249
|
+
- `set_info()` / `end_message()` values apply to that workflow's root only and
|
|
250
|
+
override init-level values for the same key. Repeated `set_info()` calls
|
|
251
|
+
merge.
|
|
252
|
+
- Keys are used exactly, with the same rules as `otel_attribute` (non-empty, no
|
|
253
|
+
surrounding whitespace or control characters). The keys WizardFlow sets on
|
|
254
|
+
the root are protected: `gen_ai.operation.name`, `gen_ai.workflow.name`,
|
|
255
|
+
`wizardflow.message.id`, `wizardflow.message.title`,
|
|
256
|
+
`wizardflow.message.metadata`, plus the node identity keys.
|
|
257
|
+
- Values must be `str`, `bool`, `int`, `float`, or a non-empty list of one of
|
|
258
|
+
those types. Invalid entries raise, or are dropped with a warning when
|
|
259
|
+
`silent=True`.
|
|
260
|
+
- They are identifiers the application chose, so they are exported even with
|
|
261
|
+
`otel_include_content=False`.
|
|
262
|
+
- They are OTel-only: JSONL never stores them, and the offline exporter cannot
|
|
263
|
+
reproduce them.
|
|
264
|
+
- In recording scope there is no per-workflow root. Per-workflow
|
|
265
|
+
`otel_attributes` are ignored with one warning rather than attached to the
|
|
266
|
+
recording root, because backends treat session and user as properties of the
|
|
267
|
+
whole trace.
|
|
268
|
+
- They are set on the root span only. Langfuse notes that filtering *spans* by
|
|
269
|
+
these attributes requires them on every span; session grouping of traces
|
|
270
|
+
works from the root.
|
|
271
|
+
|
|
272
|
+
`meta` stays separate: it is exported as one bounded JSON value,
|
|
273
|
+
`wizardflow.message.metadata`, and its keys are never turned into attribute
|
|
274
|
+
names.
|
|
275
|
+
|
|
164
276
|
## GenAI semantic projection
|
|
165
277
|
|
|
166
278
|
Use an execution kind only when it accurately describes the node:
|
|
@@ -192,21 +304,23 @@ Recognized model parameters map to compatible `gen_ai.request.*` attributes.
|
|
|
192
304
|
Unknown or unsupported parameters remain readable under
|
|
193
305
|
`wizardflow.model_parameter.*`.
|
|
194
306
|
|
|
195
|
-
## Generic
|
|
307
|
+
## Generic payloads
|
|
196
308
|
|
|
197
|
-
Arbitrary scalar
|
|
309
|
+
Arbitrary scalar payloads (generic `log()` records) export by default as custom
|
|
310
|
+
span attributes. They are named `payload`, not `log`, because OTel "logs" are
|
|
311
|
+
the separate Logs signal:
|
|
198
312
|
|
|
199
313
|
```text
|
|
200
|
-
wizardflow.
|
|
201
|
-
wizardflow.
|
|
314
|
+
wizardflow.payload.confidence = 0.91
|
|
315
|
+
wizardflow.payload.retrieval = "..."
|
|
202
316
|
```
|
|
203
317
|
|
|
204
318
|
Duplicate normalized labels preserve the first unsuffixed:
|
|
205
319
|
|
|
206
320
|
```text
|
|
207
|
-
wizardflow.
|
|
208
|
-
wizardflow.
|
|
209
|
-
wizardflow.
|
|
321
|
+
wizardflow.payload.retrieval
|
|
322
|
+
wizardflow.payload.retrieval.1
|
|
323
|
+
wizardflow.payload.retrieval.2
|
|
210
324
|
```
|
|
211
325
|
|
|
212
326
|
For an exact application-owned attribute key, generic `log()` accepts
|
|
@@ -236,6 +350,26 @@ logging helpers for inputs, outputs, usage, model parameters, and compatible
|
|
|
236
350
|
retrieval data; the custom key is an escape hatch for application-specific
|
|
237
351
|
attributes.
|
|
238
352
|
|
|
353
|
+
### Exact keys for inputs and outputs
|
|
354
|
+
|
|
355
|
+
`log_input()` and `log_output()` accept `otel_attribute` too. There it is
|
|
356
|
+
**additive**: the automatic projection (`gen_ai.input.messages`, tool
|
|
357
|
+
arguments, and so on) is kept, and the same value is also exported under the
|
|
358
|
+
exact key. The record stays one JSONL payload, with `otelAttribute` persisted
|
|
359
|
+
so offline export agrees:
|
|
360
|
+
|
|
361
|
+
```python
|
|
362
|
+
node.log_input(question, otel_attribute="input.value")
|
|
363
|
+
node.log_output(answer, otel_attribute="output.value")
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
This is useful for backends that read other keys than `gen_ai.*`. Phoenix, for
|
|
367
|
+
example, fills its span Input/Output panels from the OpenInference keys
|
|
368
|
+
`input.value` / `output.value`. Because inputs and outputs are content, the
|
|
369
|
+
extra key follows `otel_include_content` (even for plain strings) and
|
|
370
|
+
`otel_content_max_bytes`. The same key rules, protected keys, and
|
|
371
|
+
last-value-wins warning as for generic logs apply.
|
|
372
|
+
|
|
239
373
|
WizardFlow never guesses GenAI semantics from a generic label. A record with
|
|
240
374
|
`export_to_otel=False` is never exported.
|
|
241
375
|
|
|
@@ -250,7 +384,10 @@ disabled:
|
|
|
250
384
|
- semantic input/output is omitted;
|
|
251
385
|
- structured generic logs are omitted;
|
|
252
386
|
- scalar generic logs still export;
|
|
253
|
-
- usage and compatible model parameters still export as metadata
|
|
387
|
+
- usage and compatible model parameters still export as metadata;
|
|
388
|
+
- the workflow root keeps its title, but omits the `meta` JSON
|
|
389
|
+
(`wizardflow.message.metadata`);
|
|
390
|
+
- `otel_attributes` still export, since the application chose them.
|
|
254
391
|
|
|
255
392
|
Only export content to a receiving system appropriate for the data. Exported
|
|
256
393
|
content is deterministically serialized and bounded by
|
|
@@ -287,13 +424,15 @@ event uses the traces signal; it is not an OTel log record.
|
|
|
287
424
|
trace.reinit(jsonl=True, otel=False) # retain the current OTel trace
|
|
288
425
|
trace.reinit(jsonl=False, otel=True) # retain the current JSONL run
|
|
289
426
|
trace.reinit() # start both anew
|
|
427
|
+
trace.reinit(otel_attributes={"deployment.environment": "staging"})
|
|
290
428
|
```
|
|
291
429
|
|
|
292
|
-
In
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
430
|
+
In workflow scope, reinitialization changes the configuration (trace name,
|
|
431
|
+
init-level `otel_attributes`) used for workflows that start afterwards.
|
|
432
|
+
Already-open workflows keep the root and context captured when they began and
|
|
433
|
+
may finish normally. In recording scope, an OTel reinitialization ends the
|
|
434
|
+
current run root and starts a new trace; already-started node spans retain the
|
|
435
|
+
trace context captured when they began.
|
|
297
436
|
|
|
298
437
|
JSONL part/run boundaries cannot reconstruct these independently chosen live
|
|
299
438
|
OTel boundaries. The offline exporter therefore creates a fresh projection
|
|
@@ -65,7 +65,31 @@ ignored. Exceptions raised by the application itself, including inside
|
|
|
65
65
|
|
|
66
66
|
## Messages and node executions
|
|
67
67
|
|
|
68
|
-
A message is one unit of work, usually one user turn through the graph
|
|
68
|
+
A message is one unit of work, usually one user turn through the graph — one
|
|
69
|
+
workflow execution. The simplest way to record one is the workflow context
|
|
70
|
+
manager, which generates the message ID and ends the message when the block
|
|
71
|
+
exits:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
with trace.workflow() as run:
|
|
75
|
+
run.set_info(title="Degree consultation", meta={"language": "de"})
|
|
76
|
+
|
|
77
|
+
with run.node("classifier") as node:
|
|
78
|
+
node.log_input(question)
|
|
79
|
+
node.log_output("degree_question")
|
|
80
|
+
|
|
81
|
+
with run.node("advisor") as node:
|
|
82
|
+
node.log_output(answer)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`run.message_id` exposes the generated ID for correlation. `set_info()` may be
|
|
86
|
+
called any number of times inside the block: a `title` replaces the previous
|
|
87
|
+
one, `meta` and `otel_attributes` merge. Leaving the block is the completion
|
|
88
|
+
signal — also when the body raises, in which case the message is still written
|
|
89
|
+
and the exception propagates. Workflows cannot be nested in the same execution
|
|
90
|
+
context; separate threads and asyncio tasks each run their own.
|
|
91
|
+
|
|
92
|
+
When your integration already owns an execution ID, pass it yourself. The ID
|
|
69
93
|
must be unique until `end_message()` completes it. A fresh UUID is a good
|
|
70
94
|
default; do not use a long-lived session or user ID as the message ID.
|
|
71
95
|
|
|
@@ -168,7 +192,7 @@ context manager when exact execution boundaries matter.
|
|
|
168
192
|
|
|
169
193
|
### Custom OpenTelemetry attribute key
|
|
170
194
|
|
|
171
|
-
Generic
|
|
195
|
+
Generic payloads normally export as `wizardflow.payload.<normalized_label>`. When an
|
|
172
196
|
application needs an exact, application-owned OTel key, keep the readable trace
|
|
173
197
|
label and set the export key separately:
|
|
174
198
|
|
|
@@ -188,6 +212,14 @@ WizardFlow mappings. Only the structural identity keys `wizardflow.node.id`,
|
|
|
188
212
|
protected. Prefer `log_input()`, `log_output()`, `log_usage()`, and
|
|
189
213
|
`log_model_parameters()` whenever the data has one of those known meanings.
|
|
190
214
|
|
|
215
|
+
`log_input()` and `log_output()` also accept `otel_attribute`. For them it is
|
|
216
|
+
additive — the value keeps its automatic `gen_ai.*` mapping and is additionally
|
|
217
|
+
exported under your key, without a second JSONL payload:
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
node.log_output(answer, otel_attribute="output.value")
|
|
221
|
+
```
|
|
222
|
+
|
|
191
223
|
## Selecting outputs per record
|
|
192
224
|
|
|
193
225
|
Every logging method supports explicit output selection:
|
|
@@ -219,7 +251,12 @@ trace.end_message(
|
|
|
219
251
|
```
|
|
220
252
|
|
|
221
253
|
Keep message metadata flat and scalar. Large or structured values belong in
|
|
222
|
-
node payloads.
|
|
254
|
+
node payloads. Inside `trace.workflow()`, supply the same values with
|
|
255
|
+
`run.set_info(title=..., meta=...)`.
|
|
256
|
+
|
|
257
|
+
Both forms also accept `otel_attributes` — exact OTel keys for the workflow's
|
|
258
|
+
root span, such as `session.id` or `user.id`. They are OTel-only and never
|
|
259
|
+
written to JSONL; see [opentelemetry.md](opentelemetry.md#application-attributes-on-the-workflow-root).
|
|
223
260
|
|
|
224
261
|
## LangGraph topology
|
|
225
262
|
|
|
@@ -32,9 +32,10 @@ from .client import (
|
|
|
32
32
|
NodeSpec,
|
|
33
33
|
UnknownNodeError,
|
|
34
34
|
WizardFlowError,
|
|
35
|
+
WorkflowRun,
|
|
35
36
|
)
|
|
36
37
|
from .constants import Defaults, Logging, Output, Rotation
|
|
37
|
-
from .otel import OTelConfigurationError
|
|
38
|
+
from .otel import DEFAULT_OTEL_TRACE_SCOPE, OTelConfigurationError
|
|
38
39
|
from .otel_mapping import DEFAULT_CONTENT_MAX_BYTES
|
|
39
40
|
|
|
40
41
|
# Library convention: attach a NullHandler so we emit nothing unless the host
|
|
@@ -51,12 +52,14 @@ __all__ = [
|
|
|
51
52
|
"start_node",
|
|
52
53
|
"end_node",
|
|
53
54
|
"node",
|
|
55
|
+
"workflow",
|
|
54
56
|
"end_message",
|
|
55
57
|
"to_dict",
|
|
56
58
|
"to_json",
|
|
57
59
|
"get_default",
|
|
58
60
|
"Client",
|
|
59
61
|
"NodeHandle",
|
|
62
|
+
"WorkflowRun",
|
|
60
63
|
"WizardFlowError",
|
|
61
64
|
"UnknownNodeError",
|
|
62
65
|
"LangGraphExtractionError",
|
|
@@ -83,7 +86,9 @@ def init(
|
|
|
83
86
|
jsonl: bool = True,
|
|
84
87
|
otel: bool = False,
|
|
85
88
|
otel_endpoint: Optional[str] = None,
|
|
86
|
-
otel_trace_scope: str =
|
|
89
|
+
otel_trace_scope: str = DEFAULT_OTEL_TRACE_SCOPE,
|
|
90
|
+
otel_workflow_name: Optional[str] = None,
|
|
91
|
+
otel_attributes: Optional[Mapping[str, Any]] = None,
|
|
87
92
|
otel_include_content: bool = True,
|
|
88
93
|
otel_content_max_bytes: int = DEFAULT_CONTENT_MAX_BYTES,
|
|
89
94
|
export_graph_to_otel: bool = False,
|
|
@@ -108,6 +113,8 @@ def init(
|
|
|
108
113
|
otel=otel,
|
|
109
114
|
otel_endpoint=otel_endpoint,
|
|
110
115
|
otel_trace_scope=otel_trace_scope,
|
|
116
|
+
otel_workflow_name=otel_workflow_name,
|
|
117
|
+
otel_attributes=otel_attributes,
|
|
111
118
|
otel_include_content=otel_include_content,
|
|
112
119
|
otel_content_max_bytes=otel_content_max_bytes,
|
|
113
120
|
export_graph_to_otel=export_graph_to_otel,
|
|
@@ -131,7 +138,9 @@ def init_from_langgraph(
|
|
|
131
138
|
jsonl: bool = True,
|
|
132
139
|
otel: bool = False,
|
|
133
140
|
otel_endpoint: Optional[str] = None,
|
|
134
|
-
otel_trace_scope: str =
|
|
141
|
+
otel_trace_scope: str = DEFAULT_OTEL_TRACE_SCOPE,
|
|
142
|
+
otel_workflow_name: Optional[str] = None,
|
|
143
|
+
otel_attributes: Optional[Mapping[str, Any]] = None,
|
|
135
144
|
otel_include_content: bool = True,
|
|
136
145
|
otel_content_max_bytes: int = DEFAULT_CONTENT_MAX_BYTES,
|
|
137
146
|
export_graph_to_otel: bool = False,
|
|
@@ -159,6 +168,8 @@ def init_from_langgraph(
|
|
|
159
168
|
otel=otel,
|
|
160
169
|
otel_endpoint=otel_endpoint,
|
|
161
170
|
otel_trace_scope=otel_trace_scope,
|
|
171
|
+
otel_workflow_name=otel_workflow_name,
|
|
172
|
+
otel_attributes=otel_attributes,
|
|
162
173
|
otel_include_content=otel_include_content,
|
|
163
174
|
otel_content_max_bytes=otel_content_max_bytes,
|
|
164
175
|
export_graph_to_otel=export_graph_to_otel,
|
|
@@ -181,10 +192,16 @@ def reinit(
|
|
|
181
192
|
*,
|
|
182
193
|
jsonl: bool = True,
|
|
183
194
|
otel: bool = True,
|
|
195
|
+
otel_attributes: Optional[Mapping[str, Any]] = None,
|
|
184
196
|
) -> str:
|
|
185
197
|
"""Independently start a new JSONL run and/or OTel trace."""
|
|
186
198
|
return get_default().reinit(
|
|
187
|
-
name=name,
|
|
199
|
+
name=name,
|
|
200
|
+
description=description,
|
|
201
|
+
meta=meta,
|
|
202
|
+
jsonl=jsonl,
|
|
203
|
+
otel=otel,
|
|
204
|
+
otel_attributes=otel_attributes,
|
|
188
205
|
)
|
|
189
206
|
|
|
190
207
|
|
|
@@ -229,12 +246,21 @@ def node(
|
|
|
229
246
|
return get_default().node(message_id, node_id, kind=kind)
|
|
230
247
|
|
|
231
248
|
|
|
249
|
+
def workflow() -> WorkflowRun:
|
|
250
|
+
"""Scope one workflow execution; leaving the block ends its message."""
|
|
251
|
+
return get_default().workflow()
|
|
252
|
+
|
|
253
|
+
|
|
232
254
|
def end_message(
|
|
233
255
|
id: str,
|
|
234
256
|
title: Optional[str] = None,
|
|
235
257
|
meta: Optional[Dict[str, Any]] = None,
|
|
258
|
+
*,
|
|
259
|
+
otel_attributes: Optional[Mapping[str, Any]] = None,
|
|
236
260
|
) -> str:
|
|
237
|
-
return get_default().end_message(
|
|
261
|
+
return get_default().end_message(
|
|
262
|
+
id, title=title, meta=meta, otel_attributes=otel_attributes
|
|
263
|
+
)
|
|
238
264
|
|
|
239
265
|
|
|
240
266
|
def to_dict() -> Dict[str, Any]:
|