You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5b9a6b5
Browse filesBrowse the repository at this point in the historyBrowse files
fix(ag2): follow TraceConfig privacy default; never export paths, stack traces or raw error text (TH-8236)
Content is captured by default and hidden with FI_HIDE_* / TraceConfig like every
traceAI instrumentor; capture_content now defaults to True (AG2's own default).
Tracebacks and absolute local paths are removed from content attributes, ERROR
status descriptions carry the exception class only, exception events keep
exception.type only. Verified on a real run against local Future AGI.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
setup(agent, tracer_provider=trace_provider) #content captured; FI_HIDE_* hides it
74
75
75
76
reply =await agent.ask("Hello") # inside an async function
76
77
trace_provider.force_flush() # short scripts: flush before exit
@@ -130,17 +131,29 @@ An offline example with a scripted model (no model API key) is in
130
131
131
132
## Privacy
132
133
133
-
Content is off unless you opt in. Upstream `TelemetryMiddleware` defaults
134
-
`capture_content=True`; `setup` and `create_telemetry_middleware` pass `False`.
135
-
With it off, spans carry no prompts, completions, tool arguments, tool results
136
-
or human-input text.
134
+
This package follows the traceAI `TraceConfig` convention: prompts, replies,
135
+
tool arguments and tool results are captured by default, and hidden with the
136
+
standard variables (or `TraceConfig(...)`):
137
137
138
-
```python
139
-
setup(agent, tracer_provider=trace_provider, capture_content=True) # opt in
138
+
```bash
139
+
export FI_HIDE_INPUTS=true FI_HIDE_OUTPUTS=true # or FI_HIDE_INPUT_MESSAGES, FI_HIDE_OUTPUT_MESSAGES, FI_HIDE_INPUT_TEXT, ...
140
140
```
141
141
142
-
With content on, `TraceConfig` (or the matching `FI_HIDE_*` variables) still
143
-
removes it in the span processor. AG2 records message content as one JSON
142
+
There is no second switch. `capture_content` is AG2's own `TelemetryMiddleware`
143
+
argument and defaults to `True`, as upstream; `setup(..., capture_content=False)`
144
+
stops AG2 itself from recording content, but the supported way to hide it is
145
+
`FI_HIDE_*`.
146
+
147
+
Never exported, in either mode: local file paths, user names, stack traces and
148
+
raw exception text. Tracebacks that AG2 puts into a tool message (a failing
149
+
tool's error is sent back to the model and recorded in the next chat span's
150
+
input) are cut to `[stack trace removed]`, absolute local paths become
151
+
`[path]`, a failing span's status description is the exception class name
152
+
(for example `RuntimeError`) instead of `str(exc)`, and exception events keep
153
+
`exception.type` only.
154
+
155
+
`TraceConfig` (or the matching `FI_HIDE_*` variables) removes it in the span
156
+
processor. AG2 records message content as one JSON
144
157
string per span (`gen_ai.input.messages`, `gen_ai.output.messages`), not as
145
158
the per-message keys that `TraceConfig.mask`'s text and image rules match, so
146
159
the processor drops whole attributes:
@@ -168,8 +181,8 @@ not copied to `input.value` / `output.value` either.
168
181
| Tokens |`gen_ai.usage.input_tokens` / `output_tokens` pass through, except on `anthropic` spans, where cache read and write tokens are added to `input_tokens` (and `total_tokens` recomputed when present; see the note below). Cache tokens are aliased to `gen_ai.usage.cache_read_tokens` / `cache_write_tokens` and thinking tokens to `gen_ai.usage.reasoning.output_tokens`, originals kept | When the usage field is zero/absent. Cost is not emitted |
169
182
| Session | Not emitted by AG2. `session.id` from traceAI's `using_session` / `using_attributes` context, which wins over a static value; or set it yourself: `setup(..., span_attributes={"session.id": "..."})`| When neither is set |
170
183
| User, metadata, tags |`user.id`, `metadata`, `tag.tags` (and the other traceAI context keys) from `using_user` / `using_metadata` / `using_tags` / `using_attributes`; a key AG2 or `span_attributes` already set is not overridden | When the context does not set them |
171
-
| Tools |`gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.tool.type`; arguments/result only with `capture_content=True`||
172
-
| Input / output |`input.value` / `output.value` (what Observe shows as a span's input and output), copied from the captured chat messages, tool arguments and result, or human input. A single chat completion goes on `output.value` as its message object, which Observe's chat view shows as the assistant reply. `invoke_agent` gets the first chat input and the last chat output of its turn, so the trace list shows the question and the answer |Without `capture_content=True`, when a `TraceConfig` flag hides the source, and always on `record_usage` spans (AG2 records no content there) |
184
+
| Tools |`gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.tool.type`; arguments/result unless hidden by `FI_HIDE_*`||
185
+
| Input / output |`input.value` / `output.value` (what Observe shows as a span's input and output), copied from the captured chat messages, tool arguments and result, or human input. A single chat completion goes on `output.value` as its message object, which Observe's chat view shows as the assistant reply. `invoke_agent` gets the first chat input and the last chat output of its turn, so the trace list shows the question and the answer |When a `TraceConfig` flag hides the source, and always on `record_usage` spans (AG2 records no content there) |
173
186
| Errors | OTel status `ERROR` on failing tool / model / agent spans ||
assertscrub_text("see https://example.com/home/page and /not/a/known/root") =="see https://example.com/home/page and /not/a/known/root"
0 commit comments