wizardflow 0.8.0__tar.gz → 0.9.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.8.0 → wizardflow-0.9.0}/PKG-INFO +7 -1
- {wizardflow-0.8.0 → wizardflow-0.9.0}/README.md +6 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/docs/opentelemetry.md +28 -3
- {wizardflow-0.8.0 → wizardflow-0.9.0}/docs/recording.md +46 -9
- {wizardflow-0.8.0 → wizardflow-0.9.0}/pyproject.toml +1 -1
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/__init__.py +15 -5
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/client.py +318 -121
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/constants.py +21 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/otel.py +59 -18
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/otel_file_exporter.py +14 -2
- wizardflow-0.9.0/tests/test_enabled_on_error.py +175 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_langgraph.py +2 -1
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_otel.py +4 -3
- wizardflow-0.9.0/tests/test_otel_error_handling.py +221 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_otel_integration.py +3 -3
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_recording.py +12 -12
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_workflow.py +5 -5
- {wizardflow-0.8.0 → wizardflow-0.9.0}/.gitignore +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/CONTRIBUTING.md +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/LICENSE +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/assets/demo.gif +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/docs/cli.md +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/docs/jsonl-file-format.md +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/examples/data_types.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/examples/multibranch.html +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/examples/multibranch.md +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/examples/multibranch.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/examples/quickstart.html +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/examples/quickstart.md +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/examples/quickstart.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/scripts/build_ui.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/scripts/live_trace_demo.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_render.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/404.html +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/__next.__PAGE__.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/__next._full.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/__next._head.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/__next._index.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/__next._tree.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/1QfoA382k0nvObP14Huhr/_buildManifest.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/1QfoA382k0nvObP14Huhr/_clientMiddlewareManifest.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/1QfoA382k0nvObP14Huhr/_ssgManifest.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/05-c3ty_6dwfk.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/09s72r58ijxwx.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/0cz1d0mv5g_q7.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/0d1yav018wi6n.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/0fizjutis9uvx.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/14a18doinx71t.css +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/14mrh2-p_w84d.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/1_way7swvumpv.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/1diz-5jfxjm5x.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/1por0fhggxwcm.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/2-j1b74l3lxxu.css +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/24c18qa28ilul.css +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/27jktro2p5rq9.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/2_iu57vjc6ikq.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/2dclsx_n3obic.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/2gj5bmeov-r8f.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/2l6srvxdnb-io.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/301ajw92ycgkd.css +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/310vm2bl3xxpt.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/32c7h_m2amh5m.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/352yh6c3r6-0k.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/3n7dm2ojtyzwn.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/3q-c23s8gv3du.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/3rdqn8rx95pw7.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/414c1-tn-1aef.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/43x_68q2b6gcs.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/chunks/turbopack-2fblmukzx7kws.js +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/4fa387ec64143e14-s.2tuy5pz7dlieh.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/53b9e256198e5412-s.390ncx5urfkfu.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/5ce348bf30bf5439-s.31988l_ccedte.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/6306c77e7c8268e4-s.2dbetqa9o8jxf.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/7178b3e590c64307-s.21jp631_3pja2.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/797e433ab948586e-s.p.0r6juujl39pe6.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/7d817b4c03b0c5f1-s.1uyisp29ctx0d.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/8a480f0b521d4e75-s.1qq4vpdcun5oj.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/bbc41e54d2fcbd21-s.1rgnod-3esatf.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/caa3a2e1cccd8315-s.p.0wgildi0cnwt9.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/fef07dbb0973bf53-s.3p2_lha1f2xer.woff2 +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_next/static/media/icon.09qublg69ek7b.svg +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._full.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._head.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._index.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._not-found/__PAGE__.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._not-found.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found/__next._tree.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found.html +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/_not-found.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/icon.svg +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/index.html +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/index.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/opengraph-image +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/robots.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/sitemap.xml +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next._full.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next._head.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next._index.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next._tree.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next.why-wizardflow/__PAGE__.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow/__next.why-wizardflow.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow.html +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/_ui/why-wizardflow.txt +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/cli.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/html.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/markdown.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/otel_mapping.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/py.typed +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/src/wizardflow/reader.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/conftest.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/helpers.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_cli.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_html.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_markdown.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_node_lifecycle.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_otel_file_exporter.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_persistence.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_reader.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_reinit.py +0 -0
- {wizardflow-0.8.0 → wizardflow-0.9.0}/tests/test_rotation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: wizardflow
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.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
|
|
@@ -108,6 +108,12 @@ print(trace_path)
|
|
|
108
108
|
`end_message()` appends the completed message to JSONL. There is no separate
|
|
109
109
|
`save()` call.
|
|
110
110
|
|
|
111
|
+
Recording mistakes such as an unknown node id are logged as warnings rather
|
|
112
|
+
than raised into your app; pass `on_error="raise"` to make them raise (handy in
|
|
113
|
+
tests). Pass `enabled=False`, or set `WIZARDFLOW_ENABLED=false`, to turn tracing
|
|
114
|
+
off while keeping the same API. See
|
|
115
|
+
[docs/recording.md](docs/recording.md#error-handling-on_error).
|
|
116
|
+
|
|
111
117
|
Drop `trace_path` into [getwizardflow.com](https://getwizardflow.com), or open
|
|
112
118
|
it locally:
|
|
113
119
|
|
|
@@ -61,6 +61,12 @@ print(trace_path)
|
|
|
61
61
|
`end_message()` appends the completed message to JSONL. There is no separate
|
|
62
62
|
`save()` call.
|
|
63
63
|
|
|
64
|
+
Recording mistakes such as an unknown node id are logged as warnings rather
|
|
65
|
+
than raised into your app; pass `on_error="raise"` to make them raise (handy in
|
|
66
|
+
tests). Pass `enabled=False`, or set `WIZARDFLOW_ENABLED=false`, to turn tracing
|
|
67
|
+
off while keeping the same API. See
|
|
68
|
+
[docs/recording.md](docs/recording.md#error-handling-on_error).
|
|
69
|
+
|
|
64
70
|
Drop `trace_path` into [getwizardflow.com](https://getwizardflow.com), or open
|
|
65
71
|
it locally:
|
|
66
72
|
|
|
@@ -126,7 +126,31 @@ trace.close_otel()
|
|
|
126
126
|
`close_otel()` is idempotent. It ends any active WizardFlow roots, flushes and
|
|
127
127
|
shuts down only a WizardFlow-owned private provider, and leaves JSONL recording
|
|
128
128
|
completely unaffected. After closing, `trace.reinit(otel=True)` can create a
|
|
129
|
-
fresh private provider and trace.
|
|
129
|
+
fresh private provider and trace. If you never call it, WizardFlow closes the
|
|
130
|
+
bridge at process exit.
|
|
131
|
+
|
|
132
|
+
## Failures
|
|
133
|
+
|
|
134
|
+
OTel output is an optional projection of the recording, so, following the
|
|
135
|
+
OpenTelemetry error-handling rules, it never raises into your application at
|
|
136
|
+
run time:
|
|
137
|
+
|
|
138
|
+
- A failure in the OTel bridge or SDK while starting or ending nodes,
|
|
139
|
+
workflows, or runs, or during `reinit()`, is logged as a warning on the
|
|
140
|
+
`wizardflow` logger and recording continues. This holds whatever `on_error`
|
|
141
|
+
is set to, because it isn't a mistake in your code. In particular it never
|
|
142
|
+
replaces an exception your code raises inside `with trace.node(...)`.
|
|
143
|
+
- A flush that doesn't complete in `close_otel()` or at process exit is
|
|
144
|
+
logged as a warning ("some spans may not have been exported"); the provider
|
|
145
|
+
is still shut down.
|
|
146
|
+
- Invalid `otel_attributes` or `otel_attribute` values only drop the OTel
|
|
147
|
+
part. The message or payload is still written to JSONL, and the error is
|
|
148
|
+
then warned about or raised per `on_error`.
|
|
149
|
+
|
|
150
|
+
Startup is the exception: missing OTel packages raise
|
|
151
|
+
`OTelConfigurationError` from `init()`. The offline `wizardflow otel export`
|
|
152
|
+
command raises `OTelExportError` when its final flush fails, so a CLI run can't
|
|
153
|
+
report success for an incomplete export.
|
|
130
154
|
|
|
131
155
|
## Trace scope, shape, and timestamps
|
|
132
156
|
|
|
@@ -255,8 +279,9 @@ trace.end_message(message_id, otel_attributes={"session.id": chat_id})
|
|
|
255
279
|
`wizardflow.message.id`, `wizardflow.message.title`,
|
|
256
280
|
`wizardflow.message.metadata`, plus the node identity keys.
|
|
257
281
|
- Values must be `str`, `bool`, `int`, `float`, or a non-empty list of one of
|
|
258
|
-
those types. Invalid entries
|
|
259
|
-
`
|
|
282
|
+
those types. Invalid entries are dropped with a warning, or raise with
|
|
283
|
+
`on_error="raise"`. Either way the valid entries are kept and the message
|
|
284
|
+
is still written to JSONL first.
|
|
260
285
|
- They are identifiers the application chose, so they are exported even with
|
|
261
286
|
`otel_include_content=False`.
|
|
262
287
|
- They are OTel-only: JSONL never stores them, and the offline exporter cannot
|
|
@@ -48,20 +48,57 @@ wizardflow.end_message("msg-1")
|
|
|
48
48
|
Do not mix module-level calls with several clients: module-level calls always
|
|
49
49
|
target the most recently initialized client.
|
|
50
50
|
|
|
51
|
-
###
|
|
51
|
+
### Error handling: `on_error`
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
`
|
|
55
|
-
|
|
53
|
+
Tracing should never break the app it traces. By default
|
|
54
|
+
(`on_error="warn"`), a runtime usage error — an unknown node id,
|
|
55
|
+
`end_message` on an unknown message, an invalid OTel attribute, a trace file
|
|
56
|
+
that can't be written — is logged once on Python's `wizardflow` logger at
|
|
57
|
+
warning level and the bad call is dropped. The same error repeated in a loop
|
|
58
|
+
is logged only the first time.
|
|
59
|
+
|
|
60
|
+
Choose `on_error="raise"` to get a `WizardFlowError` instead, which is useful
|
|
61
|
+
in tests and while wiring up a new graph:
|
|
56
62
|
|
|
57
63
|
```python
|
|
58
|
-
trace = wizardflow.init(
|
|
64
|
+
trace = wizardflow.init(nodes=["classifier"], on_error="raise")
|
|
59
65
|
```
|
|
60
66
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
`
|
|
67
|
+
Startup configuration errors raise regardless of `on_error`: a bad
|
|
68
|
+
`otel_trace_scope`, `otel_content_max_bytes` or `otel_workflow_name`, a
|
|
69
|
+
malformed node or edge spec, a LangGraph app whose graph can't be read, or an
|
|
70
|
+
unparseable `WIZARDFLOW_ENABLED`. Exceptions raised by the application itself,
|
|
71
|
+
including inside `with trace.node(...)`, are never swallowed.
|
|
72
|
+
|
|
73
|
+
The library attaches only a `NullHandler`, so the warnings appear once your app
|
|
74
|
+
configures logging (for example `logging.basicConfig()`).
|
|
75
|
+
|
|
76
|
+
`silent=True` / `silent=False` still work as deprecated aliases for
|
|
77
|
+
`on_error="warn"` / `on_error="raise"`.
|
|
78
|
+
|
|
79
|
+
### Turning tracing off: `enabled`
|
|
80
|
+
|
|
81
|
+
`on_error` keeps recording but decides what a mistake does. `enabled=False`
|
|
82
|
+
turns recording off entirely, while the API stays usable, so app code never
|
|
83
|
+
has to check whether tracing is on:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
trace = wizardflow.init_from_langgraph(app, enabled=settings.TRACING_ENABLED)
|
|
87
|
+
|
|
88
|
+
with trace.node(message_id, "classifier") as node: # no-op when disabled
|
|
89
|
+
node.log_input(user_message)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
When disabled, no trace file, directory or OTel exporter is created, nothing is
|
|
93
|
+
buffered in memory, and `init_from_langgraph` doesn't call `app.get_graph()`.
|
|
94
|
+
`end_message()`, `reinit()` and `current_path` return `None`, `to_dict()`
|
|
95
|
+
returns an empty trace, and `trace.workflow()` still hands out fresh message
|
|
96
|
+
ids. Startup configuration is still validated. `trace.enabled` reports the
|
|
97
|
+
current state.
|
|
98
|
+
|
|
99
|
+
Without an explicit `enabled=` argument, the `WIZARDFLOW_ENABLED` environment
|
|
100
|
+
variable decides (`false`/`0`/`no`/`off` or `true`/`1`/`yes`/`on`); unset means
|
|
101
|
+
on. The argument always wins over the variable.
|
|
65
102
|
|
|
66
103
|
## Messages and node executions
|
|
67
104
|
|
|
@@ -29,13 +29,14 @@ from .client import (
|
|
|
29
29
|
EdgeSpec,
|
|
30
30
|
LangGraphExtractionError,
|
|
31
31
|
NodeHandle,
|
|
32
|
+
OnError,
|
|
32
33
|
NodeSpec,
|
|
33
34
|
UnknownNodeError,
|
|
34
35
|
WizardFlowError,
|
|
35
36
|
WorkflowRun,
|
|
36
37
|
)
|
|
37
38
|
from .constants import Defaults, Logging, Output, Rotation
|
|
38
|
-
from .otel import DEFAULT_OTEL_TRACE_SCOPE, OTelConfigurationError
|
|
39
|
+
from .otel import DEFAULT_OTEL_TRACE_SCOPE, OTelConfigurationError, OTelExportError
|
|
39
40
|
from .otel_mapping import DEFAULT_CONTENT_MAX_BYTES
|
|
40
41
|
|
|
41
42
|
# Library convention: attach a NullHandler so we emit nothing unless the host
|
|
@@ -64,6 +65,7 @@ __all__ = [
|
|
|
64
65
|
"UnknownNodeError",
|
|
65
66
|
"LangGraphExtractionError",
|
|
66
67
|
"OTelConfigurationError",
|
|
68
|
+
"OTelExportError",
|
|
67
69
|
]
|
|
68
70
|
|
|
69
71
|
_default: Optional[Client] = None
|
|
@@ -80,7 +82,7 @@ def init(
|
|
|
80
82
|
node_colors: Optional[Mapping[str, str]] = None,
|
|
81
83
|
node_descriptions: Optional[Mapping[str, str]] = None,
|
|
82
84
|
meta: Optional[Dict[str, Any]] = None,
|
|
83
|
-
silent: bool =
|
|
85
|
+
silent: Optional[bool] = None,
|
|
84
86
|
max_bytes: int = Rotation.DEFAULT_MAX_BYTES,
|
|
85
87
|
max_messages: int = Rotation.DEFAULT_MAX_MESSAGES,
|
|
86
88
|
jsonl: bool = True,
|
|
@@ -92,6 +94,8 @@ def init(
|
|
|
92
94
|
otel_include_content: bool = True,
|
|
93
95
|
otel_content_max_bytes: int = DEFAULT_CONTENT_MAX_BYTES,
|
|
94
96
|
export_graph_to_otel: bool = False,
|
|
97
|
+
on_error: Optional[OnError] = None,
|
|
98
|
+
enabled: Optional[bool] = None,
|
|
95
99
|
) -> Client:
|
|
96
100
|
"""Create a recording client and set it as the module default."""
|
|
97
101
|
global _default
|
|
@@ -118,6 +122,8 @@ def init(
|
|
|
118
122
|
otel_include_content=otel_include_content,
|
|
119
123
|
otel_content_max_bytes=otel_content_max_bytes,
|
|
120
124
|
export_graph_to_otel=export_graph_to_otel,
|
|
125
|
+
on_error=on_error,
|
|
126
|
+
enabled=enabled,
|
|
121
127
|
)
|
|
122
128
|
return _default
|
|
123
129
|
|
|
@@ -132,7 +138,7 @@ def init_from_langgraph(
|
|
|
132
138
|
node_labels: Optional[Mapping[str, str]] = None,
|
|
133
139
|
node_colors: Optional[Mapping[str, str]] = None,
|
|
134
140
|
node_descriptions: Optional[Mapping[str, str]] = None,
|
|
135
|
-
silent: bool =
|
|
141
|
+
silent: Optional[bool] = None,
|
|
136
142
|
max_bytes: int = Rotation.DEFAULT_MAX_BYTES,
|
|
137
143
|
max_messages: int = Rotation.DEFAULT_MAX_MESSAGES,
|
|
138
144
|
jsonl: bool = True,
|
|
@@ -144,6 +150,8 @@ def init_from_langgraph(
|
|
|
144
150
|
otel_include_content: bool = True,
|
|
145
151
|
otel_content_max_bytes: int = DEFAULT_CONTENT_MAX_BYTES,
|
|
146
152
|
export_graph_to_otel: bool = False,
|
|
153
|
+
on_error: Optional[OnError] = None,
|
|
154
|
+
enabled: Optional[bool] = None,
|
|
147
155
|
) -> Client:
|
|
148
156
|
"""Create a client from a compiled LangGraph ``app`` and set it as default.
|
|
149
157
|
|
|
@@ -173,6 +181,8 @@ def init_from_langgraph(
|
|
|
173
181
|
otel_include_content=otel_include_content,
|
|
174
182
|
otel_content_max_bytes=otel_content_max_bytes,
|
|
175
183
|
export_graph_to_otel=export_graph_to_otel,
|
|
184
|
+
on_error=on_error,
|
|
185
|
+
enabled=enabled,
|
|
176
186
|
)
|
|
177
187
|
return _default
|
|
178
188
|
|
|
@@ -193,7 +203,7 @@ def reinit(
|
|
|
193
203
|
jsonl: bool = True,
|
|
194
204
|
otel: bool = True,
|
|
195
205
|
otel_attributes: Optional[Mapping[str, Any]] = None,
|
|
196
|
-
) -> str:
|
|
206
|
+
) -> Optional[str]:
|
|
197
207
|
"""Independently start a new JSONL run and/or OTel trace."""
|
|
198
208
|
return get_default().reinit(
|
|
199
209
|
name=name,
|
|
@@ -257,7 +267,7 @@ def end_message(
|
|
|
257
267
|
meta: Optional[Dict[str, Any]] = None,
|
|
258
268
|
*,
|
|
259
269
|
otel_attributes: Optional[Mapping[str, Any]] = None,
|
|
260
|
-
) -> str:
|
|
270
|
+
) -> Optional[str]:
|
|
261
271
|
return get_default().end_message(
|
|
262
272
|
id, title=title, meta=meta, otel_attributes=otel_attributes
|
|
263
273
|
)
|