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, ) ) 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.