microbots 0.0.2__tar.gz → 0.0.4__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.
Files changed (64) hide show
  1. microbots-0.0.4/.github/workflows/dockerBuildPush.yml +35 -0
  2. microbots-0.0.4/.github/workflows/publish.yml +61 -0
  3. microbots-0.0.4/.gitignore +206 -0
  4. microbots-0.0.4/PKG-INFO +144 -0
  5. microbots-0.0.4/README.md +96 -0
  6. microbots-0.0.4/architechture.md +64 -0
  7. microbots-0.0.4/docs/images/overall_architecture.png +0 -0
  8. {microbots-0.0.2 → microbots-0.0.4}/pyproject.toml +5 -3
  9. microbots-0.0.4/pytest.ini +4 -0
  10. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/MicroBot.py +34 -22
  11. microbots-0.0.4/src/microbots/__init__.py +4 -0
  12. microbots-0.0.4/src/microbots/bot/BrowsingBot.py +51 -0
  13. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/bot/CustomBot.py +2 -2
  14. microbots-0.0.4/src/microbots/bot/LogAnalysisBot.py +66 -0
  15. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/bot/ReadingBot.py +6 -6
  16. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/bot/WritingBot.py +10 -7
  17. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/constants.py +11 -3
  18. microbots-0.0.4/src/microbots/environment/Environment.py +35 -0
  19. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/environment/local_docker/LocalDockerEnvironment.py +142 -6
  20. microbots-0.0.4/src/microbots/environment/local_docker/image_builder/Dockerfile +14 -0
  21. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/environment/local_docker/image_builder/ShellCommunicator.py +89 -36
  22. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/environment/local_docker/image_builder/dockerShell.py +15 -1
  23. microbots-0.0.4/src/microbots/tools/tool.py +237 -0
  24. {microbots-0.0.2/src/microbots/tool/tool_definition → microbots-0.0.4/src/microbots/tools/tool_definitions}/browser-use/browser.py +2 -2
  25. microbots-0.0.4/src/microbots/tools/tool_definitions/browser-use.yaml +42 -0
  26. microbots-0.0.4/src/microbots/tools/tool_definitions/cscope.yaml +68 -0
  27. microbots-0.0.4/src/microbots/tools/tool_test.ipynb +51 -0
  28. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/utils/logger.py +10 -1
  29. microbots-0.0.4/src/microbots/utils/path.py +39 -0
  30. microbots-0.0.4/src/microbots.egg-info/PKG-INFO +144 -0
  31. microbots-0.0.4/src/microbots.egg-info/SOURCES.txt +51 -0
  32. microbots-0.0.4/test/bot/browsing_bot_test.py +29 -0
  33. microbots-0.0.4/test/bot/calculator/calculator.log +15 -0
  34. microbots-0.0.4/test/bot/calculator/code/calculator.py +50 -0
  35. microbots-0.0.4/test/bot/calculator/log_analysis_test.py +30 -0
  36. microbots-0.0.4/test/bot/countries_to_capital/countries_dir/countries.txt +5 -0
  37. microbots-0.0.4/test/bot/countries_to_capital/reading_bot_test.py +29 -0
  38. microbots-0.0.4/test/bot/countries_to_capital/writing_bot_test.py +27 -0
  39. microbots-0.0.4/test/environment/local_docker/LocalDockerEnvironmentTest.py +83 -0
  40. microbots-0.0.4/test/environment/local_docker/TestFileCopy.py +59 -0
  41. microbots-0.0.4/test/environment/swe-rex/LocalDockerTest.py +188 -0
  42. microbots-0.0.2/PKG-INFO +0 -47
  43. microbots-0.0.2/README.md +0 -0
  44. microbots-0.0.2/src/microbots/__init__.py +0 -10
  45. microbots-0.0.2/src/microbots/bot/BrowserBot.py +0 -32
  46. microbots-0.0.2/src/microbots/environment/Environment.py +0 -22
  47. microbots-0.0.2/src/microbots/tool/tool.py +0 -74
  48. microbots-0.0.2/src/microbots/tool_definitions/base_tool.py +0 -23
  49. microbots-0.0.2/src/microbots/tool_definitions/ctags.py +0 -25
  50. microbots-0.0.2/src/microbots/tool_definitions/node.py +0 -24
  51. microbots-0.0.2/src/microbots.egg-info/PKG-INFO +0 -47
  52. microbots-0.0.2/src/microbots.egg-info/SOURCES.txt +0 -32
  53. {microbots-0.0.2 → microbots-0.0.4}/LICENSE +0 -0
  54. {microbots-0.0.2 → microbots-0.0.4}/requirements.txt +0 -0
  55. {microbots-0.0.2 → microbots-0.0.4}/setup.cfg +0 -0
  56. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/bot/__init__.py +0 -0
  57. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/environment/local_docker/__init__.py +0 -0
  58. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/environment/swe-rex/LocalDocker.py +0 -0
  59. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/llm/__init__.py +0 -0
  60. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/llm/openai_api.py +0 -0
  61. {microbots-0.0.2 → microbots-0.0.4}/src/microbots/utils/network.py +0 -0
  62. {microbots-0.0.2 → microbots-0.0.4}/src/microbots.egg-info/dependency_links.txt +0 -0
  63. {microbots-0.0.2 → microbots-0.0.4}/src/microbots.egg-info/requires.txt +0 -0
  64. {microbots-0.0.2 → microbots-0.0.4}/src/microbots.egg-info/top_level.txt +0 -0
