autobyteus 1.0.6__tar.gz → 1.1.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.
- {autobyteus-1.0.6 → autobyteus-1.1.0}/PKG-INFO +20 -2
- autobyteus-1.1.0/README.md +91 -0
- autobyteus-1.1.0/autobyteus/agent/agent.py +106 -0
- autobyteus-1.1.0/autobyteus/agent/bootstrap_steps/__init__.py +19 -0
- autobyteus-1.1.0/autobyteus/agent/bootstrap_steps/agent_bootstrapper.py +88 -0
- autobyteus-1.1.0/autobyteus/agent/bootstrap_steps/agent_runtime_queue_initialization_step.py +57 -0
- autobyteus-1.1.0/autobyteus/agent/bootstrap_steps/base_bootstrap_step.py +38 -0
- autobyteus-1.1.0/autobyteus/agent/bootstrap_steps/system_prompt_processing_step.py +93 -0
- autobyteus-1.1.0/autobyteus/agent/bootstrap_steps/workspace_context_initialization_step.py +47 -0
- autobyteus-1.1.0/autobyteus/agent/context/__init__.py +18 -0
- autobyteus-1.1.0/autobyteus/agent/context/agent_config.py +80 -0
- autobyteus-1.1.0/autobyteus/agent/context/agent_context.py +132 -0
- autobyteus-1.1.0/autobyteus/agent/context/agent_phase_manager.py +164 -0
- autobyteus-1.1.0/autobyteus/agent/context/agent_runtime_state.py +89 -0
- autobyteus-1.1.0/autobyteus/agent/context/phases.py +47 -0
- autobyteus-1.1.0/autobyteus/agent/events/__init__.py +63 -0
- autobyteus-1.1.0/autobyteus/agent/events/agent_events.py +147 -0
- autobyteus-1.1.0/autobyteus/agent/events/agent_input_event_queue_manager.py +174 -0
- autobyteus-1.1.0/autobyteus/agent/events/notifiers.py +104 -0
- autobyteus-1.1.0/autobyteus/agent/events/worker_event_dispatcher.py +118 -0
- autobyteus-1.1.0/autobyteus/agent/factory/__init__.py +9 -0
- autobyteus-1.1.0/autobyteus/agent/factory/agent_factory.py +141 -0
- autobyteus-1.1.0/autobyteus/agent/group/agent_group.py +155 -0
- autobyteus-1.1.0/autobyteus/agent/group/agent_group_context.py +81 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/__init__.py +36 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/approved_tool_invocation_event_handler.py +134 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/base_event_handler.py +36 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/event_handler_registry.py +76 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/generic_event_handler.py +46 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/inter_agent_message_event_handler.py +76 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/lifecycle_event_logger.py +64 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/llm_complete_response_received_event_handler.py +136 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/llm_user_message_ready_event_handler.py +140 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/tool_execution_approval_event_handler.py +85 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/tool_invocation_request_event_handler.py +186 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/tool_result_event_handler.py +96 -0
- autobyteus-1.1.0/autobyteus/agent/handlers/user_input_message_event_handler.py +77 -0
- autobyteus-1.1.0/autobyteus/agent/hooks/__init__.py +9 -0
- autobyteus-1.1.0/autobyteus/agent/hooks/base_phase_hook.py +52 -0
- autobyteus-1.1.0/autobyteus/agent/input_processor/__init__.py +18 -0
- autobyteus-1.1.0/autobyteus/agent/input_processor/base_user_input_processor.py +51 -0
- autobyteus-1.1.0/autobyteus/agent/input_processor/content_prefixing_input_processor.py +41 -0
- autobyteus-1.1.0/autobyteus/agent/input_processor/metadata_appending_input_processor.py +34 -0
- autobyteus-1.1.0/autobyteus/agent/input_processor/passthrough_input_processor.py +32 -0
- autobyteus-1.1.0/autobyteus/agent/input_processor/processor_definition.py +42 -0
- autobyteus-1.1.0/autobyteus/agent/input_processor/processor_meta.py +46 -0
- autobyteus-1.1.0/autobyteus/agent/input_processor/processor_registry.py +98 -0
- autobyteus-1.1.0/autobyteus/agent/llm_response_processor/__init__.py +16 -0
- autobyteus-1.1.0/autobyteus/agent/llm_response_processor/base_processor.py +50 -0
- autobyteus-1.1.0/autobyteus/agent/llm_response_processor/processor_definition.py +36 -0
- autobyteus-1.1.0/autobyteus/agent/llm_response_processor/processor_meta.py +37 -0
- autobyteus-1.1.0/autobyteus/agent/llm_response_processor/processor_registry.py +94 -0
- autobyteus-1.1.0/autobyteus/agent/llm_response_processor/provider_aware_tool_usage_processor.py +53 -0
- autobyteus-1.1.0/autobyteus/agent/message/__init__.py +20 -0
- autobyteus-1.1.0/autobyteus/agent/message/agent_input_user_message.py +96 -0
- autobyteus-1.1.0/autobyteus/agent/message/context_file.py +82 -0
- autobyteus-1.1.0/autobyteus/agent/message/context_file_type.py +64 -0
- autobyteus-1.0.6/autobyteus/agent/message/message.py → autobyteus-1.1.0/autobyteus/agent/message/inter_agent_message.py +12 -12
- autobyteus-1.0.6/autobyteus/agent/message/message_types.py → autobyteus-1.1.0/autobyteus/agent/message/inter_agent_message_type.py +8 -6
- autobyteus-1.1.0/autobyteus/agent/message/send_message_to.py +150 -0
- autobyteus-1.1.0/autobyteus/agent/remote_agent.py +244 -0
- autobyteus-1.1.0/autobyteus/agent/runtime/__init__.py +15 -0
- autobyteus-1.1.0/autobyteus/agent/runtime/agent_runtime.py +139 -0
- autobyteus-1.1.0/autobyteus/agent/runtime/agent_thread_pool_manager.py +88 -0
- autobyteus-1.1.0/autobyteus/agent/runtime/agent_worker.py +200 -0
- autobyteus-1.1.0/autobyteus/agent/streaming/__init__.py +15 -0
- autobyteus-1.1.0/autobyteus/agent/streaming/agent_event_stream.py +120 -0
- autobyteus-1.1.0/autobyteus/agent/streaming/queue_streamer.py +58 -0
- autobyteus-1.1.0/autobyteus/agent/streaming/stream_event_payloads.py +156 -0
- autobyteus-1.1.0/autobyteus/agent/streaming/stream_events.py +123 -0
- autobyteus-1.1.0/autobyteus/agent/system_prompt_processor/__init__.py +14 -0
- autobyteus-1.1.0/autobyteus/agent/system_prompt_processor/base_processor.py +45 -0
- autobyteus-1.1.0/autobyteus/agent/system_prompt_processor/processor_definition.py +40 -0
- autobyteus-1.1.0/autobyteus/agent/system_prompt_processor/processor_meta.py +47 -0
- autobyteus-1.1.0/autobyteus/agent/system_prompt_processor/processor_registry.py +119 -0
- autobyteus-1.1.0/autobyteus/agent/system_prompt_processor/tool_manifest_injector_processor.py +65 -0
- autobyteus-1.1.0/autobyteus/agent/tool_invocation.py +30 -0
- autobyteus-1.1.0/autobyteus/agent/utils/__init__.py +9 -0
- autobyteus-1.1.0/autobyteus/agent/utils/wait_for_idle.py +59 -0
- autobyteus-1.1.0/autobyteus/agent/workflow/__init__.py +11 -0
- autobyteus-1.1.0/autobyteus/agent/workflow/agentic_workflow.py +89 -0
- autobyteus-1.1.0/autobyteus/agent/workflow/base_agentic_workflow.py +98 -0
- autobyteus-1.1.0/autobyteus/agent/workspace/__init__.py +9 -0
- autobyteus-1.1.0/autobyteus/agent/workspace/base_workspace.py +55 -0
- autobyteus-1.1.0/autobyteus/cli/__init__.py +10 -0
- autobyteus-1.1.0/autobyteus/cli/agent_cli.py +299 -0
- autobyteus-1.1.0/autobyteus/events/event_emitter.py +51 -0
- autobyteus-1.1.0/autobyteus/events/event_manager.py +140 -0
- autobyteus-1.1.0/autobyteus/events/event_types.py +44 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/autobyteus_llm.py +13 -15
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/bedrock_llm.py +9 -3
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/claude_llm.py +10 -5
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/deepseek_llm.py +53 -91
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/gemini_llm.py +10 -4
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/grok_llm.py +53 -77
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/groq_llm.py +10 -5
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/mistral_llm.py +10 -5
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/nvidia_llm.py +9 -4
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/ollama_llm.py +56 -48
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/api/openai_llm.py +20 -14
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/base_llm.py +95 -34
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/extensions/base_extension.py +3 -4
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/extensions/token_usage_tracking_extension.py +2 -3
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/llm_factory.py +12 -13
- autobyteus-1.1.0/autobyteus/llm/models.py +164 -0
- autobyteus-1.1.0/autobyteus/llm/user_message.py +73 -0
- autobyteus-1.1.0/autobyteus/llm/utils/llm_config.py +187 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/utils/response_types.py +3 -2
- autobyteus-1.1.0/autobyteus/llm/utils/token_usage.py +16 -0
- autobyteus-1.1.0/autobyteus/rpc/__init__.py +73 -0
- autobyteus-1.1.0/autobyteus/rpc/client/__init__.py +17 -0
- autobyteus-1.1.0/autobyteus/rpc/client/abstract_client_connection.py +124 -0
- autobyteus-1.1.0/autobyteus/rpc/client/client_connection_manager.py +153 -0
- autobyteus-1.1.0/autobyteus/rpc/client/sse_client_connection.py +306 -0
- autobyteus-1.1.0/autobyteus/rpc/client/stdio_client_connection.py +280 -0
- autobyteus-1.1.0/autobyteus/rpc/config/__init__.py +13 -0
- autobyteus-1.1.0/autobyteus/rpc/config/agent_server_config.py +153 -0
- autobyteus-1.1.0/autobyteus/rpc/config/agent_server_registry.py +152 -0
- autobyteus-1.1.0/autobyteus/rpc/hosting.py +244 -0
- autobyteus-1.1.0/autobyteus/rpc/protocol.py +244 -0
- autobyteus-1.1.0/autobyteus/rpc/server/__init__.py +20 -0
- autobyteus-1.1.0/autobyteus/rpc/server/agent_server_endpoint.py +181 -0
- autobyteus-1.1.0/autobyteus/rpc/server/base_method_handler.py +40 -0
- autobyteus-1.1.0/autobyteus/rpc/server/method_handlers.py +259 -0
- autobyteus-1.1.0/autobyteus/rpc/server/sse_server_handler.py +182 -0
- autobyteus-1.1.0/autobyteus/rpc/server/stdio_server_handler.py +151 -0
- autobyteus-1.1.0/autobyteus/rpc/server_main.py +198 -0
- autobyteus-1.1.0/autobyteus/rpc/transport_type.py +13 -0
- autobyteus-1.1.0/autobyteus/tools/__init__.py +75 -0
- autobyteus-1.1.0/autobyteus/tools/ask_user_input.py +39 -0
- autobyteus-1.1.0/autobyteus/tools/base_tool.py +106 -0
- autobyteus-1.1.0/autobyteus/tools/bash/__init__.py +2 -0
- autobyteus-1.1.0/autobyteus/tools/bash/bash_executor.py +54 -0
- autobyteus-1.1.0/autobyteus/tools/browser/__init__.py +2 -0
- autobyteus-1.1.0/autobyteus/tools/browser/session_aware/browser_session_aware_navigate_to.py +73 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/browser/session_aware/browser_session_aware_tool.py +7 -4
- autobyteus-1.1.0/autobyteus/tools/browser/session_aware/browser_session_aware_web_element_trigger.py +151 -0
- autobyteus-1.1.0/autobyteus/tools/browser/session_aware/browser_session_aware_webpage_reader.py +86 -0
- autobyteus-1.1.0/autobyteus/tools/browser/session_aware/browser_session_aware_webpage_screenshot_taker.py +104 -0
- autobyteus-1.1.0/autobyteus/tools/browser/session_aware/factory/browser_session_aware_web_element_trigger_factory.py +14 -0
- autobyteus-1.1.0/autobyteus/tools/browser/session_aware/factory/browser_session_aware_webpage_reader_factory.py +26 -0
- autobyteus-1.1.0/autobyteus/tools/browser/session_aware/factory/browser_session_aware_webpage_screenshot_taker_factory.py +14 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/browser/session_aware/shared_browser_session_manager.py +4 -3
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/__init__.py +7 -0
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/factory/google_search_factory.py +25 -0
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/factory/webpage_reader_factory.py +25 -0
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/factory/webpage_screenshot_taker_factory.py +14 -0
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/google_search_ui.py +124 -0
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/navigate_to.py +78 -0
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/web_page_pdf_generator.py +94 -0
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/webpage_image_downloader.py +162 -0
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/webpage_reader.py +99 -0
- autobyteus-1.1.0/autobyteus/tools/browser/standalone/webpage_screenshot_taker.py +98 -0
- autobyteus-1.1.0/autobyteus/tools/factory/__init__.py +9 -0
- autobyteus-1.1.0/autobyteus/tools/factory/tool_factory.py +31 -0
- autobyteus-1.1.0/autobyteus/tools/file/file_reader.py +29 -0
- autobyteus-1.1.0/autobyteus/tools/file/file_writer.py +31 -0
- autobyteus-1.1.0/autobyteus/tools/functional_tool.py +234 -0
- autobyteus-1.1.0/autobyteus/tools/image_downloader.py +97 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/__init__.py +47 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/call_handlers/__init__.py +18 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/call_handlers/base_handler.py +40 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/call_handlers/sse_handler.py +22 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/call_handlers/stdio_handler.py +62 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/call_handlers/streamable_http_handler.py +55 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/config_service.py +258 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/factory.py +70 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/registrar.py +135 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/schema_mapper.py +131 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/tool.py +101 -0
- autobyteus-1.1.0/autobyteus/tools/mcp/types.py +96 -0
- autobyteus-1.1.0/autobyteus/tools/parameter_schema.py +268 -0
- autobyteus-1.1.0/autobyteus/tools/pdf_downloader.py +88 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/registry/__init__.py +0 -2
- autobyteus-1.1.0/autobyteus/tools/registry/tool_definition.py +132 -0
- autobyteus-1.1.0/autobyteus/tools/registry/tool_registry.py +130 -0
- autobyteus-1.1.0/autobyteus/tools/timer.py +169 -0
- autobyteus-1.1.0/autobyteus/tools/tool_config.py +117 -0
- autobyteus-1.1.0/autobyteus/tools/tool_meta.py +74 -0
- autobyteus-1.1.0/autobyteus/tools/usage/__init__.py +6 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/__init__.py +31 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/anthropic_json_example_formatter.py +18 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/anthropic_json_schema_formatter.py +25 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/base_formatter.py +42 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/default_json_example_formatter.py +42 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/default_json_schema_formatter.py +28 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/default_xml_example_formatter.py +55 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/default_xml_schema_formatter.py +46 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/gemini_json_example_formatter.py +34 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/gemini_json_schema_formatter.py +25 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/google_json_example_formatter.py +34 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/google_json_schema_formatter.py +25 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/openai_json_example_formatter.py +49 -0
- autobyteus-1.1.0/autobyteus/tools/usage/formatters/openai_json_schema_formatter.py +28 -0
- autobyteus-1.1.0/autobyteus/tools/usage/parsers/__init__.py +22 -0
- autobyteus-1.1.0/autobyteus/tools/usage/parsers/anthropic_xml_tool_usage_parser.py +10 -0
- autobyteus-1.1.0/autobyteus/tools/usage/parsers/base_parser.py +41 -0
- autobyteus-1.1.0/autobyteus/tools/usage/parsers/default_json_tool_usage_parser.py +106 -0
- autobyteus-1.1.0/autobyteus/tools/usage/parsers/default_xml_tool_usage_parser.py +135 -0
- autobyteus-1.1.0/autobyteus/tools/usage/parsers/exceptions.py +13 -0
- autobyteus-1.1.0/autobyteus/tools/usage/parsers/gemini_json_tool_usage_parser.py +68 -0
- autobyteus-1.1.0/autobyteus/tools/usage/parsers/openai_json_tool_usage_parser.py +147 -0
- autobyteus-1.1.0/autobyteus/tools/usage/parsers/provider_aware_tool_usage_parser.py +67 -0
- autobyteus-1.1.0/autobyteus/tools/usage/providers/__init__.py +22 -0
- autobyteus-1.1.0/autobyteus/tools/usage/providers/json_example_provider.py +32 -0
- autobyteus-1.1.0/autobyteus/tools/usage/providers/json_schema_provider.py +35 -0
- autobyteus-1.1.0/autobyteus/tools/usage/providers/json_tool_usage_parser_provider.py +28 -0
- autobyteus-1.1.0/autobyteus/tools/usage/providers/tool_manifest_provider.py +68 -0
- autobyteus-1.1.0/autobyteus/tools/usage/providers/xml_example_provider.py +28 -0
- autobyteus-1.1.0/autobyteus/tools/usage/providers/xml_schema_provider.py +29 -0
- autobyteus-1.1.0/autobyteus/tools/usage/providers/xml_tool_usage_parser_provider.py +26 -0
- autobyteus-1.1.0/autobyteus/tools/usage/registries/__init__.py +20 -0
- autobyteus-1.1.0/autobyteus/tools/usage/registries/json_example_formatter_registry.py +51 -0
- autobyteus-1.1.0/autobyteus/tools/usage/registries/json_schema_formatter_registry.py +51 -0
- autobyteus-1.1.0/autobyteus/tools/usage/registries/json_tool_usage_parser_registry.py +42 -0
- autobyteus-1.1.0/autobyteus/tools/usage/registries/xml_example_formatter_registry.py +30 -0
- autobyteus-1.1.0/autobyteus/tools/usage/registries/xml_schema_formatter_registry.py +33 -0
- autobyteus-1.1.0/autobyteus/tools/usage/registries/xml_tool_usage_parser_registry.py +30 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus.egg-info/PKG-INFO +20 -2
- autobyteus-1.1.0/autobyteus.egg-info/SOURCES.txt +283 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus.egg-info/requires.txt +2 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/setup.py +3 -1
- autobyteus-1.0.6/README.md +0 -75
- autobyteus-1.0.6/autobyteus/agent/agent.py +0 -231
- autobyteus-1.0.6/autobyteus/agent/async_agent.py +0 -175
- autobyteus-1.0.6/autobyteus/agent/async_group_aware_agent.py +0 -136
- autobyteus-1.0.6/autobyteus/agent/group/async_group_aware_agent.py +0 -122
- autobyteus-1.0.6/autobyteus/agent/group/coordinator_agent.py +0 -36
- autobyteus-1.0.6/autobyteus/agent/group/group_aware_agent.py +0 -121
- autobyteus-1.0.6/autobyteus/agent/message/send_message_to.py +0 -44
- autobyteus-1.0.6/autobyteus/agent/orchestrator/base_agent_orchestrator.py +0 -82
- autobyteus-1.0.6/autobyteus/agent/orchestrator/multi_replica_agent_orchestrator.py +0 -72
- autobyteus-1.0.6/autobyteus/agent/orchestrator/single_replica_agent_orchestrator.py +0 -43
- autobyteus-1.0.6/autobyteus/agent/response_parser/tool_usage_command_parser.py +0 -100
- autobyteus-1.0.6/autobyteus/agent/status.py +0 -12
- autobyteus-1.0.6/autobyteus/agent/tool_invocation.py +0 -7
- autobyteus-1.0.6/autobyteus/conversation/conversation.py +0 -54
- autobyteus-1.0.6/autobyteus/conversation/user_message.py +0 -59
- autobyteus-1.0.6/autobyteus/events/decorators.py +0 -29
- autobyteus-1.0.6/autobyteus/events/event_emitter.py +0 -74
- autobyteus-1.0.6/autobyteus/events/event_manager.py +0 -73
- autobyteus-1.0.6/autobyteus/events/event_types.py +0 -17
- autobyteus-1.0.6/autobyteus/llm/models.py +0 -85
- autobyteus-1.0.6/autobyteus/llm/utils/llm_config.py +0 -90
- autobyteus-1.0.6/autobyteus/llm/utils/token_usage.py +0 -13
- autobyteus-1.0.6/autobyteus/prompt/prompt_version_manager.py +0 -58
- autobyteus-1.0.6/autobyteus/prompt/storage/prompt_version_model.py +0 -29
- autobyteus-1.0.6/autobyteus/prompt/storage/prompt_version_repository.py +0 -83
- autobyteus-1.0.6/autobyteus/tools/ask_user_input.py +0 -82
- autobyteus-1.0.6/autobyteus/tools/base_tool.py +0 -77
- autobyteus-1.0.6/autobyteus/tools/bash/bash_executor.py +0 -91
- autobyteus-1.0.6/autobyteus/tools/bash/factory/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/bash/factory/bash_executor_factory.py +0 -6
- autobyteus-1.0.6/autobyteus/tools/browser/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/browser/session_aware/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/browser/session_aware/browser_session_aware_navigate_to.py +0 -65
- autobyteus-1.0.6/autobyteus/tools/browser/session_aware/browser_session_aware_web_element_trigger.py +0 -159
- autobyteus-1.0.6/autobyteus/tools/browser/session_aware/browser_session_aware_webpage_reader.py +0 -33
- autobyteus-1.0.6/autobyteus/tools/browser/session_aware/browser_session_aware_webpage_screenshot_taker.py +0 -38
- autobyteus-1.0.6/autobyteus/tools/browser/session_aware/factory/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/browser/session_aware/factory/browser_session_aware_web_element_trigger_factory.py +0 -6
- autobyteus-1.0.6/autobyteus/tools/browser/session_aware/factory/browser_session_aware_webpage_reader_factory.py +0 -10
- autobyteus-1.0.6/autobyteus/tools/browser/session_aware/factory/browser_session_aware_webpage_screenshot_taker_factory.py +0 -6
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/factory/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/factory/google_search_factory.py +0 -10
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/factory/webpage_reader_factory.py +0 -10
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/factory/webpage_screenshot_taker_factory.py +0 -6
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/google_search_ui.py +0 -87
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/navigate_to.py +0 -54
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/webpage_image_downloader.py +0 -77
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/webpage_reader.py +0 -80
- autobyteus-1.0.6/autobyteus/tools/browser/standalone/webpage_screenshot_taker.py +0 -52
- autobyteus-1.0.6/autobyteus/tools/factory/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/factory/ask_user_input_factory.py +0 -6
- autobyteus-1.0.6/autobyteus/tools/factory/image_downloader_factory.py +0 -9
- autobyteus-1.0.6/autobyteus/tools/factory/pdf_downloader_factory.py +0 -9
- autobyteus-1.0.6/autobyteus/tools/factory/tool_factory.py +0 -10
- autobyteus-1.0.6/autobyteus/tools/factory/webpage_image_downloader_factory.py +0 -6
- autobyteus-1.0.6/autobyteus/tools/file/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/file/factory/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/file/factory/file_reader_factory.py +0 -6
- autobyteus-1.0.6/autobyteus/tools/file/factory/file_writer_factory.py +0 -6
- autobyteus-1.0.6/autobyteus/tools/file/file_reader.py +0 -58
- autobyteus-1.0.6/autobyteus/tools/file/file_writer.py +0 -62
- autobyteus-1.0.6/autobyteus/tools/handlers/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/image_downloader.py +0 -119
- autobyteus-1.0.6/autobyteus/tools/operation/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/tools/pdf_downloader.py +0 -89
- autobyteus-1.0.6/autobyteus/tools/registry/tool_definition.py +0 -60
- autobyteus-1.0.6/autobyteus/tools/registry/tool_registry.py +0 -106
- autobyteus-1.0.6/autobyteus/tools/timer.py +0 -121
- autobyteus-1.0.6/autobyteus/tools/tool_meta.py +0 -52
- autobyteus-1.0.6/autobyteus/tools/web_page_pdf_generator.py +0 -90
- autobyteus-1.0.6/autobyteus/utils/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus/workflow/__init__.py +0 -0
- autobyteus-1.0.6/autobyteus.egg-info/SOURCES.txt +0 -161
- {autobyteus-1.0.6 → autobyteus-1.1.0}/LICENSE +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/agent/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/agent/exceptions.py +0 -0
- {autobyteus-1.0.6/autobyteus/agent/factory → autobyteus-1.1.0/autobyteus/agent/group}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/check_requirements.py +0 -0
- {autobyteus-1.0.6/autobyteus/agent/group → autobyteus-1.1.0/autobyteus/events}/__init__.py +0 -0
- {autobyteus-1.0.6/autobyteus/agent/message → autobyteus-1.1.0/autobyteus/llm}/__init__.py +0 -0
- {autobyteus-1.0.6/autobyteus/agent/orchestrator → autobyteus-1.1.0/autobyteus/llm/api}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/autobyteus_provider.py +0 -0
- {autobyteus-1.0.6/autobyteus/agent/response_parser → autobyteus-1.1.0/autobyteus/llm/extensions}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/extensions/extension_registry.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/ollama_provider.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/providers.py +0 -0
- {autobyteus-1.0.6/autobyteus/conversation → autobyteus-1.1.0/autobyteus/llm/token_counter}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/token_counter/base_token_counter.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/token_counter/claude_token_counter.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/token_counter/deepseek_token_counter.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/token_counter/mistral_token_counter.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/token_counter/openai_token_counter.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/token_counter/token_counter_factory.py +0 -0
- {autobyteus-1.0.6/autobyteus/events → autobyteus-1.1.0/autobyteus/llm/utils}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/utils/image_payload_formatter.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/utils/messages.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/utils/rate_limiter.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/utils/token_pricing_config.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/llm/utils/token_usage_tracker.py +0 -0
- {autobyteus-1.0.6/autobyteus/llm → autobyteus-1.1.0/autobyteus/person}/__init__.py +0 -0
- {autobyteus-1.0.6/autobyteus/llm/api → autobyteus-1.1.0/autobyteus/person/examples}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/person/examples/sample_persons.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/person/examples/sample_roles.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/person/person.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/person/role.py +0 -0
- {autobyteus-1.0.6/autobyteus/llm/extensions → autobyteus-1.1.0/autobyteus/prompt}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/prompt/prompt_builder.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/prompt/prompt_template.py +0 -0
- {autobyteus-1.0.6/autobyteus/llm/token_counter → autobyteus-1.1.0/autobyteus/tools/browser/session_aware}/__init__.py +0 -0
- {autobyteus-1.0.6/autobyteus/llm/utils → autobyteus-1.1.0/autobyteus/tools/browser/session_aware/factory}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/browser/session_aware/shared_browser_session.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/browser/session_aware/web_element_action.py +0 -0
- {autobyteus-1.0.6/autobyteus/person → autobyteus-1.1.0/autobyteus/tools/browser/standalone/factory}/__init__.py +0 -0
- {autobyteus-1.0.6/autobyteus/person/examples → autobyteus-1.1.0/autobyteus/tools/file}/__init__.py +0 -0
- {autobyteus-1.0.6/autobyteus/prompt → autobyteus-1.1.0/autobyteus/tools/handlers}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/handlers/shell_handler.py +0 -0
- {autobyteus-1.0.6/autobyteus/prompt/storage → autobyteus-1.1.0/autobyteus/tools/operation}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/operation/file_operation.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/operation/file_rename_operation.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/operation/operation.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/operation/shell_operation.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/tools/utils.py +0 -0
- {autobyteus-1.0.6/autobyteus/tools → autobyteus-1.1.0/autobyteus/utils}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/utils/dynamic_enum.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/utils/file_utils.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/utils/html_cleaner.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/utils/singleton.py +0 -0
- {autobyteus-1.0.6/autobyteus/tools/bash → autobyteus-1.1.0/autobyteus/workflow}/__init__.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/workflow/simple_task.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/workflow/task.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus/workflow/workflow.py +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus.egg-info/dependency_links.txt +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/autobyteus.egg-info/top_level.txt +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/pyproject.toml +0 -0
- {autobyteus-1.0.6 → autobyteus-1.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: autobyteus
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: Multi-Agent framework
|
|
5
5
|
Home-page: https://github.com/AutoByteus/autobyteus
|
|
6
6
|
Author: Ryan Zheng
|
|
@@ -27,6 +27,8 @@ Requires-Dist: anthropic==0.37.1
|
|
|
27
27
|
Requires-Dist: Jinja2
|
|
28
28
|
Requires-Dist: ollama==0.4.5
|
|
29
29
|
Requires-Dist: mistral_common
|
|
30
|
+
Requires-Dist: certifi==2025.4.26
|
|
31
|
+
Requires-Dist: numpy==2.2.5
|
|
30
32
|
Requires-Dist: aiohttp
|
|
31
33
|
Requires-Dist: autobyteus-llm-client==1.1.0
|
|
32
34
|
Requires-Dist: brui-core==1.0.8
|
|
@@ -66,6 +68,18 @@ Dynamic: summary
|
|
|
66
68
|
|
|
67
69
|
Autobyteus is an open-source coding assistance tool designed to enhance the software development workflow by making it context-aware. Each step in the workflow is interactive through a user-friendly interface, incorporating the entire software development lifecycle into each stage.
|
|
68
70
|
|
|
71
|
+
## Architecture
|
|
72
|
+
|
|
73
|
+
Autobyteus is built with a modular, event-driven architecture designed for extensibility and clear separation of concerns. The key components are:
|
|
74
|
+
|
|
75
|
+
- **Agent Core**: The heart of the system, comprising an `Agent` facade that provides the primary user-facing API. This facade communicates with an `AgentRuntime`, which manages an `AgentWorker` running in a dedicated thread. This design ensures non-blocking agent operations.
|
|
76
|
+
- **Context & Configuration**: Agent behavior is defined through a clear configuration (`AgentConfig`) and its dynamic state is managed in `AgentRuntimeState`. These are bundled into a comprehensive `AgentContext` that is available to all components during runtime, providing a single source of truth for an agent's status and capabilities.
|
|
77
|
+
- **Event-Driven System**: Agents operate on an internal event loop. Actions (like receiving user messages or tool results) are translated into events and placed on internal queues. `EventHandlers` process these events, containing the core logic for how an agent thinks and acts. This decouples logic and makes the system easy to extend.
|
|
78
|
+
- **Pluggable Processors**: The framework uses a pipeline of processors to modify data at key stages. `SystemPromptProcessors` dynamically build the final system prompt (e.g., by injecting tool definitions), `InputProcessors` preprocess user messages, and `LLMResponseProcessors` parse outputs from the language model (e.g., to detect tool usage).
|
|
79
|
+
- **Tooling**: Agents can be extended with `Tools`, which are self-contained capabilities that can be called by the LLM. The system includes built-in tools (like `SendMessageTo` for inter-agent communication) and supports custom tools.
|
|
80
|
+
- **Multi-Agent Systems**: The `AgentGroup` and `AgenticWorkflow` abstractions provide powerful, high-level APIs for orchestrating multiple agents to collaborate on complex tasks.
|
|
81
|
+
- **Remote Agents**: Built-in RPC capabilities allow for communication with agents running in separate processes or on different machines, enabling distributed agent systems.
|
|
82
|
+
|
|
69
83
|
## Features
|
|
70
84
|
|
|
71
85
|
- **Context-Aware Workflows**: Each step in the development process interacts with large language models to provide relevant assistance.
|
|
@@ -74,7 +88,11 @@ Autobyteus is an open-source coding assistance tool designed to enhance the soft
|
|
|
74
88
|
|
|
75
89
|
## Knowledge Base
|
|
76
90
|
|
|
77
|
-
A significant part of
|
|
91
|
+
A significant part of Autobyteus is our custom-designed knowledge base focused on software and application development. The knowledge base is structured to support the entire development process, with particular emphasis on requirement engineering, which is crucial for successful project outcomes.
|
|
92
|
+
|
|
93
|
+
## Requirements
|
|
94
|
+
|
|
95
|
+
- **Python Version**: Python 3.11 is the recommended and tested version for this project. Using newer versions of Python may result in dependency conflicts when installing the required packages. For a stable and tested environment, please use Python 3.11.
|
|
78
96
|
|
|
79
97
|
## Getting Started
|
|
80
98
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Autobyteus
|
|
2
|
+
|
|
3
|
+
Autobyteus is an open-source coding assistance tool designed to enhance the software development workflow by making it context-aware. Each step in the workflow is interactive through a user-friendly interface, incorporating the entire software development lifecycle into each stage.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
Autobyteus is built with a modular, event-driven architecture designed for extensibility and clear separation of concerns. The key components are:
|
|
8
|
+
|
|
9
|
+
- **Agent Core**: The heart of the system, comprising an `Agent` facade that provides the primary user-facing API. This facade communicates with an `AgentRuntime`, which manages an `AgentWorker` running in a dedicated thread. This design ensures non-blocking agent operations.
|
|
10
|
+
- **Context & Configuration**: Agent behavior is defined through a clear configuration (`AgentConfig`) and its dynamic state is managed in `AgentRuntimeState`. These are bundled into a comprehensive `AgentContext` that is available to all components during runtime, providing a single source of truth for an agent's status and capabilities.
|
|
11
|
+
- **Event-Driven System**: Agents operate on an internal event loop. Actions (like receiving user messages or tool results) are translated into events and placed on internal queues. `EventHandlers` process these events, containing the core logic for how an agent thinks and acts. This decouples logic and makes the system easy to extend.
|
|
12
|
+
- **Pluggable Processors**: The framework uses a pipeline of processors to modify data at key stages. `SystemPromptProcessors` dynamically build the final system prompt (e.g., by injecting tool definitions), `InputProcessors` preprocess user messages, and `LLMResponseProcessors` parse outputs from the language model (e.g., to detect tool usage).
|
|
13
|
+
- **Tooling**: Agents can be extended with `Tools`, which are self-contained capabilities that can be called by the LLM. The system includes built-in tools (like `SendMessageTo` for inter-agent communication) and supports custom tools.
|
|
14
|
+
- **Multi-Agent Systems**: The `AgentGroup` and `AgenticWorkflow` abstractions provide powerful, high-level APIs for orchestrating multiple agents to collaborate on complex tasks.
|
|
15
|
+
- **Remote Agents**: Built-in RPC capabilities allow for communication with agents running in separate processes or on different machines, enabling distributed agent systems.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Context-Aware Workflows**: Each step in the development process interacts with large language models to provide relevant assistance.
|
|
20
|
+
- **Lifecycle Integration**: Supports the entire software development lifecycle, starting from requirement engineering.
|
|
21
|
+
- **Memory Management**: Custom memory management system supporting different memory providers and embeddings.
|
|
22
|
+
|
|
23
|
+
## Knowledge Base
|
|
24
|
+
|
|
25
|
+
A significant part of Autobyteus is our custom-designed knowledge base focused on software and application development. The knowledge base is structured to support the entire development process, with particular emphasis on requirement engineering, which is crucial for successful project outcomes.
|
|
26
|
+
|
|
27
|
+
## Requirements
|
|
28
|
+
|
|
29
|
+
- **Python Version**: Python 3.11 is the recommended and tested version for this project. Using newer versions of Python may result in dependency conflicts when installing the required packages. For a stable and tested environment, please use Python 3.11.
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
|
|
33
|
+
### Installation
|
|
34
|
+
|
|
35
|
+
1. **For users:**
|
|
36
|
+
To install Autobyteus, run:
|
|
37
|
+
```
|
|
38
|
+
pip install .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. **For developers:**
|
|
42
|
+
To install Autobyteus with development dependencies, run:
|
|
43
|
+
```
|
|
44
|
+
pip install -r requirements-dev.txt
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
3. **Platform-specific dependencies:**
|
|
48
|
+
To install platform-specific dependencies, run:
|
|
49
|
+
```
|
|
50
|
+
python setup.py install_platform_deps
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Building the Library
|
|
54
|
+
|
|
55
|
+
To build Autobyteus as a distributable package, follow these steps:
|
|
56
|
+
|
|
57
|
+
1. Ensure you have the latest version of `setuptools` and `wheel` installed:
|
|
58
|
+
```
|
|
59
|
+
pip install --upgrade setuptools wheel
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
2. Build the distribution packages:
|
|
63
|
+
```
|
|
64
|
+
python setup.py sdist bdist_wheel
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This will create a `dist` directory containing the built distributions.
|
|
68
|
+
|
|
69
|
+
3. (Optional) To create a source distribution only:
|
|
70
|
+
```
|
|
71
|
+
python setup.py sdist
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
4. (Optional) To create a wheel distribution only:
|
|
75
|
+
```
|
|
76
|
+
python setup.py bdist_wheel
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The built packages will be in the `dist` directory and can be installed using pip or distributed as needed.
|
|
80
|
+
|
|
81
|
+
### Usage
|
|
82
|
+
|
|
83
|
+
(Add basic commands and examples to get users started)
|
|
84
|
+
|
|
85
|
+
### Contributing
|
|
86
|
+
|
|
87
|
+
(Add guidelines for contributing to the project)
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/agent/agent.py
|
|
2
|
+
import asyncio
|
|
3
|
+
import logging
|
|
4
|
+
from typing import AsyncIterator, Optional, List, Any, Dict, TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from autobyteus.agent.runtime.agent_runtime import AgentRuntime
|
|
7
|
+
from autobyteus.agent.context.phases import AgentOperationalPhase
|
|
8
|
+
from autobyteus.agent.message.agent_input_user_message import AgentInputUserMessage
|
|
9
|
+
from autobyteus.agent.message.inter_agent_message import InterAgentMessage
|
|
10
|
+
from autobyteus.agent.events import UserMessageReceivedEvent, InterAgentMessageReceivedEvent, ToolExecutionApprovalEvent, BaseEvent
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from autobyteus.agent.context import AgentContext
|
|
14
|
+
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
|
|
17
|
+
class Agent:
|
|
18
|
+
"""
|
|
19
|
+
User-facing API for interacting with an agent's runtime.
|
|
20
|
+
It manages an underlying AgentRuntime instance and translates user actions
|
|
21
|
+
into events for the agent's event processing loop by submitting them
|
|
22
|
+
to AgentRuntime. Output is consumed via AgentEventStream which listens
|
|
23
|
+
to AgentExternalEventNotifier.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __init__(self, runtime: AgentRuntime):
|
|
27
|
+
if not isinstance(runtime, AgentRuntime): # pragma: no cover
|
|
28
|
+
raise TypeError(f"Agent requires an AgentRuntime instance, got {type(runtime).__name__}")
|
|
29
|
+
|
|
30
|
+
self._runtime: AgentRuntime = runtime
|
|
31
|
+
self.agent_id: str = self._runtime.context.agent_id
|
|
32
|
+
|
|
33
|
+
logger.info(f"Agent facade initialized for agent_id '{self.agent_id}'.")
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def context(self) -> 'AgentContext':
|
|
37
|
+
return self._runtime.context
|
|
38
|
+
|
|
39
|
+
async def _submit_event_to_runtime(self, event: BaseEvent) -> None:
|
|
40
|
+
"""Internal helper to submit an event to the runtime and handle startup."""
|
|
41
|
+
if not self._runtime.is_running: # pragma: no cover
|
|
42
|
+
logger.info(f"Agent '{self.agent_id}' runtime is not running. Calling start() before submitting event.")
|
|
43
|
+
self.start()
|
|
44
|
+
await asyncio.sleep(0.05)
|
|
45
|
+
|
|
46
|
+
logger.debug(f"Agent '{self.agent_id}': Submitting {type(event).__name__} to runtime.")
|
|
47
|
+
await self._runtime.submit_event(event)
|
|
48
|
+
|
|
49
|
+
async def post_user_message(self, agent_input_user_message: AgentInputUserMessage) -> None:
|
|
50
|
+
if not isinstance(agent_input_user_message, AgentInputUserMessage): # pragma: no cover
|
|
51
|
+
raise TypeError(f"Agent for '{self.agent_id}' received invalid type for user_message. Expected AgentInputUserMessage, got {type(agent_input_user_message)}.")
|
|
52
|
+
|
|
53
|
+
event = UserMessageReceivedEvent(agent_input_user_message=agent_input_user_message)
|
|
54
|
+
await self._submit_event_to_runtime(event)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
async def post_inter_agent_message(self, inter_agent_message: InterAgentMessage) -> None:
|
|
58
|
+
if not isinstance(inter_agent_message, InterAgentMessage): # pragma: no cover
|
|
59
|
+
raise TypeError(
|
|
60
|
+
f"Agent for '{self.agent_id}' received invalid type for inter_agent_message. "
|
|
61
|
+
f"Expected InterAgentMessage, got {type(inter_agent_message).__name__}."
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
event = InterAgentMessageReceivedEvent(inter_agent_message=inter_agent_message)
|
|
65
|
+
await self._submit_event_to_runtime(event)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def post_tool_execution_approval(self,
|
|
69
|
+
tool_invocation_id: str,
|
|
70
|
+
is_approved: bool,
|
|
71
|
+
reason: Optional[str] = None) -> None:
|
|
72
|
+
if not isinstance(tool_invocation_id, str) or not tool_invocation_id: # pragma: no cover
|
|
73
|
+
raise ValueError("tool_invocation_id must be a non-empty string.")
|
|
74
|
+
if not isinstance(is_approved, bool): # pragma: no cover
|
|
75
|
+
raise TypeError("is_approved must be a boolean.")
|
|
76
|
+
|
|
77
|
+
approval_event = ToolExecutionApprovalEvent(
|
|
78
|
+
tool_invocation_id=tool_invocation_id,
|
|
79
|
+
is_approved=is_approved,
|
|
80
|
+
reason=reason
|
|
81
|
+
)
|
|
82
|
+
await self._submit_event_to_runtime(approval_event)
|
|
83
|
+
|
|
84
|
+
def get_current_phase(self) -> AgentOperationalPhase:
|
|
85
|
+
return self._runtime.current_phase_property
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def is_running(self) -> bool:
|
|
89
|
+
return self._runtime.is_running
|
|
90
|
+
|
|
91
|
+
def start(self) -> None:
|
|
92
|
+
if self._runtime.is_running: # pragma: no cover
|
|
93
|
+
logger.info(f"Agent '{self.agent_id}' runtime is already running. Ignoring start command.")
|
|
94
|
+
return
|
|
95
|
+
|
|
96
|
+
logger.info(f"Agent '{self.agent_id}' requesting runtime to start.")
|
|
97
|
+
self._runtime.start()
|
|
98
|
+
|
|
99
|
+
async def stop(self, timeout: float = 10.0) -> None: # pragma: no cover
|
|
100
|
+
logger.info(f"Agent '{self.agent_id}' requesting runtime to stop (timeout: {timeout}s).")
|
|
101
|
+
await self._runtime.stop(timeout=timeout)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def __repr__(self) -> str:
|
|
105
|
+
phase_val = self._runtime.current_phase_property.value
|
|
106
|
+
return f"<Agent agent_id='{self.agent_id}', current_phase='{phase_val}'>"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/agent/bootstrap_steps/__init__.py
|
|
2
|
+
"""
|
|
3
|
+
Defines individual, self-contained steps for the agent bootstrapping process.
|
|
4
|
+
These steps are orchestrated by the BootstrapAgentEventHandler.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .base_bootstrap_step import BaseBootstrapStep
|
|
8
|
+
from .agent_runtime_queue_initialization_step import AgentRuntimeQueueInitializationStep # UPDATED
|
|
9
|
+
from .workspace_context_initialization_step import WorkspaceContextInitializationStep
|
|
10
|
+
# ToolInitializationStep is no longer a bootstrap step.
|
|
11
|
+
from .system_prompt_processing_step import SystemPromptProcessingStep
|
|
12
|
+
# LLMConfigFinalizationStep and LLMInstanceCreationStep removed.
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"BaseBootstrapStep",
|
|
16
|
+
"AgentRuntimeQueueInitializationStep", # UPDATED
|
|
17
|
+
"WorkspaceContextInitializationStep",
|
|
18
|
+
"SystemPromptProcessingStep",
|
|
19
|
+
]
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/agent/bootstrap_steps/agent_bootstrapper.py
|
|
2
|
+
import logging
|
|
3
|
+
from typing import TYPE_CHECKING, List, Optional
|
|
4
|
+
|
|
5
|
+
from .base_bootstrap_step import BaseBootstrapStep
|
|
6
|
+
from .agent_runtime_queue_initialization_step import AgentRuntimeQueueInitializationStep
|
|
7
|
+
from .workspace_context_initialization_step import WorkspaceContextInitializationStep
|
|
8
|
+
from .system_prompt_processing_step import SystemPromptProcessingStep
|
|
9
|
+
from autobyteus.agent.events import AgentReadyEvent
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from autobyteus.agent.context import AgentContext
|
|
13
|
+
from autobyteus.agent.context.agent_phase_manager import AgentPhaseManager
|
|
14
|
+
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
|
|
17
|
+
class AgentBootstrapper:
|
|
18
|
+
"""
|
|
19
|
+
Orchestrates the agent's bootstrapping process by executing a sequence of
|
|
20
|
+
self-contained bootstrap steps.
|
|
21
|
+
"""
|
|
22
|
+
def __init__(self, steps: Optional[List[BaseBootstrapStep]] = None):
|
|
23
|
+
"""
|
|
24
|
+
Initializes the AgentBootstrapper.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
steps: An optional list of bootstrap steps to execute. If not provided,
|
|
28
|
+
a default sequence will be used.
|
|
29
|
+
"""
|
|
30
|
+
if steps is None:
|
|
31
|
+
self.bootstrap_steps: List[BaseBootstrapStep] = [
|
|
32
|
+
AgentRuntimeQueueInitializationStep(),
|
|
33
|
+
WorkspaceContextInitializationStep(),
|
|
34
|
+
SystemPromptProcessingStep(),
|
|
35
|
+
]
|
|
36
|
+
logger.debug("AgentBootstrapper initialized with default steps.")
|
|
37
|
+
else:
|
|
38
|
+
self.bootstrap_steps = steps
|
|
39
|
+
logger.debug(f"AgentBootstrapper initialized with {len(steps)} custom steps.")
|
|
40
|
+
|
|
41
|
+
async def run(self, context: 'AgentContext', phase_manager: 'AgentPhaseManager') -> bool:
|
|
42
|
+
"""
|
|
43
|
+
Executes the configured sequence of bootstrap steps.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
context: The agent's context.
|
|
47
|
+
phase_manager: The agent's phase manager.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
True if all steps completed successfully, False otherwise.
|
|
51
|
+
"""
|
|
52
|
+
agent_id = context.agent_id
|
|
53
|
+
|
|
54
|
+
# Set the agent phase to BOOTSTRAPPING and wait for any associated hooks.
|
|
55
|
+
await phase_manager.notify_bootstrapping_started()
|
|
56
|
+
logger.info(f"Agent '{agent_id}': AgentBootstrapper starting execution. Phase set to BOOTSTRAPPING.")
|
|
57
|
+
|
|
58
|
+
for step_index, step_instance in enumerate(self.bootstrap_steps):
|
|
59
|
+
step_name = step_instance.__class__.__name__
|
|
60
|
+
logger.debug(f"Agent '{agent_id}': Executing bootstrap step {step_index + 1}/{len(self.bootstrap_steps)}: {step_name}")
|
|
61
|
+
|
|
62
|
+
success = await step_instance.execute(context, phase_manager)
|
|
63
|
+
|
|
64
|
+
if not success:
|
|
65
|
+
error_message = f"Bootstrap step {step_name} failed."
|
|
66
|
+
logger.error(f"Agent '{agent_id}': {error_message} Halting bootstrap process.")
|
|
67
|
+
# The step itself is responsible for detailed error logging.
|
|
68
|
+
# We are responsible for notifying the phase manager to set the agent to an error state.
|
|
69
|
+
await phase_manager.notify_error_occurred(
|
|
70
|
+
error_message=f"Critical bootstrap failure at {step_name}",
|
|
71
|
+
error_details=f"Agent '{agent_id}' failed during bootstrap step '{step_name}'. Check logs for details."
|
|
72
|
+
)
|
|
73
|
+
return False
|
|
74
|
+
|
|
75
|
+
logger.info(f"Agent '{agent_id}': All bootstrap steps completed successfully. Enqueuing AgentReadyEvent.")
|
|
76
|
+
# After successful bootstrapping, enqueue the ready event.
|
|
77
|
+
if context.state.input_event_queues:
|
|
78
|
+
await context.state.input_event_queues.enqueue_internal_system_event(AgentReadyEvent())
|
|
79
|
+
else: # pragma: no cover
|
|
80
|
+
# Should not happen if AgentRuntimeQueueInitializationStep is present and successful
|
|
81
|
+
logger.critical(f"Agent '{agent_id}': Bootstrap succeeded but input queues are not available to enqueue AgentReadyEvent.")
|
|
82
|
+
await phase_manager.notify_error_occurred(
|
|
83
|
+
error_message="Input queues unavailable after bootstrap",
|
|
84
|
+
error_details=f"Agent '{agent_id}' bootstrap process seemed to succeed, but input event queues are missing."
|
|
85
|
+
)
|
|
86
|
+
return False
|
|
87
|
+
|
|
88
|
+
return True
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/agent/bootstrap_steps/agent_runtime_queue_initialization_step.py
|
|
2
|
+
import logging
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from .base_bootstrap_step import BaseBootstrapStep
|
|
6
|
+
from autobyteus.agent.events import AgentErrorEvent, AgentInputEventQueueManager
|
|
7
|
+
# AgentOutputDataManager is no longer initialized here.
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from autobyteus.agent.context import AgentContext
|
|
11
|
+
from autobyteus.agent.context.agent_phase_manager import AgentPhaseManager
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
class AgentRuntimeQueueInitializationStep(BaseBootstrapStep):
|
|
16
|
+
"""
|
|
17
|
+
Bootstrap step for initializing the agent's runtime INPUT event queues.
|
|
18
|
+
These queues are created within the AgentWorker's event loop.
|
|
19
|
+
Output data is now handled by emitting events via AgentExternalEventNotifier.
|
|
20
|
+
"""
|
|
21
|
+
def __init__(self, input_queue_size: int = 0): # Removed output_queue_size
|
|
22
|
+
self.input_queue_size = input_queue_size
|
|
23
|
+
logger.debug(f"AgentRuntimeQueueInitializationStep initialized with input_q_size={input_queue_size}.")
|
|
24
|
+
|
|
25
|
+
async def execute(self,
|
|
26
|
+
context: 'AgentContext',
|
|
27
|
+
phase_manager: 'AgentPhaseManager') -> bool:
|
|
28
|
+
agent_id = context.agent_id
|
|
29
|
+
logger.info(f"Agent '{agent_id}': Executing AgentRuntimeQueueInitializationStep (for input queues).")
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
if context.state.input_event_queues is not None: # Check only input queues
|
|
33
|
+
logger.warning(f"Agent '{agent_id}': Input runtime queues seem to be already initialized. Overwriting. This might indicate a logic error.")
|
|
34
|
+
|
|
35
|
+
input_queues = AgentInputEventQueueManager(queue_size=self.input_queue_size)
|
|
36
|
+
context.state.input_event_queues = input_queues
|
|
37
|
+
# context.state.output_data_queues is no longer set here.
|
|
38
|
+
|
|
39
|
+
logger.info(f"Agent '{agent_id}': AgentInputEventQueueManager initialized and set in agent state.")
|
|
40
|
+
if context.state.input_event_queues is None: # pragma: no cover
|
|
41
|
+
raise RuntimeError("Input event queue manager was not successfully set in agent state during AgentRuntimeQueueInitializationStep.")
|
|
42
|
+
|
|
43
|
+
return True
|
|
44
|
+
except Exception as e:
|
|
45
|
+
error_message = f"Agent '{agent_id}': Critical failure during AgentRuntimeQueueInitializationStep (input queues): {e}"
|
|
46
|
+
logger.error(error_message, exc_info=True)
|
|
47
|
+
|
|
48
|
+
# Attempt to enqueue an error event if input_event_queues was partially created
|
|
49
|
+
# This check itself might be problematic if input_queues is the thing that failed.
|
|
50
|
+
# However, if it failed *after* assigning self.input_event_queues, this might work.
|
|
51
|
+
if context.state.input_event_queues and context.state.input_event_queues.internal_system_event_queue: # pragma: no cover
|
|
52
|
+
await context.state.input_event_queues.enqueue_internal_system_event(
|
|
53
|
+
AgentErrorEvent(error_message=error_message, exception_details=str(e))
|
|
54
|
+
)
|
|
55
|
+
else: # pragma: no cover
|
|
56
|
+
logger.error(f"Agent '{agent_id}': Cannot enqueue AgentErrorEvent as input_event_queues are not available after AgentRuntimeQueueInitializationStep failure.")
|
|
57
|
+
return False
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/agent/bootstrap_steps/base_bootstrap_step.py
|
|
2
|
+
import logging
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from autobyteus.agent.context import AgentContext
|
|
8
|
+
from autobyteus.agent.context.agent_phase_manager import AgentPhaseManager
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
class BaseBootstrapStep(ABC):
|
|
13
|
+
"""
|
|
14
|
+
Abstract base class for individual steps in the agent bootstrapping process.
|
|
15
|
+
Each step is responsible for a specific part of the initialization and
|
|
16
|
+
for reporting its success or failure.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
async def execute(self,
|
|
21
|
+
context: 'AgentContext',
|
|
22
|
+
phase_manager: 'AgentPhaseManager') -> bool:
|
|
23
|
+
"""
|
|
24
|
+
Executes the bootstrap step.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
context: The agent's context, providing access to configuration and state.
|
|
28
|
+
phase_manager: The agent's phase manager for notifying phase transitions.
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
True if the step completed successfully, False otherwise.
|
|
32
|
+
If False, the step is expected to have handled logging and enqueuing
|
|
33
|
+
an AgentErrorEvent.
|
|
34
|
+
"""
|
|
35
|
+
raise NotImplementedError("Subclasses must implement the 'execute' method.")
|
|
36
|
+
|
|
37
|
+
def __repr__(self) -> str:
|
|
38
|
+
return f"<{self.__class__.__name__}>"
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/agent/bootstrap_steps/system_prompt_processing_step.py
|
|
2
|
+
import logging
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from .base_bootstrap_step import BaseBootstrapStep
|
|
6
|
+
from autobyteus.agent.events import AgentErrorEvent
|
|
7
|
+
from autobyteus.agent.system_prompt_processor.base_processor import BaseSystemPromptProcessor
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from autobyteus.agent.context import AgentContext
|
|
11
|
+
from autobyteus.agent.context.agent_phase_manager import AgentPhaseManager
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
class SystemPromptProcessingStep(BaseBootstrapStep):
|
|
16
|
+
"""
|
|
17
|
+
Bootstrap step for processing the agent's system prompt and setting it
|
|
18
|
+
on the pre-initialized LLM instance.
|
|
19
|
+
If any configured processor fails, this entire step is considered failed.
|
|
20
|
+
"""
|
|
21
|
+
def __init__(self):
|
|
22
|
+
logger.debug("SystemPromptProcessingStep initialized.")
|
|
23
|
+
|
|
24
|
+
async def execute(self,
|
|
25
|
+
context: 'AgentContext',
|
|
26
|
+
phase_manager: 'AgentPhaseManager') -> bool:
|
|
27
|
+
agent_id = context.agent_id
|
|
28
|
+
# The phase is now managed by the AgentBootstrapper.
|
|
29
|
+
logger.info(f"Agent '{agent_id}': Executing SystemPromptProcessingStep.")
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
# The LLM instance is now expected to be present from the start.
|
|
33
|
+
llm_instance = context.llm_instance
|
|
34
|
+
if not llm_instance:
|
|
35
|
+
raise ValueError("LLM instance not found in agent state. It must be provided in AgentConfig.")
|
|
36
|
+
|
|
37
|
+
current_system_prompt = context.config.system_prompt
|
|
38
|
+
logger.debug(f"Agent '{agent_id}': Retrieved base system prompt from agent config.")
|
|
39
|
+
|
|
40
|
+
processor_instances = context.config.system_prompt_processors
|
|
41
|
+
tool_instances_for_processor = context.tool_instances
|
|
42
|
+
|
|
43
|
+
if not processor_instances:
|
|
44
|
+
logger.debug(f"Agent '{agent_id}': No system prompt processors configured. Using system prompt as is.")
|
|
45
|
+
else:
|
|
46
|
+
logger.debug(f"Agent '{agent_id}': Found {len(processor_instances)} configured system prompt processors. Applying sequentially.")
|
|
47
|
+
for processor_instance in processor_instances:
|
|
48
|
+
if not isinstance(processor_instance, BaseSystemPromptProcessor):
|
|
49
|
+
error_message = f"Agent '{agent_id}': Invalid system prompt processor configuration type: {type(processor_instance)}. Expected BaseSystemPromptProcessor."
|
|
50
|
+
logger.error(error_message)
|
|
51
|
+
raise TypeError(error_message)
|
|
52
|
+
|
|
53
|
+
processor_name = processor_instance.get_name()
|
|
54
|
+
try:
|
|
55
|
+
logger.debug(f"Agent '{agent_id}': Applying system prompt processor '{processor_name}'.")
|
|
56
|
+
current_system_prompt = processor_instance.process(
|
|
57
|
+
system_prompt=current_system_prompt,
|
|
58
|
+
tool_instances=tool_instances_for_processor,
|
|
59
|
+
agent_id=agent_id,
|
|
60
|
+
context=context
|
|
61
|
+
)
|
|
62
|
+
logger.info(f"Agent '{agent_id}': System prompt processor '{processor_name}' applied successfully.")
|
|
63
|
+
except Exception as e_proc:
|
|
64
|
+
error_message = f"Agent '{agent_id}': Error applying system prompt processor '{processor_name}': {e_proc}"
|
|
65
|
+
logger.error(error_message, exc_info=True)
|
|
66
|
+
if context.state.input_event_queues:
|
|
67
|
+
await context.state.input_event_queues.enqueue_internal_system_event(
|
|
68
|
+
AgentErrorEvent(error_message=error_message, exception_details=str(e_proc))
|
|
69
|
+
)
|
|
70
|
+
return False # Signal failure of the entire step
|
|
71
|
+
|
|
72
|
+
context.state.processed_system_prompt = current_system_prompt
|
|
73
|
+
|
|
74
|
+
# --- New Logic: Set the prompt on the existing LLM instance ---
|
|
75
|
+
if hasattr(llm_instance, 'configure_system_prompt') and callable(getattr(llm_instance, 'configure_system_prompt')):
|
|
76
|
+
llm_instance.configure_system_prompt(current_system_prompt)
|
|
77
|
+
logger.info(f"Agent '{agent_id}': Final processed system prompt configured on LLM instance. Final length: {len(current_system_prompt)}.")
|
|
78
|
+
else:
|
|
79
|
+
# This path should ideally not be taken if all LLMs inherit from the updated BaseLLM.
|
|
80
|
+
# It's kept as a fallback with a strong warning.
|
|
81
|
+
logger.warning(f"Agent '{agent_id}': LLM instance ({llm_instance.__class__.__name__}) does not have a 'configure_system_prompt' method. "
|
|
82
|
+
f"The system prompt cannot be dynamically updated on the LLM instance after initialization. This may lead to incorrect agent behavior.")
|
|
83
|
+
|
|
84
|
+
logger.info(f"Agent '{agent_id}': Final processed system prompt:\n---\n{current_system_prompt}\n---")
|
|
85
|
+
return True
|
|
86
|
+
except Exception as e: # Catches other errors in the step setup itself
|
|
87
|
+
error_message = f"Agent '{agent_id}': Critical failure during system prompt processing step: {e}"
|
|
88
|
+
logger.error(error_message, exc_info=True)
|
|
89
|
+
if context.state.input_event_queues:
|
|
90
|
+
await context.input_event_queues.enqueue_internal_system_event(
|
|
91
|
+
AgentErrorEvent(error_message=error_message, exception_details=str(e))
|
|
92
|
+
)
|
|
93
|
+
return False
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/agent/bootstrap_steps/workspace_context_initialization_step.py
|
|
2
|
+
import logging
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from .base_bootstrap_step import BaseBootstrapStep
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from autobyteus.agent.context import AgentContext
|
|
9
|
+
from autobyteus.agent.context.agent_phase_manager import AgentPhaseManager
|
|
10
|
+
|
|
11
|
+
logger = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
class WorkspaceContextInitializationStep(BaseBootstrapStep):
|
|
14
|
+
"""
|
|
15
|
+
Bootstrap step for injecting the AgentContext into the agent's workspace instance.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self):
|
|
19
|
+
logger.debug("WorkspaceContextInitializationStep initialized.")
|
|
20
|
+
|
|
21
|
+
async def execute(self,
|
|
22
|
+
context: 'AgentContext',
|
|
23
|
+
phase_manager: 'AgentPhaseManager') -> bool:
|
|
24
|
+
agent_id = context.agent_id
|
|
25
|
+
logger.info(f"Agent '{agent_id}': Executing WorkspaceContextInitializationStep.")
|
|
26
|
+
|
|
27
|
+
workspace = context.workspace
|
|
28
|
+
|
|
29
|
+
if not workspace:
|
|
30
|
+
logger.debug(f"Agent '{agent_id}': No workspace configured. Skipping context injection.")
|
|
31
|
+
return True
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
if hasattr(workspace, 'set_context') and callable(getattr(workspace, 'set_context')):
|
|
35
|
+
workspace.set_context(context)
|
|
36
|
+
logger.info(f"Agent '{agent_id}': AgentContext successfully injected into workspace instance of type '{type(workspace).__name__}'.")
|
|
37
|
+
else:
|
|
38
|
+
logger.warning(f"Agent '{agent_id}': Configured workspace of type '{type(workspace).__name__}' does not have a 'set_context' method. "
|
|
39
|
+
"Workspace will not have access to the agent's context.")
|
|
40
|
+
|
|
41
|
+
return True
|
|
42
|
+
except Exception as e:
|
|
43
|
+
error_message = f"Agent '{agent_id}': Critical failure during WorkspaceContextInitializationStep: {e}"
|
|
44
|
+
logger.error(error_message, exc_info=True)
|
|
45
|
+
# No easy way to enqueue an error event here if queues aren't even initialized yet.
|
|
46
|
+
# The failure of a bootstrap step is handled by the bootstrapper, which will log and set error phase.
|
|
47
|
+
return False
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# file: autobyteus/autobyteus/agent/context/__init__.py
|
|
2
|
+
"""
|
|
3
|
+
Components related to the agent's runtime context, state, config, and status management.
|
|
4
|
+
"""
|
|
5
|
+
from .agent_config import AgentConfig
|
|
6
|
+
from .agent_runtime_state import AgentRuntimeState
|
|
7
|
+
from .agent_context import AgentContext
|
|
8
|
+
from .agent_phase_manager import AgentPhaseManager
|
|
9
|
+
from .phases import AgentOperationalPhase
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"AgentContext",
|
|
14
|
+
"AgentConfig",
|
|
15
|
+
"AgentRuntimeState",
|
|
16
|
+
"AgentPhaseManager",
|
|
17
|
+
"AgentOperationalPhase",
|
|
18
|
+
]
|