autobyteus 1.1.3__py3-none-any.whl → 1.1.5__py3-none-any.whl

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.
Files changed (284) hide show
  1. autobyteus/agent/agent.py +1 -1
  2. autobyteus/agent/bootstrap_steps/system_prompt_processing_step.py +4 -2
  3. autobyteus/agent/context/__init__.py +4 -2
  4. autobyteus/agent/context/agent_config.py +35 -8
  5. autobyteus/agent/context/agent_context_registry.py +73 -0
  6. autobyteus/agent/events/notifiers.py +4 -0
  7. autobyteus/agent/events/worker_event_dispatcher.py +1 -2
  8. autobyteus/agent/handlers/inter_agent_message_event_handler.py +8 -3
  9. autobyteus/agent/handlers/llm_complete_response_received_event_handler.py +19 -19
  10. autobyteus/agent/handlers/llm_user_message_ready_event_handler.py +2 -2
  11. autobyteus/agent/handlers/tool_result_event_handler.py +48 -20
  12. autobyteus/agent/handlers/user_input_message_event_handler.py +16 -1
  13. autobyteus/agent/input_processor/__init__.py +1 -7
  14. autobyteus/agent/message/context_file_type.py +6 -0
  15. autobyteus/agent/message/send_message_to.py +74 -99
  16. autobyteus/agent/phases/discover.py +2 -1
  17. autobyteus/agent/runtime/agent_runtime.py +10 -2
  18. autobyteus/agent/runtime/agent_worker.py +1 -0
  19. autobyteus/agent/sender_type.py +15 -0
  20. autobyteus/agent/streaming/agent_event_stream.py +6 -0
  21. autobyteus/agent/streaming/stream_event_payloads.py +12 -0
  22. autobyteus/agent/streaming/stream_events.py +3 -0
  23. autobyteus/agent/system_prompt_processor/tool_manifest_injector_processor.py +7 -4
  24. autobyteus/agent/tool_execution_result_processor/__init__.py +9 -0
  25. autobyteus/agent/tool_execution_result_processor/base_processor.py +46 -0
  26. autobyteus/agent/tool_execution_result_processor/processor_definition.py +36 -0
  27. autobyteus/agent/tool_execution_result_processor/processor_meta.py +36 -0
  28. autobyteus/agent/tool_execution_result_processor/processor_registry.py +70 -0
  29. autobyteus/agent/workspace/base_workspace.py +17 -2
  30. autobyteus/agent_team/__init__.py +1 -0
  31. autobyteus/agent_team/agent_team.py +93 -0
  32. autobyteus/agent_team/agent_team_builder.py +184 -0
  33. autobyteus/agent_team/base_agent_team.py +86 -0
  34. autobyteus/agent_team/bootstrap_steps/__init__.py +24 -0
  35. autobyteus/agent_team/bootstrap_steps/agent_configuration_preparation_step.py +73 -0
  36. autobyteus/agent_team/bootstrap_steps/agent_team_bootstrapper.py +54 -0
  37. autobyteus/agent_team/bootstrap_steps/agent_team_runtime_queue_initialization_step.py +25 -0
  38. autobyteus/agent_team/bootstrap_steps/base_agent_team_bootstrap_step.py +23 -0
  39. autobyteus/agent_team/bootstrap_steps/coordinator_initialization_step.py +41 -0
  40. autobyteus/agent_team/bootstrap_steps/coordinator_prompt_preparation_step.py +85 -0
  41. autobyteus/agent_team/bootstrap_steps/task_notifier_initialization_step.py +51 -0
  42. autobyteus/agent_team/bootstrap_steps/team_context_initialization_step.py +45 -0
  43. autobyteus/agent_team/context/__init__.py +17 -0
  44. autobyteus/agent_team/context/agent_team_config.py +33 -0
  45. autobyteus/agent_team/context/agent_team_context.py +61 -0
  46. autobyteus/agent_team/context/agent_team_runtime_state.py +56 -0
  47. autobyteus/agent_team/context/team_manager.py +147 -0
  48. autobyteus/agent_team/context/team_node_config.py +76 -0
  49. autobyteus/agent_team/events/__init__.py +29 -0
  50. autobyteus/agent_team/events/agent_team_event_dispatcher.py +39 -0
  51. autobyteus/agent_team/events/agent_team_events.py +53 -0
  52. autobyteus/agent_team/events/agent_team_input_event_queue_manager.py +21 -0
  53. autobyteus/agent_team/exceptions.py +8 -0
  54. autobyteus/agent_team/factory/__init__.py +9 -0
  55. autobyteus/agent_team/factory/agent_team_factory.py +99 -0
  56. autobyteus/agent_team/handlers/__init__.py +19 -0
  57. autobyteus/agent_team/handlers/agent_team_event_handler_registry.py +23 -0
  58. autobyteus/agent_team/handlers/base_agent_team_event_handler.py +16 -0
  59. autobyteus/agent_team/handlers/inter_agent_message_request_event_handler.py +61 -0
  60. autobyteus/agent_team/handlers/lifecycle_agent_team_event_handler.py +27 -0
  61. autobyteus/agent_team/handlers/process_user_message_event_handler.py +46 -0
  62. autobyteus/agent_team/handlers/tool_approval_team_event_handler.py +48 -0
  63. autobyteus/agent_team/phases/__init__.py +11 -0
  64. autobyteus/agent_team/phases/agent_team_operational_phase.py +19 -0
  65. autobyteus/agent_team/phases/agent_team_phase_manager.py +48 -0
  66. autobyteus/agent_team/runtime/__init__.py +13 -0
  67. autobyteus/agent_team/runtime/agent_team_runtime.py +82 -0
  68. autobyteus/agent_team/runtime/agent_team_worker.py +117 -0
  69. autobyteus/agent_team/shutdown_steps/__init__.py +17 -0
  70. autobyteus/agent_team/shutdown_steps/agent_team_shutdown_orchestrator.py +35 -0
  71. autobyteus/agent_team/shutdown_steps/agent_team_shutdown_step.py +42 -0
  72. autobyteus/agent_team/shutdown_steps/base_agent_team_shutdown_step.py +16 -0
  73. autobyteus/agent_team/shutdown_steps/bridge_cleanup_step.py +28 -0
  74. autobyteus/agent_team/shutdown_steps/sub_team_shutdown_step.py +41 -0
  75. autobyteus/agent_team/streaming/__init__.py +26 -0
  76. autobyteus/agent_team/streaming/agent_event_bridge.py +48 -0
  77. autobyteus/agent_team/streaming/agent_event_multiplexer.py +70 -0
  78. autobyteus/agent_team/streaming/agent_team_event_notifier.py +64 -0
  79. autobyteus/agent_team/streaming/agent_team_event_stream.py +33 -0
  80. autobyteus/agent_team/streaming/agent_team_stream_event_payloads.py +32 -0
  81. autobyteus/agent_team/streaming/agent_team_stream_events.py +56 -0
  82. autobyteus/agent_team/streaming/team_event_bridge.py +50 -0
  83. autobyteus/agent_team/task_notification/__init__.py +11 -0
  84. autobyteus/agent_team/task_notification/system_event_driven_agent_task_notifier.py +164 -0
  85. autobyteus/agent_team/task_notification/task_notification_mode.py +24 -0
  86. autobyteus/agent_team/utils/__init__.py +9 -0
  87. autobyteus/agent_team/utils/wait_for_idle.py +46 -0
  88. autobyteus/cli/__init__.py +1 -1
  89. autobyteus/cli/agent_team_tui/__init__.py +4 -0
  90. autobyteus/cli/agent_team_tui/app.py +210 -0
  91. autobyteus/cli/agent_team_tui/state.py +180 -0
  92. autobyteus/cli/agent_team_tui/widgets/__init__.py +6 -0
  93. autobyteus/cli/agent_team_tui/widgets/agent_list_sidebar.py +149 -0
  94. autobyteus/cli/agent_team_tui/widgets/focus_pane.py +320 -0
  95. autobyteus/cli/agent_team_tui/widgets/logo.py +20 -0
  96. autobyteus/cli/agent_team_tui/widgets/renderables.py +77 -0
  97. autobyteus/cli/agent_team_tui/widgets/shared.py +60 -0
  98. autobyteus/cli/agent_team_tui/widgets/status_bar.py +14 -0
  99. autobyteus/cli/agent_team_tui/widgets/task_board_panel.py +82 -0
  100. autobyteus/cli/cli_display.py +1 -1
  101. autobyteus/cli/workflow_tui/__init__.py +4 -0
  102. autobyteus/cli/workflow_tui/app.py +210 -0
  103. autobyteus/cli/workflow_tui/state.py +189 -0
  104. autobyteus/cli/workflow_tui/widgets/__init__.py +6 -0
  105. autobyteus/cli/workflow_tui/widgets/agent_list_sidebar.py +149 -0
  106. autobyteus/cli/workflow_tui/widgets/focus_pane.py +335 -0
  107. autobyteus/cli/workflow_tui/widgets/logo.py +27 -0
  108. autobyteus/cli/workflow_tui/widgets/renderables.py +70 -0
  109. autobyteus/cli/workflow_tui/widgets/shared.py +51 -0
  110. autobyteus/cli/workflow_tui/widgets/status_bar.py +14 -0
  111. autobyteus/events/event_types.py +8 -0
  112. autobyteus/llm/api/autobyteus_llm.py +11 -12
  113. autobyteus/llm/api/lmstudio_llm.py +34 -0
  114. autobyteus/llm/api/ollama_llm.py +8 -13
  115. autobyteus/llm/api/openai_compatible_llm.py +20 -3
  116. autobyteus/llm/autobyteus_provider.py +73 -46
  117. autobyteus/llm/llm_factory.py +103 -139
  118. autobyteus/llm/lmstudio_provider.py +104 -0
  119. autobyteus/llm/models.py +83 -53
  120. autobyteus/llm/ollama_provider.py +69 -61
  121. autobyteus/llm/ollama_provider_resolver.py +1 -0
  122. autobyteus/llm/providers.py +13 -12
  123. autobyteus/llm/runtimes.py +11 -0
  124. autobyteus/llm/token_counter/token_counter_factory.py +2 -0
  125. autobyteus/task_management/__init__.py +43 -0
  126. autobyteus/task_management/base_task_board.py +68 -0
  127. autobyteus/task_management/converters/__init__.py +11 -0
  128. autobyteus/task_management/converters/task_board_converter.py +64 -0
  129. autobyteus/task_management/converters/task_plan_converter.py +48 -0
  130. autobyteus/task_management/deliverable.py +16 -0
  131. autobyteus/task_management/deliverables/__init__.py +8 -0
  132. autobyteus/task_management/deliverables/file_deliverable.py +15 -0
  133. autobyteus/task_management/events.py +27 -0
  134. autobyteus/task_management/in_memory_task_board.py +126 -0
  135. autobyteus/task_management/schemas/__init__.py +15 -0
  136. autobyteus/task_management/schemas/deliverable_schema.py +13 -0
  137. autobyteus/task_management/schemas/plan_definition.py +35 -0
  138. autobyteus/task_management/schemas/task_status_report.py +27 -0
  139. autobyteus/task_management/task_plan.py +110 -0
  140. autobyteus/task_management/tools/__init__.py +14 -0
  141. autobyteus/task_management/tools/get_task_board_status.py +68 -0
  142. autobyteus/task_management/tools/publish_task_plan.py +113 -0
  143. autobyteus/task_management/tools/update_task_status.py +135 -0
  144. autobyteus/tools/__init__.py +2 -0
  145. autobyteus/tools/ask_user_input.py +2 -1
  146. autobyteus/tools/bash/bash_executor.py +61 -15
  147. autobyteus/tools/browser/session_aware/browser_session_aware_navigate_to.py +2 -0
  148. autobyteus/tools/browser/session_aware/browser_session_aware_web_element_trigger.py +3 -0
  149. autobyteus/tools/browser/session_aware/browser_session_aware_webpage_reader.py +3 -0
  150. autobyteus/tools/browser/session_aware/browser_session_aware_webpage_screenshot_taker.py +3 -0
  151. autobyteus/tools/browser/standalone/google_search_ui.py +2 -0
  152. autobyteus/tools/browser/standalone/navigate_to.py +2 -0
  153. autobyteus/tools/browser/standalone/web_page_pdf_generator.py +3 -0
  154. autobyteus/tools/browser/standalone/webpage_image_downloader.py +3 -0
  155. autobyteus/tools/browser/standalone/webpage_reader.py +2 -0
  156. autobyteus/tools/browser/standalone/webpage_screenshot_taker.py +3 -0
  157. autobyteus/tools/file/file_reader.py +36 -9
  158. autobyteus/tools/file/file_writer.py +37 -9
  159. autobyteus/tools/functional_tool.py +5 -4
  160. autobyteus/tools/image_downloader.py +2 -0
  161. autobyteus/tools/mcp/config_service.py +63 -58
  162. autobyteus/tools/mcp/server/http_managed_mcp_server.py +14 -2
  163. autobyteus/tools/mcp/server/stdio_managed_mcp_server.py +14 -2
  164. autobyteus/tools/mcp/server_instance_manager.py +30 -4
  165. autobyteus/tools/mcp/tool_registrar.py +106 -51
  166. autobyteus/tools/parameter_schema.py +17 -11
  167. autobyteus/tools/pdf_downloader.py +2 -1
  168. autobyteus/tools/registry/tool_definition.py +36 -37
  169. autobyteus/tools/registry/tool_registry.py +50 -2
  170. autobyteus/tools/timer.py +2 -0
  171. autobyteus/tools/tool_category.py +15 -4
  172. autobyteus/tools/tool_meta.py +6 -1
  173. autobyteus/tools/tool_origin.py +10 -0
  174. autobyteus/tools/usage/formatters/default_json_example_formatter.py +78 -3
  175. autobyteus/tools/usage/formatters/default_xml_example_formatter.py +23 -3
  176. autobyteus/tools/usage/formatters/gemini_json_example_formatter.py +6 -0
  177. autobyteus/tools/usage/formatters/google_json_example_formatter.py +7 -0
  178. autobyteus/tools/usage/formatters/openai_json_example_formatter.py +6 -4
  179. autobyteus/tools/usage/parsers/gemini_json_tool_usage_parser.py +23 -7
  180. autobyteus/tools/usage/parsers/provider_aware_tool_usage_parser.py +14 -25
  181. autobyteus/tools/usage/providers/__init__.py +2 -12
  182. autobyteus/tools/usage/providers/tool_manifest_provider.py +36 -29
  183. autobyteus/tools/usage/registries/__init__.py +7 -12
  184. autobyteus/tools/usage/registries/tool_formatter_pair.py +15 -0
  185. autobyteus/tools/usage/registries/tool_formatting_registry.py +58 -0
  186. autobyteus/tools/usage/registries/tool_usage_parser_registry.py +55 -0
  187. autobyteus/workflow/agentic_workflow.py +93 -0
  188. autobyteus/{agent/workflow → workflow}/base_agentic_workflow.py +19 -27
  189. autobyteus/workflow/bootstrap_steps/__init__.py +20 -0
  190. autobyteus/workflow/bootstrap_steps/agent_tool_injection_step.py +34 -0
  191. autobyteus/workflow/bootstrap_steps/base_workflow_bootstrap_step.py +23 -0
  192. autobyteus/workflow/bootstrap_steps/coordinator_initialization_step.py +41 -0
  193. autobyteus/workflow/bootstrap_steps/coordinator_prompt_preparation_step.py +108 -0
  194. autobyteus/workflow/bootstrap_steps/workflow_bootstrapper.py +50 -0
  195. autobyteus/workflow/bootstrap_steps/workflow_runtime_queue_initialization_step.py +25 -0
  196. autobyteus/workflow/context/__init__.py +17 -0
  197. autobyteus/workflow/context/team_manager.py +147 -0
  198. autobyteus/workflow/context/workflow_config.py +30 -0
  199. autobyteus/workflow/context/workflow_context.py +61 -0
  200. autobyteus/workflow/context/workflow_node_config.py +76 -0
  201. autobyteus/workflow/context/workflow_runtime_state.py +53 -0
  202. autobyteus/workflow/events/__init__.py +29 -0
  203. autobyteus/workflow/events/workflow_event_dispatcher.py +39 -0
  204. autobyteus/workflow/events/workflow_events.py +53 -0
  205. autobyteus/workflow/events/workflow_input_event_queue_manager.py +21 -0
  206. autobyteus/workflow/exceptions.py +8 -0
  207. autobyteus/workflow/factory/__init__.py +9 -0
  208. autobyteus/workflow/factory/workflow_factory.py +99 -0
  209. autobyteus/workflow/handlers/__init__.py +19 -0
  210. autobyteus/workflow/handlers/base_workflow_event_handler.py +16 -0
  211. autobyteus/workflow/handlers/inter_agent_message_request_event_handler.py +61 -0
  212. autobyteus/workflow/handlers/lifecycle_workflow_event_handler.py +27 -0
  213. autobyteus/workflow/handlers/process_user_message_event_handler.py +46 -0
  214. autobyteus/workflow/handlers/tool_approval_workflow_event_handler.py +39 -0
  215. autobyteus/workflow/handlers/workflow_event_handler_registry.py +23 -0
  216. autobyteus/workflow/phases/__init__.py +11 -0
  217. autobyteus/workflow/phases/workflow_operational_phase.py +19 -0
  218. autobyteus/workflow/phases/workflow_phase_manager.py +48 -0
  219. autobyteus/workflow/runtime/__init__.py +13 -0
  220. autobyteus/workflow/runtime/workflow_runtime.py +82 -0
  221. autobyteus/workflow/runtime/workflow_worker.py +117 -0
  222. autobyteus/workflow/shutdown_steps/__init__.py +17 -0
  223. autobyteus/workflow/shutdown_steps/agent_team_shutdown_step.py +42 -0
  224. autobyteus/workflow/shutdown_steps/base_workflow_shutdown_step.py +16 -0
  225. autobyteus/workflow/shutdown_steps/bridge_cleanup_step.py +28 -0
  226. autobyteus/workflow/shutdown_steps/sub_workflow_shutdown_step.py +41 -0
  227. autobyteus/workflow/shutdown_steps/workflow_shutdown_orchestrator.py +35 -0
  228. autobyteus/workflow/streaming/__init__.py +26 -0
  229. autobyteus/workflow/streaming/agent_event_bridge.py +48 -0
  230. autobyteus/workflow/streaming/agent_event_multiplexer.py +70 -0
  231. autobyteus/workflow/streaming/workflow_event_bridge.py +50 -0
  232. autobyteus/workflow/streaming/workflow_event_notifier.py +83 -0
  233. autobyteus/workflow/streaming/workflow_event_stream.py +33 -0
  234. autobyteus/workflow/streaming/workflow_stream_event_payloads.py +28 -0
  235. autobyteus/workflow/streaming/workflow_stream_events.py +45 -0
  236. autobyteus/workflow/utils/__init__.py +9 -0
  237. autobyteus/workflow/utils/wait_for_idle.py +46 -0
  238. autobyteus/workflow/workflow_builder.py +151 -0
  239. {autobyteus-1.1.3.dist-info → autobyteus-1.1.5.dist-info}/METADATA +16 -14
  240. autobyteus-1.1.5.dist-info/RECORD +455 -0
  241. {autobyteus-1.1.3.dist-info → autobyteus-1.1.5.dist-info}/top_level.txt +1 -0
  242. examples/__init__.py +1 -0
  243. examples/agent_team/__init__.py +1 -0
  244. examples/discover_phase_transitions.py +104 -0
  245. examples/run_browser_agent.py +262 -0
  246. examples/run_google_slides_agent.py +287 -0
  247. examples/run_mcp_browser_client.py +174 -0
  248. examples/run_mcp_google_slides_client.py +270 -0
  249. examples/run_mcp_list_tools.py +189 -0
  250. examples/run_poem_writer.py +284 -0
  251. examples/run_sqlite_agent.py +295 -0
  252. autobyteus/agent/context/agent_phase_manager.py +0 -264
  253. autobyteus/agent/context/phases.py +0 -49
  254. autobyteus/agent/group/__init__.py +0 -0
  255. autobyteus/agent/group/agent_group.py +0 -164
  256. autobyteus/agent/group/agent_group_context.py +0 -81
  257. autobyteus/agent/input_processor/content_prefixing_input_processor.py +0 -41
  258. autobyteus/agent/input_processor/metadata_appending_input_processor.py +0 -34
  259. autobyteus/agent/input_processor/passthrough_input_processor.py +0 -33
  260. autobyteus/agent/workflow/__init__.py +0 -11
  261. autobyteus/agent/workflow/agentic_workflow.py +0 -89
  262. autobyteus/tools/mcp/call_handlers/__init__.py +0 -16
  263. autobyteus/tools/mcp/call_handlers/base_handler.py +0 -40
  264. autobyteus/tools/mcp/call_handlers/stdio_handler.py +0 -76
  265. autobyteus/tools/mcp/call_handlers/streamable_http_handler.py +0 -55
  266. autobyteus/tools/mcp/registrar.py +0 -202
  267. autobyteus/tools/usage/providers/json_example_provider.py +0 -32
  268. autobyteus/tools/usage/providers/json_schema_provider.py +0 -35
  269. autobyteus/tools/usage/providers/json_tool_usage_parser_provider.py +0 -28
  270. autobyteus/tools/usage/providers/xml_example_provider.py +0 -28
  271. autobyteus/tools/usage/providers/xml_schema_provider.py +0 -29
  272. autobyteus/tools/usage/providers/xml_tool_usage_parser_provider.py +0 -26
  273. autobyteus/tools/usage/registries/json_example_formatter_registry.py +0 -51
  274. autobyteus/tools/usage/registries/json_schema_formatter_registry.py +0 -51
  275. autobyteus/tools/usage/registries/json_tool_usage_parser_registry.py +0 -42
  276. autobyteus/tools/usage/registries/xml_example_formatter_registry.py +0 -30
  277. autobyteus/tools/usage/registries/xml_schema_formatter_registry.py +0 -33
  278. autobyteus/tools/usage/registries/xml_tool_usage_parser_registry.py +0 -30
  279. autobyteus/workflow/simple_task.py +0 -98
  280. autobyteus/workflow/task.py +0 -147
  281. autobyteus/workflow/workflow.py +0 -49
  282. autobyteus-1.1.3.dist-info/RECORD +0 -312
  283. {autobyteus-1.1.3.dist-info → autobyteus-1.1.5.dist-info}/WHEEL +0 -0
  284. {autobyteus-1.1.3.dist-info → autobyteus-1.1.5.dist-info}/licenses/LICENSE +0 -0
