autobyteus 1.1.6__py3-none-any.whl → 1.1.8__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 (43) hide show
  1. autobyteus/agent/context/agent_runtime_state.py +7 -1
  2. autobyteus/agent/handlers/tool_result_event_handler.py +121 -89
  3. autobyteus/agent/llm_response_processor/provider_aware_tool_usage_processor.py +7 -1
  4. autobyteus/agent/tool_invocation.py +25 -1
  5. autobyteus/agent_team/agent_team_builder.py +22 -1
  6. autobyteus/agent_team/context/agent_team_runtime_state.py +0 -2
  7. autobyteus/llm/llm_factory.py +25 -57
  8. autobyteus/llm/ollama_provider_resolver.py +1 -0
  9. autobyteus/llm/providers.py +1 -0
  10. autobyteus/llm/token_counter/token_counter_factory.py +2 -0
  11. autobyteus/multimedia/audio/audio_model.py +2 -1
  12. autobyteus/multimedia/image/image_model.py +2 -1
  13. autobyteus/task_management/tools/publish_task_plan.py +4 -16
  14. autobyteus/task_management/tools/update_task_status.py +4 -19
  15. autobyteus/tools/__init__.py +2 -4
  16. autobyteus/tools/base_tool.py +98 -29
  17. autobyteus/tools/browser/standalone/__init__.py +0 -1
  18. autobyteus/tools/google_search.py +149 -0
  19. autobyteus/tools/mcp/schema_mapper.py +29 -71
  20. autobyteus/tools/multimedia/audio_tools.py +3 -3
  21. autobyteus/tools/multimedia/image_tools.py +5 -5
  22. autobyteus/tools/parameter_schema.py +82 -89
  23. autobyteus/tools/pydantic_schema_converter.py +81 -0
  24. autobyteus/tools/usage/formatters/default_json_example_formatter.py +89 -20
  25. autobyteus/tools/usage/formatters/default_xml_example_formatter.py +115 -41
  26. autobyteus/tools/usage/formatters/default_xml_schema_formatter.py +50 -20
  27. autobyteus/tools/usage/formatters/gemini_json_example_formatter.py +55 -22
  28. autobyteus/tools/usage/formatters/google_json_example_formatter.py +54 -21
  29. autobyteus/tools/usage/formatters/openai_json_example_formatter.py +53 -23
  30. autobyteus/tools/usage/parsers/default_xml_tool_usage_parser.py +270 -94
  31. autobyteus/tools/usage/providers/tool_manifest_provider.py +39 -14
  32. autobyteus-1.1.8.dist-info/METADATA +204 -0
  33. {autobyteus-1.1.6.dist-info → autobyteus-1.1.8.dist-info}/RECORD +39 -40
  34. examples/run_google_slides_agent.py +2 -2
  35. examples/run_mcp_google_slides_client.py +1 -1
  36. examples/run_sqlite_agent.py +1 -1
  37. autobyteus/tools/ask_user_input.py +0 -40
  38. autobyteus/tools/browser/standalone/factory/google_search_factory.py +0 -25
  39. autobyteus/tools/browser/standalone/google_search_ui.py +0 -126
  40. autobyteus-1.1.6.dist-info/METADATA +0 -161
  41. {autobyteus-1.1.6.dist-info → autobyteus-1.1.8.dist-info}/WHEEL +0 -0
  42. {autobyteus-1.1.6.dist-info → autobyteus-1.1.8.dist-info}/licenses/LICENSE +0 -0
  43. {autobyteus-1.1.6.dist-info → autobyteus-1.1.8.dist-info}/top_level.txt +0 -0
