From c8186b02c72b6552c5543e2c9ecd24d0daa8db11 Mon Sep 17 00:00:00 2001 From: bradAGI <46579244+bradAGI@users.noreply.github.com> Date: Mon, 24 Aug 2026 14:25:47 -0400 Subject: [PATCH] feat(autogen): add AG2-018, tool prints to stdout for diagnostics Ports OAI-010 to AutoGen. AutoGen makes it especially deceptive: the conversation itself is narrated to stdout, so a tool print lands mid transcript and reads as though it were part of the exchange, when it is invisible to the agents reasoning over it and carries no marker for which round or tool call produced it. Anyone reconstructing the run from a log sink rather than a terminal loses it entirely. --- autogen/observability.yaml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 autogen/observability.yaml diff --git a/autogen/observability.yaml b/autogen/observability.yaml new file mode 100644 index 0000000..f61f5a1 --- /dev/null +++ b/autogen/observability.yaml @@ -0,0 +1,39 @@ +policy: + id: autogen_observability + name: AutoGen tool observability hygiene + category: autogen + description: > + Rules covering how a registered AutoGen tool emits diagnostics. A tool body + that prints to stdout writes into the same stream the conversation itself is + narrated on, so the record is neither visible to the agents nor separable + from the transcript around it. + +rules: + - id: AG2-018 + title: AutoGen tool prints to stdout for diagnostics + severity: low + confidence: 0.65 + language: python + applies_to: + - autogen_tool + scope: tool + match: + has_print_call: true + explanation: > + The registered tool's body calls print(), which writes to the process's + stdout. Neither agent sees it — only the return value is posted back into + the conversation as the executor's reply — so the output silently + disappears in any deployment that captures structured records rather than + raw stdout. AutoGen makes that especially deceptive: the conversation + itself is narrated to stdout, so a tool print lands in the middle of the + transcript and reads as though it were part of the exchange, when in fact + it is invisible to the agents reasoning over it and carries no marker for + which round or which tool call produced it. Anyone reconstructing the run + from a log sink rather than a terminal loses it entirely. + fix: > + Remove the print(). For operator diagnostics, emit through a module logger + (logging.getLogger(__name__).info(...)) so the record carries its own + module and level and lands in the application's log sink rather than the + conversation narration. If the information needs to reach the assistant, + return it as part of the tool's result, which is the only channel the + agents actually read.