@@ -1,29 +0,0 @@
1
- # file: autobyteus/autobyteus/tools/usage/providers/xml_schema_provider.py
2
- from typing import Optional, TYPE_CHECKING
3
-
4
- from autobyteus.llm.providers import LLMProvider
5
- from autobyteus.tools.usage.registries.xml_schema_formatter_registry import XmlSchemaFormatterRegistry
6
-
7
- if TYPE_CHECKING:
8
- from autobyteus.tools.registry import ToolDefinition
9
-
10
- class XmlSchemaProvider:
11
- """
12
- Provides the schema for a single tool formatted as an XML string.
13
- """
14
- def __init__(self):
15
- self._registry = XmlSchemaFormatterRegistry()
16
-
17
- def provide(self, tool_definition: 'ToolDefinition', llm_provider: Optional[LLMProvider] = None) -> str:
18
- """
19
- Generates an XML string for a single tool's schema.
20
-
21
- Args:
22
- tool_definition: A ToolDefinition object.
23
- llm_provider: This argument is passed to the registry for API consistency.
24
-
25
- Returns:
26
- A string containing the XML tool schema.
27
- """
28
- formatter = self._registry.get_formatter(llm_provider)
29
- return formatter.provide(tool_definition)
@@ -1,26 +0,0 @@
1
- # file: autobyteus/autobyteus/tools/usage/providers/xml_tool_usage_parser_provider.py
2
- from typing import Optional, TYPE_CHECKING
3
-
4
- from autobyteus.llm.providers import LLMProvider
5
- from autobyteus.tools.usage.registries.xml_tool_usage_parser_registry import XmlToolUsageParserRegistry
6
-
7
- if TYPE_CHECKING:
8
- from autobyteus.tools.usage.parsers.base_parser import BaseToolUsageParser
9
-
10
- class XmlToolUsageParserProvider:
11
- """Provides a tool usage parser for XML-based responses."""
12
-
13
- def __init__(self):
14
- self._registry = XmlToolUsageParserRegistry()
15
-
16
- def provide(self, llm_provider: Optional[LLMProvider] = None) -> 'BaseToolUsageParser':
17
- """
18
- Gets the appropriate parser from the registry.
19
-
20
- Args:
21
- llm_provider: Ignored, for API consistency.
22
-
23
- Returns:
24
- An instance of a class derived from BaseToolUsageParser.
25
- """
26
- return self._registry.get_parser(llm_provider)
@@ -1,51 +0,0 @@
1
- # file: autobyteus/autobyteus/tools/usage/registries/json_example_formatter_registry.py
2
- import logging
3
- from typing import Dict
4
-
5
- from autobyteus.llm.providers import LLMProvider
6
- from autobyteus.tools.usage.formatters.base_formatter import BaseExampleFormatter
7
- from autobyteus.tools.usage.formatters.default_json_example_formatter import DefaultJsonExampleFormatter
8
- from autobyteus.tools.usage.formatters.openai_json_example_formatter import OpenAiJsonExampleFormatter
9
- from autobyteus.tools.usage.formatters.anthropic_json_example_formatter import AnthropicJsonExampleFormatter
10
- from autobyteus.tools.usage.formatters.gemini_json_example_formatter import GeminiJsonExampleFormatter
11
- from autobyteus.utils.singleton import SingletonMeta
12
-
13
- logger = logging.getLogger(__name__)
14
-
15
- class JsonExampleFormatterRegistry(metaclass=SingletonMeta):
16
- """A singleton registry for retrieving JSON example formatters based on LLM provider."""
17
-
18
- def __init__(self):
19
- self._formatters: Dict[LLMProvider, BaseExampleFormatter] = {
20
- LLMProvider.OPENAI: OpenAiJsonExampleFormatter(),
21
- LLMProvider.MISTRAL: OpenAiJsonExampleFormatter(),
22
- LLMProvider.DEEPSEEK: OpenAiJsonExampleFormatter(),
23
- LLMProvider.GROK: OpenAiJsonExampleFormatter(),
24
- LLMProvider.ANTHROPIC: AnthropicJsonExampleFormatter(),
25
- LLMProvider.GEMINI: GeminiJsonExampleFormatter(),
26
- }
27
- self._default_formatter = DefaultJsonExampleFormatter()
28
- logger.info("JsonExampleFormatterRegistry initialized.")
29
-
30
- def get_formatter(self, provider: LLMProvider) -> BaseExampleFormatter:
31
- """
32
- Retrieves the appropriate example formatter for a given LLM provider.
33
-
34
- Args:
35
- provider: The LLMProvider enum member.
36
-
37
- Returns:
38
- An instance of a class derived from BaseExampleFormatter.
39
- """
40
- formatter = self._formatters.get(provider)
41
- if formatter:
42
- logger.debug(f"Found specific example formatter for provider {provider.name}: {formatter.__class__.__name__}")
43
- return formatter
44
-
45
- logger.debug(f"No specific example formatter for provider {provider.name}. "
46
- f"Returning default: {self._default_formatter.__class__.__name__}")
47
- return self._default_formatter
48
-
49
- def get_default_formatter(self) -> BaseExampleFormatter:
50
- """Explicitly returns the default formatter."""
51
- return self._default_formatter
@@ -1,51 +0,0 @@
1
- # file: autobyteus/autobyteus/tools/usage/registries/json_schema_formatter_registry.py
2
- import logging
3
- from typing import Dict
4
-
5
- from autobyteus.llm.providers import LLMProvider
6
- from autobyteus.tools.usage.formatters.base_formatter import BaseSchemaFormatter
7
- from autobyteus.tools.usage.formatters.default_json_schema_formatter import DefaultJsonSchemaFormatter
8
- from autobyteus.tools.usage.formatters.openai_json_schema_formatter import OpenAiJsonSchemaFormatter
9
- from autobyteus.tools.usage.formatters.anthropic_json_schema_formatter import AnthropicJsonSchemaFormatter
10
- from autobyteus.tools.usage.formatters.gemini_json_schema_formatter import GeminiJsonSchemaFormatter
11
- from autobyteus.utils.singleton import SingletonMeta
12
-
13
- logger = logging.getLogger(__name__)
14
-
15
- class JsonSchemaFormatterRegistry(metaclass=SingletonMeta):
16
- """A singleton registry for retrieving JSON schema formatters based on LLM provider."""
17
-
18
- def __init__(self):
19
- self._formatters: Dict[LLMProvider, BaseSchemaFormatter] = {
20
- LLMProvider.OPENAI: OpenAiJsonSchemaFormatter(),
21
- LLMProvider.MISTRAL: OpenAiJsonSchemaFormatter(),
22
- LLMProvider.DEEPSEEK: OpenAiJsonSchemaFormatter(),
23
- LLMProvider.GROK: OpenAiJsonSchemaFormatter(),
24
- LLMProvider.ANTHROPIC: AnthropicJsonSchemaFormatter(),
25
- LLMProvider.GEMINI: GeminiJsonSchemaFormatter(),
26
- }
27
- self._default_formatter = DefaultJsonSchemaFormatter()
28
- logger.info("JsonSchemaFormatterRegistry initialized.")
29
-
30
- def get_formatter(self, provider: LLMProvider) -> BaseSchemaFormatter:
31
- """
32
- Retrieves the appropriate schema formatter for a given LLM provider.
33
-
34
- Args:
35
- provider: The LLMProvider enum member.
36
-
37
- Returns:
38
- An instance of a class derived from BaseSchemaFormatter.
39
- """
40
- formatter = self._formatters.get(provider)
41
- if formatter:
42
- logger.debug(f"Found specific schema formatter for provider {provider.name}: {formatter.__class__.__name__}")
43
- return formatter
44
-
45
- logger.debug(f"No specific schema formatter for provider {provider.name}. "
46
- f"Returning default: {self._default_formatter.__class__.__name__}")
47
- return self._default_formatter
48
-
49
- def get_default_formatter(self) -> BaseSchemaFormatter:
50
- """Explicitly returns the default formatter."""
51
- return self._default_formatter
@@ -1,42 +0,0 @@
1
- # file: autobyteus/autobyteus/tools/usage/registries/json_tool_usage_parser_registry.py
2
- import logging
3
- from typing import Dict
4
-
5
- from autobyteus.llm.providers import LLMProvider
6
- from autobyteus.tools.usage.parsers.base_parser import BaseToolUsageParser
7
- from autobyteus.tools.usage.parsers.default_json_tool_usage_parser import DefaultJsonToolUsageParser
8
- from autobyteus.tools.usage.parsers.openai_json_tool_usage_parser import OpenAiJsonToolUsageParser
9
- from autobyteus.tools.usage.parsers.gemini_json_tool_usage_parser import GeminiJsonToolUsageParser
10
- from autobyteus.utils.singleton import SingletonMeta
11
-
12
- logger = logging.getLogger(__name__)
13
-
14
- class JsonToolUsageParserRegistry(metaclass=SingletonMeta):
15
- """A singleton registry for retrieving JSON-based tool usage parsers."""
16
-
17
- def __init__(self):
18
- self._parsers: Dict[LLMProvider, BaseToolUsageParser] = {
19
- LLMProvider.OPENAI: OpenAiJsonToolUsageParser(),
20
- LLMProvider.MISTRAL: OpenAiJsonToolUsageParser(),
21
- LLMProvider.DEEPSEEK: OpenAiJsonToolUsageParser(),
22
- LLMProvider.GROK: OpenAiJsonToolUsageParser(),
23
- LLMProvider.GEMINI: GeminiJsonToolUsageParser(),
24
- }
25
- self._default_parser = DefaultJsonToolUsageParser()
26
- logger.info("JsonToolUsageParserRegistry initialized.")
27
-
28
- def get_parser(self, provider: LLMProvider) -> BaseToolUsageParser:
29
- """
30
- Retrieves the appropriate parser for a given LLM provider.
31
- """
32
- parser = self._parsers.get(provider)
33
- if parser:
34
- logger.debug(f"Found specific tool usage parser for provider {provider.name}: {parser.get_name()}")
35
- return parser
36
-
37
- logger.debug(f"No specific tool usage parser for provider {provider.name}. Returning default: {self._default_parser.get_name()}")
38
- return self._default_parser
39
-
40
- def get_default_parser(self) -> BaseToolUsageParser:
41
- """Explicitly returns the default parser."""
42
- return self._default_parser
@@ -1,30 +0,0 @@
1
- # file: autobyteus/autobyteus/tools/usage/registries/xml_example_formatter_registry.py
2
- import logging
3
- from typing import Optional
4
-
5
- from autobyteus.llm.providers import LLMProvider
6
- from autobyteus.tools.usage.formatters.base_formatter import BaseExampleFormatter
7
- from autobyteus.tools.usage.formatters.default_xml_example_formatter import DefaultXmlExampleFormatter
8
- from autobyteus.utils.singleton import SingletonMeta
9
-
10
- logger = logging.getLogger(__name__)
11
-
12
- class XmlExampleFormatterRegistry(metaclass=SingletonMeta):
13
- """A singleton registry for retrieving XML example formatters."""
14
-
15
- def __init__(self):
16
- self._default_formatter = DefaultXmlExampleFormatter()
17
- logger.info("XmlExampleFormatterRegistry initialized.")
18
-
19
- def get_formatter(self, provider: Optional[LLMProvider] = None) -> BaseExampleFormatter:
20
- """
21
- Retrieves the appropriate XML example formatter.
22
-
23
- Args:
24
- provider: The LLMProvider enum member. This is currently ignored
25
- but is kept for API consistency and future expansion.
26
-
27
- Returns:
28
- An instance of the DefaultXmlExampleFormatter.
29
- """
30
- return self._default_formatter
@@ -1,33 +0,0 @@
1
- # file: autobyteus/autobyteus/tools/usage/registries/xml_schema_formatter_registry.py
2
- import logging
3
- from typing import Dict, Optional
4
-
5
- from autobyteus.llm.providers import LLMProvider
6
- from autobyteus.tools.usage.formatters.base_formatter import BaseSchemaFormatter
7
- from autobyteus.tools.usage.formatters.default_xml_schema_formatter import DefaultXmlSchemaFormatter
8
- from autobyteus.utils.singleton import SingletonMeta
9
-
10
- logger = logging.getLogger(__name__)
11
-
12
- class XmlSchemaFormatterRegistry(metaclass=SingletonMeta):
13
- """A singleton registry for retrieving XML schema formatters based on LLM provider."""
14
-
15
- def __init__(self):
16
- # Currently, there is only one XML format, so all providers map to it.
17
- # This structure allows for future expansion if providers diverge.
18
- self._default_formatter = DefaultXmlSchemaFormatter()
19
- logger.info("XmlSchemaFormatterRegistry initialized.")
20
-
21
- def get_formatter(self, provider: Optional[LLMProvider] = None) -> BaseSchemaFormatter:
22
- """
23
- Retrieves the appropriate XML schema formatter.
24
-
25
- Args:
26
- provider: The LLMProvider enum member. This is currently ignored
27
- but is kept for API consistency and future expansion.
28
-
29
- Returns:
30
- An instance of the DefaultXmlSchemaFormatter.
31
- """
32
- # For now, we only have one XML formatter. This always returns it.
33
- return self._default_formatter
@@ -1,30 +0,0 @@
1
- # file: autobyteus/autobyteus/tools/usage/registries/xml_tool_usage_parser_registry.py
2
- import logging
3
- from typing import Optional
4
-
5
- from autobyteus.llm.providers import LLMProvider
6
- from autobyteus.tools.usage.parsers.base_parser import BaseToolUsageParser
7
- from autobyteus.tools.usage.parsers.default_xml_tool_usage_parser import DefaultXmlToolUsageParser
8
- from autobyteus.utils.singleton import SingletonMeta
9
-
10
- logger = logging.getLogger(__name__)
11
-
12
- class XmlToolUsageParserRegistry(metaclass=SingletonMeta):
13
- """A singleton registry for retrieving XML-based tool usage parsers."""
14
-
15
- def __init__(self):
16
- self._default_parser = DefaultXmlToolUsageParser()
17
- logger.info("XmlToolUsageParserRegistry initialized.")
18
-
19
- def get_parser(self, provider: Optional[LLMProvider] = None) -> BaseToolUsageParser:
20
- """
21
- Retrieves the appropriate XML parser.
22
-
23
- Args:
24
- provider: The LLMProvider enum member. Currently ignored but kept for API consistency.
25
-
26
- Returns:
27
- An instance of a class derived from BaseToolUsageParser.
28
- """
29
- # For now, there's only one XML format, so always return the default.
30
- return self._default_parser
@@ -1,98 +0,0 @@
1
- import asyncio
2
- import logging
3
- from typing import Optional, Callable, Any, List, Union
4
-
5
- from autobyteus.agent.agent import Agent
6
- from autobyteus.events.event_types import EventType
7
- from autobyteus.llm.models import LLMModel
8
- from autobyteus.llm.llm_factory import LLMFactory
9
- from autobyteus.conversation.user_message import UserMessage
10
-
11
- logger = logging.getLogger(__name__)
12
-
13
- class SimpleTask:
14
- """
15
- A simplified task execution class for running single-instruction tasks
16
- with minimal configuration and built-in result handling.
17
- """
18
-
19
- def __init__(
20
- self,
21
- name: str,
22
- instruction: str,
23
- llm_model: LLMModel,
24
- input_data: Optional[Union[str, List[str]]] = None,
25
- output_parser: Optional[Callable[[str], Any]] = None,
26
- ):
27
- """
28
- Initialize a SimpleTask.
29
-
30
- Args:
31
- name (str): Name of the task
32
- instruction (str): Task instruction/prompt
33
- llm_model (LLMModel): LLM model to use
34
- input_data (Optional[Union[str, List[str]]], optional): Input data or file paths. Defaults to None.
35
- output_parser (Optional[Callable], optional): Function to parse the output. Defaults to None.
36
- """
37
- self.name = name
38
- self.instruction = instruction
39
- self.llm_model = llm_model
40
- self.input_data = input_data if isinstance(input_data, list) else ([input_data] if input_data else [])
41
- self.output_parser = output_parser
42
-
43
- logger.info(f"Initialized task '{self.name}' with model {self.llm_model.value} and {len(self.input_data)} inputs")
44
-
45
- async def execute(self) -> Any:
46
- """
47
- Execute the task and return the result.
48
-
49
- Returns:
50
- The result of the task execution, parsed if output_parser is provided
51
- """
52
- try:
53
- llm = LLMFactory.create_llm(self.llm_model)
54
-
55
- user_message = UserMessage(
56
- content=self.instruction,
57
- file_paths=self.input_data
58
- )
59
-
60
- agent = Agent(
61
- role=self.name,
62
- llm=llm,
63
- initial_user_message=user_message
64
- )
65
-
66
- result_queue = asyncio.Queue()
67
-
68
- async def handle_response(*args, **kwargs):
69
- response = kwargs.get('response')
70
- if response:
71
- await result_queue.put(response)
72
-
73
- agent.subscribe(EventType.ASSISTANT_RESPONSE, handle_response, agent.agent_id)
74
-
75
- try:
76
- agent.start()
77
- result = await asyncio.wait_for(
78
- result_queue.get(),
79
- timeout=30.0
80
- )
81
-
82
- # Only parse if output_parser is provided
83
- if self.output_parser:
84
- return self.output_parser(result)
85
- return result
86
-
87
- except asyncio.TimeoutError:
88
- logger.error(f"Task '{self.name}' timed out")
89
- raise TimeoutError(f"Task '{self.name}' execution timed out")
90
-
91
- finally:
92
- agent.unsubscribe("ASSISTANT_RESPONSE", handle_response, agent.agent_id)
93
- agent.stop()
94
- await agent.cleanup()
95
-
96
- except Exception as e:
97
- logger.error(f"Error executing task '{self.name}': {str(e)}")
98
- raise
@@ -1,147 +0,0 @@
1
- """
2
- task.py: Contains the Task class for representing individual tasks within a workflow.
3
-
4
- This module defines the Task class, which encapsulates the functionality for a single task,
5
- including its objective, input and output descriptions, associated tools, LLM integration,
6
- and execution logic using a dynamically created Agent.
7
- """
8
-
9
- from typing import Any, List, Optional
10
- from autobyteus.tools.base_tool import BaseTool
11
- from autobyteus.llm.base_llm import BaseLLM
12
- from autobyteus.agent.agent import Agent
13
- from autobyteus.prompt.prompt_builder import PromptBuilder
14
- from autobyteus.person.person import Person
15
-
16
- class Task:
17
- def __init__(
18
- self,
19
- description: str,
20
- objective: str,
21
- input_description: str,
22
- expected_output_description: str,
23
- workflow_description: Optional[str],
24
- tools: List[BaseTool],
25
- llm: BaseLLM,
26
- person: Optional[Person] = None,
27
- subtasks: Optional[List['Task']] = None
28
- ):
29
- self.description = description
30
- self.objective = objective
31
- self.input_description = input_description
32
- self.expected_output_description = expected_output_description
33
- self.workflow_description = workflow_description
34
- self.tools = tools
35
- self.llm = llm
36
- self.person = None
37
- if person:
38
- self.assign_to(person)
39
- self.subtasks = subtasks or []
40
- self.result = None
41
-
42
- def assign_to(self, person: Person):
43
- if self.person:
44
- self.person.unassign_task(self)
45
- self.person = person
46
- person.assign_task(self)
47
-
48
- def unassign(self):
49
- if self.person:
50
- self.person.unassign_task(self)
51
- self.person = None
52
-
53
- async def execute(self, input_data: Any) -> Any:
54
- if self.subtasks:
55
- return await self._execute_subtasks(input_data)
56
- else:
57
- return await self._execute_single_task(input_data)
58
-
59
- async def _execute_subtasks(self, input_data: Any) -> Any:
60
- result = input_data
61
- for subtask in self.subtasks:
62
- print(f"Executing subtask: {subtask.objective}")
63
- result = await subtask.execute(result)
64
- self.result = result
65
- return self.result
66
-
67
- async def _execute_single_task(self, input_data: Any) -> Any:
68
- agent = self._create_agent()
69
-
70
- # Set the variable values for the prompt
71
- agent.prompt_builder.set_variable_value("name", self.person.name)
72
- agent.prompt_builder.set_variable_value("role", self.person.role.name)
73
- agent.prompt_builder.set_variable_value("person_description", self.person.get_description())
74
- agent.prompt_builder.set_variable_value("task_description", self.description)
75
- agent.prompt_builder.set_variable_value("objective", self.objective)
76
- agent.prompt_builder.set_variable_value("input_description", self.input_description)
77
- agent.prompt_builder.set_variable_value("expected_output_description", self.expected_output_description)
78
- agent.prompt_builder.set_variable_value("workflow_description", self.workflow_description)
79
- agent.prompt_builder.set_variable_value("tools", self._format_tools())
80
- agent.prompt_builder.set_variable_value("input_data", str(input_data))
81
-
82
- # Run the agent
83
- await agent.run()
84
-
85
- # Retrieve the result from the agent's conversation
86
- self.result = agent.conversation.get_last_assistant_message()
87
- return self.result
88
-
89
- def _create_agent(self) -> Agent:
90
- agent_id = f"task_{self.objective[:10]}_{id(self)}"
91
-
92
- # Generate the initial prompt
93
- initial_prompt = self._generate_initial_prompt()
94
-
95
- return Agent(
96
- role=f"Task_{self.objective[:20]}",
97
- llm=self.llm,
98
- tools=self.tools,
99
- use_xml_parser=True,
100
- agent_id=agent_id,
101
- initial_user_message=initial_prompt
102
- )
103
-
104
- def _generate_initial_prompt(self) -> str:
105
- template = """
106
- You are {name}. Your role is {role}.
107
-
108
- {person_description}
109
-
110
- Task Description: {task_description}
111
- Objective: {objective}
112
-
113
- Input Description: {input_description}
114
- Expected Output: {expected_output_description}
115
-
116
- Workflow:
117
- {workflow_description}
118
-
119
- Available Tools:
120
- {tools}
121
-
122
- Input Data:
123
- {input_data}
124
-
125
- Please complete the task based on the given information and using the available tools.
126
- """
127
- prompt_builder = PromptBuilder.from_string(template)
128
- prompt_builder.set_variable_value("name", self.person.name)
129
- prompt_builder.set_variable_value("role", self.person.role.name)
130
- prompt_builder.set_variable_value("person_description", self.person.get_description())
131
- prompt_builder.set_variable_value("task_description", self.description)
132
- prompt_builder.set_variable_value("objective", self.objective)
133
- prompt_builder.set_variable_value("input_description", self.input_description)
134
- prompt_builder.set_variable_value("expected_output_description", self.expected_output_description)
135
- prompt_builder.set_variable_value("workflow_description", self.workflow_description)
136
- prompt_builder.set_variable_value("tools", self._format_tools())
137
- prompt_builder.set_variable_value("input_data", "To be provided during execution")
138
- return prompt_builder.build()
139
-
140
- def _format_tools(self) -> str:
141
- return "\n".join([f"- {tool.get_name()}: {tool.get_description()}" for tool in self.tools])
142
-
143
- def get_result(self) -> Any:
144
- return self.result
145
-
146
- def add_subtask(self, subtask: 'Task'):
147
- self.subtasks.append(subtask)
@@ -1,49 +0,0 @@
1
- """
2
- workflow.py: Contains the Workflow class for managing a sequence of tasks.
3
-
4
- This module defines the Workflow class, which represents a series of tasks to be executed in order.
5
- The Workflow class allows adding tasks, executing the entire workflow, and retrieving the final result.
6
- """
7
-
8
- from typing import List, Any
9
- from autobyteus.workflow.task import Task
10
-
11
- class Workflow:
12
- def __init__(self):
13
- """
14
- Initialize a new Workflow instance with an empty list of tasks.
15
- """
16
- self.tasks: List[Task] = []
17
-
18
- def add_task(self, task: Task):
19
- """
20
- Add a new task to the workflow.
21
-
22
- Args:
23
- task (Task): The task to be added to the workflow.
24
- """
25
- self.tasks.append(task)
26
-
27
- async def execute(self, input_data: Any) -> Any:
28
- """
29
- Execute all tasks in the workflow sequentially.
30
-
31
- Args:
32
- input_data (Any): The initial input data for the first task.
33
-
34
- Returns:
35
- Any: The result of the final task in the workflow.
36
- """
37
- result = input_data
38
- for task in self.tasks:
39
- result = await task.execute(result)
40
- return result
41
-
42
- def get_result(self) -> Any:
43
- """
44
- Get the result of the last task in the workflow.
45
-
46
- Returns:
47
- Any: The result of the last task, or None if there are no tasks.
48
- """
49
- return self.tasks[-1].get_result() if self.tasks else None