@@ -1,126 +0,0 @@
1
- """
2
- File: autobyteus/tools/browser/google_search_ui.py
3
- This module provides a GoogleSearch tool for performing Google searches using Playwright.
4
- """
5
-
6
- import asyncio
7
- import logging
8
- from typing import Optional, TYPE_CHECKING, Any
9
- from autobyteus.tools.base_tool import BaseTool
10
- from autobyteus.tools.tool_config import ToolConfig
11
- from autobyteus.tools.parameter_schema import ParameterSchema, ParameterDefinition, ParameterType
12
- from autobyteus.tools.tool_category import ToolCategory
13
- from brui_core.ui_integrator import UIIntegrator
14
- from autobyteus.utils.html_cleaner import clean, CleaningMode
15
-
16
- if TYPE_CHECKING:
17
- from autobyteus.agent.context import AgentContext
18
-
19
- logger = logging.getLogger(__name__)
20
-
21
- class GoogleSearch(BaseTool, UIIntegrator): # Multiple inheritance
22
- """
23
- A tool that allows for performing a Google search using Playwright and retrieving the search results.
24
- Inherits from BaseTool for tool framework compatibility and UIIntegrator for Playwright integration.
25
- """
26
- CATEGORY = ToolCategory.WEB
27
-
28
- def __init__(self, config: Optional[ToolConfig] = None):
29
- BaseTool.__init__(self, config=config)
30
- UIIntegrator.__init__(self)
31
-
32
- self.text_area_selector = 'textarea[name="q"]'
33
-
34
- cleaning_mode_to_use = CleaningMode.THOROUGH
35
- if config:
36
- cleaning_mode_value = config.get('cleaning_mode')
37
- if cleaning_mode_value:
38
- if isinstance(cleaning_mode_value, str):
39
- try:
40
- cleaning_mode_to_use = CleaningMode(cleaning_mode_value.upper())
41
- except ValueError:
42
- logger.warning(f"Invalid cleaning_mode string '{cleaning_mode_value}' in config. Using THOROUGH.")
43
- cleaning_mode_to_use = CleaningMode.THOROUGH
44
- elif isinstance(cleaning_mode_value, CleaningMode):
45
- cleaning_mode_to_use = cleaning_mode_value
46
- else:
47
- logger.warning(f"Invalid type for cleaning_mode in config. Using THOROUGH.")
48
-
49
- self.cleaning_mode = cleaning_mode_to_use
50
- logger.debug(f"GoogleSearch initialized with cleaning_mode: {self.cleaning_mode}")
51
-
52
- @classmethod
53
- def get_description(cls) -> str:
54
- return "Searches Google for a given query and returns cleaned HTML search results."
55
-
56
- @classmethod
57
- def get_argument_schema(cls) -> Optional[ParameterSchema]:
58
- """Schema for arguments passed to the execute method."""
59
- schema = ParameterSchema()
60
- schema.add_parameter(ParameterDefinition(
61
- name="query",
62
- param_type=ParameterType.STRING,
63
- description="The search query string.",
64
- required=True
65
- ))
66
- return schema
67
-
68
- @classmethod
69
- def get_config_schema(cls) -> Optional[ParameterSchema]:
70
- """Schema for parameters to configure the GoogleSearch instance itself."""
71
- schema = ParameterSchema()
72
- schema.add_parameter(ParameterDefinition(
73
- name="cleaning_mode",
74
- param_type=ParameterType.ENUM,
75
- description="Level of HTML content cleanup for search results. BASIC or THOROUGH.",
76
- required=False,
77
- default_value="THOROUGH",
78
- enum_values=[mode.name for mode in CleaningMode]
79
- ))
80
- return schema
81
-
82
- async def _execute(self, context: 'AgentContext', query: str) -> str:
83
- logger.info(f"GoogleSearch executing for agent {context.agent_id} with query: '{query}'")
84
-
85
- try:
86
- await self.initialize()
87
- if not self.page:
88
- logger.error("Playwright page not initialized in GoogleSearch.")
89
- raise RuntimeError("Playwright page not available for Google Search.")
90
-
91
- await self.page.goto('https://www.google.com/')
92
-
93
- textarea = self.page.locator(self.text_area_selector)
94
- await textarea.click()
95
- await self.page.type(self.text_area_selector, query)
96
- await self.page.keyboard.press('Enter')
97
-
98
- await self.page.wait_for_load_state("networkidle", timeout=15000)
99
-
100
- search_result_div_selector = '#search'
101
- try:
102
- search_result_div = await self.page.wait_for_selector(
103
- search_result_div_selector,
104
- state="visible",
105
- timeout=10000
106
- )
107
- except Exception as e_selector:
108
- logger.warning(f"Could not find primary search result selector '{search_result_div_selector}'. "
109
- f"Falling back to page content. Error: {e_selector}")
110
- page_html_content = await self.page.content()
111
- else:
112
- await asyncio.sleep(1)
113
- page_html_content = await search_result_div.inner_html()
114
-
115
- cleaned_search_result = clean(page_html_content, mode=self.cleaning_mode)
116
-
117
- return f'''here is the google search result html
118
- <GoogleSearchResultStart>
119
- {cleaned_search_result}
120
- </GoogleSearchResultEnd>
121
- '''
122
- except Exception as e:
123
- logger.error(f"Error during Google search for query '{query}': {e}", exc_info=True)
124
- raise RuntimeError(f"GoogleSearch failed for query '{query}': {str(e)}")
125
- finally:
126
- await self.close()
@@ -1,161 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: autobyteus
3
- Version: 1.1.6
4
- Summary: Multi-Agent framework
5
- Home-page: https://github.com/AutoByteus/autobyteus
6
- Author: Ryan Zheng
7
- Author-email: ryan.zheng.work@gmail.com
8
- Classifier: Development Status :: 3 - Alpha
9
- Classifier: Intended Audience :: Developers
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3.8
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Requires-Python: >=3.8
15
- Description-Content-Type: text/markdown
16
- License-File: LICENSE
17
- Requires-Dist: aiohttp
18
- Requires-Dist: anthropic
19
- Requires-Dist: autobyteus-llm-client==1.1.3
20
- Requires-Dist: beautifulsoup4
21
- Requires-Dist: boto3
22
- Requires-Dist: botocore
23
- Requires-Dist: brui-core==1.0.9
24
- Requires-Dist: certifi==2025.4.26
25
- Requires-Dist: google-api-python-client
26
- Requires-Dist: google-generativeai
27
- Requires-Dist: Jinja2
28
- Requires-Dist: mcp[cli]
29
- Requires-Dist: mistral_common
30
- Requires-Dist: mistralai
31
- Requires-Dist: numpy
32
- Requires-Dist: ollama
33
- Requires-Dist: openai
34
- Requires-Dist: requests
35
- Requires-Dist: rich
36
- Requires-Dist: textual
37
- Requires-Dist: tiktoken
38
- Requires-Dist: tokenizers
39
- Provides-Extra: dev
40
- Requires-Dist: coverage; extra == "dev"
41
- Requires-Dist: flake8; extra == "dev"
42
- Requires-Dist: numpy; extra == "dev"
43
- Requires-Dist: pre-commit; extra == "dev"
44
- Requires-Dist: black; extra == "dev"
45
- Requires-Dist: isort; extra == "dev"
46
- Requires-Dist: gitpython==3.1.31; extra == "dev"
47
- Requires-Dist: auto-gpt-plugin-template; extra == "dev"
48
- Requires-Dist: mkdocs; extra == "dev"
49
- Requires-Dist: pytest; extra == "dev"
50
- Requires-Dist: asynctest; extra == "dev"
51
- Requires-Dist: pytest-asyncio; extra == "dev"
52
- Requires-Dist: pytest-benchmark; extra == "dev"
53
- Requires-Dist: pytest-cov; extra == "dev"
54
- Requires-Dist: pytest-integration; extra == "dev"
55
- Requires-Dist: pytest-mock; extra == "dev"
56
- Requires-Dist: vcrpy; extra == "dev"
57
- Requires-Dist: pytest-vcr; extra == "dev"
58
- Requires-Dist: load_dotenv; extra == "dev"
59
- Dynamic: author
60
- Dynamic: author-email
61
- Dynamic: classifier
62
- Dynamic: description
63
- Dynamic: description-content-type
64
- Dynamic: home-page
65
- Dynamic: license-file
66
- Dynamic: provides-extra
67
- Dynamic: requires-dist
68
- Dynamic: requires-python
69
- Dynamic: summary
70
-
71
- # Autobyteus
72
-
73
- Autobyteus is an open-source, application-first agentic framework for Python. It is designed to help developers build, test, and deploy complex, stateful, and extensible AI agents by providing a robust architecture and a powerful set of tools.
74
-
75
- ## Architecture
76
-
77
- Autobyteus is built with a modular, event-driven architecture designed for extensibility and clear separation of concerns. The key components are:
78
-
79
- - **Agent Core**: The heart of the system. Each agent is a stateful, autonomous entity that runs as a background process in its own thread, managed by a dedicated `AgentWorker`. This design makes every agent a truly independent entity capable of handling long-running tasks.
80
- - **Context & Configuration**: Agent behavior is defined through a static configuration (`AgentConfig`) and its dynamic state is managed in `AgentRuntimeState`. These are bundled into a comprehensive `AgentContext` that is passed to all components, providing a single source of truth.
81
- - **Event-Driven System**: Agents operate on an internal `asyncio` event loop. User messages, tool results, and internal signals are handled as events, which are processed by dedicated `EventHandlers`. This decouples logic and makes the system highly extensible.
82
- - **Pluggable Processors & Hooks**: The framework provides extension points to inject custom logic. `InputProcessors` and `LLMResponseProcessors` modify data in the main processing pipeline, while `PhaseHooks` allow custom code to run on specific agent lifecycle transitions (e.g., from `BOOTSTRAPPING` to `IDLE`).
83
- - **Context-Aware Tooling**: Tools are first-class citizens that receive the agent's full `AgentContext` during execution. This allows tools to be deeply integrated with the agent's state, configuration, and workspace, enabling more intelligent and powerful actions.
84
- - **Tool Approval Flow**: The framework has native support for human-in-the-loop workflows. By setting `auto_execute_tools=False` in the agent's configuration, the agent will pause before executing a tool, emit an event requesting permission, and wait for external approval before proceeding.
85
- - **MCP Integration**: The framework has native support for the Model Context Protocol (MCP). This allows agents to discover and use tools from external, language-agnostic tool servers, making the ecosystem extremely flexible and ready for enterprise integration.
86
-
87
- ## Features
88
-
89
- - **Context-Aware Workflows**: Each step in the development process interacts with large language models to provide relevant assistance.
90
- - **Lifecycle Integration**: Supports the entire software development lifecycle, starting from requirement engineering.
91
- - **Memory Management**: Custom memory management system supporting different memory providers and embeddings.
92
-
93
- ## Knowledge Base
94
-
95
- 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.
96
-
97
- ## Requirements
98
-
99
- - **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.
100
-
101
- ## Getting Started
102
-
103
- ### Installation
104
-
105
- 1. **For users:**
106
- To install Autobyteus, run:
107
- ```
108
- pip install .
109
- ```
110
-
111
- 2. **For developers:**
112
- To install Autobyteus with development dependencies, run:
113
- ```
114
- pip install -r requirements-dev.txt
115
- ```
116
-
117
- 3. **Platform-specific dependencies:**
118
- To install platform-specific dependencies, run:
119
- ```
120
- python setup.py install_platform_deps
121
- ```
122
-
123
- ### Building the Library
124
-
125
- To build Autobyteus as a distributable package, follow these steps:
126
-
127
- 1. Ensure you have the latest version of `setuptools` and `wheel` installed:
128
- ```
129
- pip install --upgrade setuptools wheel
130
- ```
131
-
132
- 2. Build the distribution packages:
133
- ```
134
- python setup.py sdist bdist_wheel
135
- ```
136
-
137
- This will create a `dist` directory containing the built distributions.
138
-
139
- 3. (Optional) To create a source distribution only:
140
- ```
141
- python setup.py sdist
142
- ```
143
-
144
- 4. (Optional) To create a wheel distribution only:
145
- ```
146
- python setup.py bdist_wheel
147
- ```
148
-
149
- The built packages will be in the `dist` directory and can be installed using pip or distributed as needed.
150
-
151
- ### Usage
152
-
153
- (Add basic commands and examples to get users started)
154
-
155
- ### Contributing
156
-
157
- (Add guidelines for contributing to the project)
158
-
159
- ## License
160
-
161
- This project is licensed under the MIT License.