From e6224f7fd0a14a524214a7b3f16f2243545ec0a9 Mon Sep 17 00:00:00 2001 From: "David J. Bianco" Date: Thu, 23 Apr 2026 09:50:37 -0400 Subject: [PATCH 1/2] fix: disable agent callback file logging in Streamlit by default Changes the debug_agents default from True to False in peak_assistant_chat() so prompt/response content is not written to msgs.txt/results.txt on every Streamlit interaction. No callers pass debug_agents explicitly, so the default change covers all UI paths. Supersedes PR #72. Co-Authored-By: Claude Sonnet 4.6 --- peak_assistant/streamlit/util/ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peak_assistant/streamlit/util/ui.py b/peak_assistant/streamlit/util/ui.py index ac2ca3c..30a1217 100644 --- a/peak_assistant/streamlit/util/ui.py +++ b/peak_assistant/streamlit/util/ui.py @@ -37,7 +37,7 @@ def peak_assistant_chat( allow_upload: bool = False, agent_runner: Callable = None, run_button_label: str = None, - debug_agents: bool = True, + debug_agents: bool = False, ): """ Creates a two-column UI with a chat history and a document editor. From 259744918278ee6a65bb55978ee2332bc600ed45 Mon Sep 17 00:00:00 2001 From: DavidJBianco Date: Thu, 23 Apr 2026 08:55:28 -0400 Subject: [PATCH 2/2] fix: make agent callback logging opt-in for CLIs --- peak_assistant/data_assistant/__main__.py | 20 +++++++++++++++---- .../hypothesis_refiner_cli.py | 20 +++++++++++++++---- peak_assistant/planning_assistant/__main__.py | 20 +++++++++++++++---- 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/peak_assistant/data_assistant/__main__.py b/peak_assistant/data_assistant/__main__.py index 28411fa..337438d 100755 --- a/peak_assistant/data_assistant/__main__.py +++ b/peak_assistant/data_assistant/__main__.py @@ -87,6 +87,11 @@ def main() -> None: action="store_true", help="Skip user feedback and automatically accept the generated data discovery report" ) + parser.add_argument( + "--debug-agents", + action="store_true", + help="Enable agent debug logging to msgs.txt and results.txt" + ) args = parser.parse_args() # Load environment variables @@ -156,6 +161,16 @@ def main() -> None: exit(1) messages: List[TextMessage] = list() + debug_agents_opts = dict() + + if args.debug_agents: + debug_agents_opts = { + "msg_preprocess_callback": preprocess_messages_logging, + "msg_preprocess_kwargs": {"agent_id": "data-discovery"}, + "msg_postprocess_callback": postprocess_messages_logging, + "msg_postprocess_kwargs": {"agent_id": "data-discovery"}, + } + while True: # Run the hypothesizer asynchronously data_sources = asyncio.run( @@ -167,10 +182,7 @@ def main() -> None: local_context=local_context, verbose=args.verbose, previous_run=messages, - msg_preprocess_callback=preprocess_messages_logging, - msg_preprocess_kwargs={"agent_id": "data-discovery"}, - msg_postprocess_callback=postprocess_messages_logging, - msg_postprocess_kwargs={"agent_id": "data-discovery"}, + **debug_agents_opts, ) ) diff --git a/peak_assistant/hypothesis_assistant/hypothesis_refiner_cli.py b/peak_assistant/hypothesis_assistant/hypothesis_refiner_cli.py index 1572d12..b87e9bc 100755 --- a/peak_assistant/hypothesis_assistant/hypothesis_refiner_cli.py +++ b/peak_assistant/hypothesis_assistant/hypothesis_refiner_cli.py @@ -416,6 +416,11 @@ def main() -> None: help="Skip user feedback and automatically accept the refined hypothesis", default=False, ) + parser.add_argument( + "--debug-agents", + action="store_true", + help="Enable agent debug logging to msgs.txt and results.txt", + ) # Parse the arguments args = parser.parse_args() @@ -480,6 +485,16 @@ def main() -> None: messages: List[TextMessage] = list() current_hypothesis = args.hypothesis + debug_agents_opts = dict() + + if args.debug_agents: + debug_agents_opts = { + "msg_preprocess_callback": preprocess_messages_logging, + "msg_preprocess_kwargs": {"agent_id": "hypothesis-refiner"}, + "msg_postprocess_callback": postprocess_messages_logging, + "msg_postprocess_kwargs": {"agent_id": "hypothesis-refiner"}, + } + while True: # Run the hypothesizer asynchronously response = asyncio.run( @@ -490,10 +505,7 @@ def main() -> None: local_data_document=local_data or "", verbose=args.verbose, previous_run=messages, - msg_preprocess_callback=preprocess_messages_logging, - msg_preprocess_kwargs={"agent_id": "hypothesis-refiner"}, - msg_postprocess_callback=postprocess_messages_logging, - msg_postprocess_kwargs={"agent_id": "hypothesis-refiner"}, + **debug_agents_opts, ) ) diff --git a/peak_assistant/planning_assistant/__main__.py b/peak_assistant/planning_assistant/__main__.py index 7243ed6..21fd51c 100755 --- a/peak_assistant/planning_assistant/__main__.py +++ b/peak_assistant/planning_assistant/__main__.py @@ -95,6 +95,11 @@ def main() -> None: action="store_true", help="Skip user feedback and automatically accept the generated hunt plan" ) + parser.add_argument( + "--debug-agents", + action="store_true", + help="Enable agent debug logging to msgs.txt and results.txt" + ) args = parser.parse_args() # Load environment variables @@ -177,6 +182,16 @@ def main() -> None: exit(1) messages: List[TextMessage] = list() + debug_agents_opts = dict() + + if args.debug_agents: + debug_agents_opts = { + "msg_preprocess_callback": preprocess_messages_logging, + "msg_preprocess_kwargs": {"agent_id": "hunt-planner"}, + "msg_postprocess_callback": postprocess_messages_logging, + "msg_postprocess_kwargs": {"agent_id": "hunt-planner"}, + } + while True: # Run the hypothesizer asynchronously data_sources = asyncio.run( @@ -189,10 +204,7 @@ def main() -> None: local_context=local_context or "", verbose=args.verbose, previous_run=messages, - msg_preprocess_callback=preprocess_messages_logging, - msg_preprocess_kwargs={"agent_id": "hunt-planner"}, - msg_postprocess_callback=postprocess_messages_logging, - msg_postprocess_kwargs={"agent_id": "hunt-planner"}, + **debug_agents_opts, ) )