@@ -0,0 +1,35 @@
1
+ name: Build and Push to Docker Hub
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - 'src/microbots/environment/local_docker/image_builder/Dockerfile'
7
+ - 'src/microbots/environment/local_docker/image_builder/dockerShell.py'
8
+ - 'src/microbots/environment/local_docker/image_builder/ShellCommunicator.py'
9
+ - '.github/workflows/dockerBuildPush.yml'
10
+ branches:
11
+ - main
12
+
13
+ jobs:
14
+ build-and-push:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Log in to Docker Hub
22
+ uses: docker/login-action@v3
23
+ with:
24
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
25
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
26
+
27
+ - name: Build and push Docker image
28
+ run: |
29
+ IMAGE_NAME=${{ secrets.DOCKERHUB_USERNAME }}/shell_server
30
+ TAG=${{ github.sha }}
31
+
32
+ # build with both commit SHA and latest tag
33
+ docker build -f src/microbots/environment/local_docker/image_builder/Dockerfile -t $IMAGE_NAME:$TAG -t $IMAGE_NAME:latest .
34
+ docker push $IMAGE_NAME:$TAG
35
+ docker push $IMAGE_NAME:latest
@@ -0,0 +1,61 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v4
14
+
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.11"
19
+
20
+ - name: Install dependencies
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+
24
+ build-and-publish:
25
+ needs: test
26
+ runs-on: ubuntu-latest
27
+ # Only publish on push to main
28
+ if: github.event_name == 'release'
29
+
30
+ permissions:
31
+ id-token: write
32
+ contents: read
33
+
34
+ steps:
35
+ - name: Checkout code
36
+ uses: actions/checkout@v4
37
+
38
+ - name: Set up Python
39
+ uses: actions/setup-python@v5
40
+ with:
41
+ python-version: "3.11"
42
+
43
+ - name: Install build dependencies
44
+ run: |
45
+ python -m pip install --upgrade pip
46
+ pip install build twine
47
+ pip install -e .
48
+
49
+ - name: Build package
50
+ run: python -m build
51
+
52
+ - name: Check package
53
+ run: python -m twine check dist/*
54
+
55
+ # Publish directly to PyPI
56
+ - name: Publish to PyPI
57
+ uses: pypa/gh-action-pypi-publish@release/v1
58
+ with:
59
+ user: ${{ secrets.PYPI_USERNAME }}
60
+ password: ${{ secrets.PYPI_API_TOKEN }}
61
+ verbose: true
@@ -0,0 +1,206 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ local_settings.py
60
+ db.sqlite3
61
+ db.sqlite3-journal
62
+
63
+ # Flask stuff:
64
+ instance/
65
+ .webassets-cache
66
+
67
+ # Scrapy stuff:
68
+ .scrapy
69
+
70
+ # Sphinx documentation
71
+ docs/_build/
72
+
73
+ # PyBuilder
74
+ .pybuilder/
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ # For a library or package, you might want to ignore these files since the code is
86
+ # intended to run in multiple environments; otherwise, check them in:
87
+ # .python-version
88
+
89
+ # pipenv
90
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
91
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
92
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
93
+ # install all needed dependencies.
94
+ #Pipfile.lock
95
+
96
+ # UV
97
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
98
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
99
+ # commonly ignored for libraries.
100
+ #uv.lock
101
+
102
+ # poetry
103
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
104
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
105
+ # commonly ignored for libraries.
106
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
107
+ #poetry.lock
108
+ #poetry.toml
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
113
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
114
+ #pdm.lock
115
+ #pdm.toml
116
+ .pdm-python
117
+ .pdm-build/
118
+
119
+ # pixi
120
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
121
+ #pixi.lock
122
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
123
+ # in the .venv directory. It is recommended not to include this directory in version control.
124
+ .pixi
125
+
126
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
127
+ __pypackages__/
128
+
129
+ # Celery stuff
130
+ celerybeat-schedule
131
+ celerybeat.pid
132
+
133
+ # SageMath parsed files
134
+ *.sage.py
135
+
136
+ # Environments
137
+ .env
138
+ .envrc
139
+ .venv
140
+ env/
141
+ venv/
142
+ ENV/
143
+ env.bak/
144
+ venv.bak/
145
+
146
+ # Spyder project settings
147
+ .spyderproject
148
+ .spyproject
149
+
150
+ # Rope project settings
151
+ .ropeproject
152
+
153
+ # mkdocs documentation
154
+ /site
155
+
156
+ # mypy
157
+ .mypy_cache/
158
+ .dmypy.json
159
+ dmypy.json
160
+
161
+ # Pyre type checker
162
+ .pyre/
163
+
164
+ # pytype static type analyzer
165
+ .pytype/
166
+
167
+ # Cython debug symbols
168
+ cython_debug/
169
+
170
+ # PyCharm
171
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
172
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
173
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
174
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
175
+ #.idea/
176
+
177
+ # Abstra
178
+ # Abstra is an AI-powered process automation framework.
179
+ # Ignore directories containing user credentials, local state, and settings.
180
+ # Learn more at https://abstra.io/docs
181
+ .abstra/
182
+
183
+ # Visual Studio Code
184
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
185
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
186
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
187
+ # you could uncomment the following to ignore the entire vscode folder
188
+ # .vscode/
189
+
190
+ # Ruff stuff:
191
+ .ruff_cache/
192
+
193
+ # PyPI configuration file
194
+ .pypirc
195
+
196
+ # Cursor
197
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
198
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
199
+ # refer to https://docs.cursor.com/context/ignore-files
200
+ .cursorignore
201
+ .cursorindexingignore
202
+
203
+ # Marimo
204
+ marimo/_static/
205
+ marimo/_lsp/
206
+ __marimo__/
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: microbots
3
+ Version: 0.0.4
4
+ Summary: container-based autonomous agent framework
5
+ Author-email: xxx <xxx@example.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Bala
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Source Repo, https://github.com/microsoft/minions
29
+ Project-URL: Issues, https://github.com/microsoft/minions/issues
30
+ Keywords: agent,bot,micro
31
+ Classifier: Operating System :: OS Independent
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Programming Language :: Python :: 3.11
35
+ Requires-Python: >=3.11
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: openai==1.107.3
39
+ Requires-Dist: python-dotenv==1.1.1
40
+ Requires-Dist: docker==7.1.0
41
+ Requires-Dist: fastapi==0.116.1
42
+ Requires-Dist: uvicorn==0.35.0
43
+ Requires-Dist: pydantic==2.11.9
44
+ Requires-Dist: swe-rex==1.4.0
45
+ Requires-Dist: aiohttp==3.12.15
46
+ Requires-Dist: pyyaml==6.0.2
47
+ Dynamic: license-file
48
+
49
+ # 🤖 Microbots
50
+
51
+ MicroBots is a lightweight, extensible AI agent for code comprehension and controlled file edits. It integrates cleanly
52
+ into automation pipelines, mounting a target directory with explicit read-only or read/write modes so LLMs can safely
53
+ inspect, refactor, or generate files with least‑privilege access.
54
+
55
+
56
+ ```py
57
+ from microbots import WritingBot
58
+
59
+ myWritingBot = WritingBot(
60
+ model="azure-openai/my-gpt5", # model format : <provider/deployment_model_name>
61
+ folder_to_mount=str("myReactApp"),
62
+ )
63
+
64
+ data = myWritingBot.run("""when doing npm run build, I get an error.
65
+ Fix the error and make sure the build is successful.""", timeout_in_seconds=600)
66
+ print(data.results)
67
+ ```
68
+
69
+ ## ⚠️ Project Status: Highly Unstable
70
+ This project is currently **under active development** and is considered **highly unstable**. Features, APIs, and internal structures are subject to change without notice, and unexpected behavior may occur.
71
+ Please **use with caution** in production environments.
72
+
73
+ ## 🚀 How to install
74
+
75
+ ### Pre-requisites
76
+
77
+ - Docker
78
+ - AI LLM Provider and API Key
79
+
80
+ ### Install Microbots
81
+
82
+ ```bash
83
+ pip install microbots
84
+ ```
85
+
86
+
87
+ ## ✨LLM Support
88
+
89
+ Azure OpenAI Models - Add the below environment variables in a `.env` file in the root of your application
90
+
91
+ ```env
92
+ OPEN_AI_END_POINT=XXXXXXXXXXXXXXXXXXXXXXXXXX
93
+ OPEN_AI_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
94
+ ```
95
+
96
+ ## 🤖 Bots & Usage Examples
97
+
98
+ Pre-requisite for the below example code of Bots:
99
+ From the root of your application, Create a folder called `code` inside which clone the repo `https://github.com/swe-agent/test-repo/`. Now run the code
100
+
101
+
102
+ ### 📖 ReadingBot
103
+
104
+
105
+ ```py
106
+ from microbots import ReadingBot
107
+
108
+ myBot = ReadingBot(
109
+ model="azure-openai/my-gpt5",
110
+ folder_to_mount="code"
111
+ )
112
+
113
+ runResult = myBot.run("When I am running missing_colon.py I am getting SyntaxError: invalid syntax. Find the error and explain me what is the error", timeout_in_seconds=600)
114
+ print(runResult)
115
+
116
+ ```
117
+
118
+ The `ReadingBot` will read the files inside `code` folder and will extract information based on specific instructions given to the bot.
119
+
120
+
121
+ ### ✍️ WritingBot
122
+
123
+ Pre-requisite for the example code:
124
+ From the root the application, Create a folder called `code` inside which clone the repo `https://github.com/swe-agent/test-repo/`. Now run the code
125
+
126
+ ```py
127
+ from microbots import WritingBot
128
+
129
+ myBot = WritingBot(
130
+ model="azure-openai/my-gpt5",
131
+ folder_to_mount="code"
132
+ )
133
+
134
+ myBot.run("When I am running missing_colon.py I am getting SyntaxError: invalid syntax. Fix the error and make sure the code runs without any errors.", timeout_in_seconds=600)
135
+ ```
136
+
137
+ The `WritingBot` will read and write the files inside `code` folder based on specific instructions given to the bot.
138
+
139
+ ## ⚙️ How it works
140
+
141
+
142
+ ![Overall Architecture Image](./docs/images/overall_architecture.png)
143
+
144
+ The MicroBots create a containerized environment and mount the specified directory with restricting the permissions to read-only or read/write based on Bot used. It ensures that the AI agents operate within defined boundaries which enhances security and control over code modifications as well as protecting the local environment.
@@ -0,0 +1,96 @@
1
+ # 🤖 Microbots
2
+
3
+ MicroBots is a lightweight, extensible AI agent for code comprehension and controlled file edits. It integrates cleanly
4
+ into automation pipelines, mounting a target directory with explicit read-only or read/write modes so LLMs can safely
5
+ inspect, refactor, or generate files with least‑privilege access.
6
+
7
+
8
+ ```py
9
+ from microbots import WritingBot
10
+
11
+ myWritingBot = WritingBot(
12
+ model="azure-openai/my-gpt5", # model format : <provider/deployment_model_name>
13
+ folder_to_mount=str("myReactApp"),
14
+ )
15
+
16
+ data = myWritingBot.run("""when doing npm run build, I get an error.
17
+ Fix the error and make sure the build is successful.""", timeout_in_seconds=600)
18
+ print(data.results)
19
+ ```
20
+
21
+ ## ⚠️ Project Status: Highly Unstable
22
+ This project is currently **under active development** and is considered **highly unstable**. Features, APIs, and internal structures are subject to change without notice, and unexpected behavior may occur.
23
+ Please **use with caution** in production environments.
24
+
25
+ ## 🚀 How to install
26
+
27
+ ### Pre-requisites
28
+
29
+ - Docker
30
+ - AI LLM Provider and API Key
31
+
32
+ ### Install Microbots
33
+
34
+ ```bash
35
+ pip install microbots
36
+ ```
37
+
38
+
39
+ ## ✨LLM Support
40
+
41
+ Azure OpenAI Models - Add the below environment variables in a `.env` file in the root of your application
42
+
43
+ ```env
44
+ OPEN_AI_END_POINT=XXXXXXXXXXXXXXXXXXXXXXXXXX
45
+ OPEN_AI_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
46
+ ```
47
+
48
+ ## 🤖 Bots & Usage Examples
49
+
50
+ Pre-requisite for the below example code of Bots:
51
+ From the root of your application, Create a folder called `code` inside which clone the repo `https://github.com/swe-agent/test-repo/`. Now run the code
52
+
53
+
54
+ ### 📖 ReadingBot
55
+
56
+
57
+ ```py
58
+ from microbots import ReadingBot
59
+
60
+ myBot = ReadingBot(
61
+ model="azure-openai/my-gpt5",
62
+ folder_to_mount="code"
63
+ )
64
+
65
+ runResult = myBot.run("When I am running missing_colon.py I am getting SyntaxError: invalid syntax. Find the error and explain me what is the error", timeout_in_seconds=600)
66
+ print(runResult)
67
+
68
+ ```
69
+
70
+ The `ReadingBot` will read the files inside `code` folder and will extract information based on specific instructions given to the bot.
71
+
72
+
73
+ ### ✍️ WritingBot
74
+
75
+ Pre-requisite for the example code:
76
+ From the root the application, Create a folder called `code` inside which clone the repo `https://github.com/swe-agent/test-repo/`. Now run the code
77
+
78
+ ```py
79
+ from microbots import WritingBot
80
+
81
+ myBot = WritingBot(
82
+ model="azure-openai/my-gpt5",
83
+ folder_to_mount="code"
84
+ )
85
+
86
+ myBot.run("When I am running missing_colon.py I am getting SyntaxError: invalid syntax. Fix the error and make sure the code runs without any errors.", timeout_in_seconds=600)
87
+ ```
88
+
89
+ The `WritingBot` will read and write the files inside `code` folder based on specific instructions given to the bot.
90
+
91
+ ## ⚙️ How it works
92
+
93
+
94
+ ![Overall Architecture Image](./docs/images/overall_architecture.png)
95
+
96
+ The MicroBots create a containerized environment and mount the specified directory with restricting the permissions to read-only or read/write based on Bot used. It ensures that the AI agents operate within defined boundaries which enhances security and control over code modifications as well as protecting the local environment.
@@ -0,0 +1,64 @@
1
+ # Bot
2
+ Bot will accept "name", "permission" and "system_prompt", "llm", "environment", "additional_tools", "folder_to_mount
3
+ "Bot_type" => "READING_Bot" | "WRITING_Bot" | "BROWSING_Bot" | "CUSTOM_Bot"
4
+ "permission" => "READ_ONLY" | "READ_WRITE" (optional field)
5
+ "model_name" => { // Based on provider the Bot will instantiate llm instance
6
+ provider: "openai"
7
+ model: "gpt-4" | "gpt-3.5-turbo" | "claude",
8
+ }
9
+ <!-- LLM should not give any interactive commands like vim -->
10
+ "system_prompt" => string (Optional argument)
11
+ when not passed will create default system prompt based on Bot_type and permission
12
+ "environment" => environment instance (Optional argument)
13
+ when not passed will create docker environment with default arguments as per PERMISSION based on Bot_type
14
+ and tools will be installed one by one after environment creation
15
+ "additional_tools" => array of tool definitions (Optional argument)
16
+ when passed will create docker environment with default arguments as per PERMISSION and with default "tool" installations with additional tools installed
17
+
18
+ Bot will expose "run" method which will accept a "task", "timeout" and "max_iterations"
19
+ will call llm task as user_prompt and get response
20
+ get the response and call environment execute method with the command
21
+ get the output and call llm with previous_communications and get the response
22
+ repeat the above steps until llm response is final answer or max_iterations reached or timeout reached
23
+ ensure to log every communication between llm and environment
24
+
25
+ <!-- In the end llm should provide status "DONE" status in one object property with results in another property -->
26
+
27
+ will return { status: bool, result: string, error: string | None, log: log of communication between llm and environment }
28
+
29
+
30
+
31
+ # environment
32
+ environment will accept "folder_to_mount", "permission"
33
+ "folder_to_mount" => string (path to the folder to mount inside docker)
34
+ "permission" => "READ_ONLY" | "READ_WRITE"
35
+
36
+ environment will expose "execute" method which will accept command, timeout and return {
37
+ return_code: int,
38
+ output: string,
39
+ error: string | None
40
+ }
41
+ will execute the command inside the docker with a default timeout and return the output
42
+ environment will expose "kill" method which will kill the environment
43
+ will stop the docker container and remove it
44
+
45
+ # llm class
46
+
47
+ llm will accept "system_prompt" and "deployment_name"
48
+ system_prompt => string,
49
+ deployment_name => string (like my-custom-gpt5-Bot)
50
+
51
+ llm will expose ask method which will accept "message" and will return llm response in particular json format
52
+ the method will append each message to messages array and each response also will be appended to the messages array,
53
+ llm will expose clear history method which will clear the messages array except the system prompt
54
+
55
+
56
+ # tool definition singleton class
57
+ tool definition will accept "installation_command", "verification_command", "usage_instructions"
58
+
59
+ Whenever I am writing code
60
+ ```py
61
+ import logging
62
+ logger = logging.getLogger(__name__)
63
+ logger.info("This is an info message")
64
+ ```
@@ -1,9 +1,9 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0", "wheel"]
2
+ requires = ["setuptools>=61.0", "wheel", "setuptools-scm[toml]>=6.2"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
- name = "microbots" # package name on PyPI (unique)
6
+ name = "microbots"
7
7
  dynamic = ["version", "dependencies"]
8
8
  description = "container-based autonomous agent framework"
9
9
  readme = "README.md"
@@ -23,7 +23,9 @@ requires-python = ">=3.11"
23
23
 
24
24
  [tool.setuptools.dynamic]
25
25
  dependencies = { file = ["requirements.txt"] }
26
- version = {attr ="microbots.__version__"}
26
+
27
+ [tool.setuptools_scm]
28
+ # This tells setuptools-scm to get version from git tags
27
29
 
28
30
  [tool.setuptools.packages.find]
29
31
  where = ["src"]
@@ -0,0 +1,4 @@
1
+ [pytest]
2
+ markers =
3
+ docker: marks tests that require a running Docker daemon and pull container images
4
+