agens 0.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.
Files changed (164) hide show
  1. agens-0.1.0/.dockerignore +36 -0
  2. agens-0.1.0/Dockerfile +51 -0
  3. agens-0.1.0/Dockerfile.dev +41 -0
  4. agens-0.1.0/LICENSE +21 -0
  5. agens-0.1.0/MANIFEST.in +8 -0
  6. agens-0.1.0/PKG-INFO +239 -0
  7. agens-0.1.0/README.md +168 -0
  8. agens-0.1.0/docker-compose.yml +89 -0
  9. agens-0.1.0/docs/architecture.md +88 -0
  10. agens-0.1.0/docs/configuration.md +153 -0
  11. agens-0.1.0/docs/development.md +128 -0
  12. agens-0.1.0/docs/installation.md +280 -0
  13. agens-0.1.0/docs/tools.md +158 -0
  14. agens-0.1.0/pyproject.toml +80 -0
  15. agens-0.1.0/scripts/install.ps1 +185 -0
  16. agens-0.1.0/scripts/install.sh +199 -0
  17. agens-0.1.0/setup.cfg +4 -0
  18. agens-0.1.0/src/agens/__init__.py +12 -0
  19. agens-0.1.0/src/agens/__main__.py +6 -0
  20. agens-0.1.0/src/agens/_bundled_assets/__init__.py +12 -0
  21. agens-0.1.0/src/agens/_bundled_assets/knowledge/__init__.py +1 -0
  22. agens-0.1.0/src/agens/_bundled_assets/knowledge/agent_capabilities.md +29 -0
  23. agens-0.1.0/src/agens/_bundled_assets/knowledge/telegram_setup.md +22 -0
  24. agens-0.1.0/src/agens/_bundled_assets/knowledge/tools.md +27 -0
  25. agens-0.1.0/src/agens/_bundled_assets/knowledge/tui_setup.md +31 -0
  26. agens-0.1.0/src/agens/app_bootstrap.py +24 -0
  27. agens-0.1.0/src/agens/cli.py +12 -0
  28. agens-0.1.0/src/agens/main.py +1192 -0
  29. agens-0.1.0/src/agens.egg-info/PKG-INFO +239 -0
  30. agens-0.1.0/src/agens.egg-info/SOURCES.txt +162 -0
  31. agens-0.1.0/src/agens.egg-info/dependency_links.txt +1 -0
  32. agens-0.1.0/src/agens.egg-info/entry_points.txt +2 -0
  33. agens-0.1.0/src/agens.egg-info/requires.txt +28 -0
  34. agens-0.1.0/src/agens.egg-info/top_level.txt +11 -0
  35. agens-0.1.0/src/agent/__init__.py +0 -0
  36. agens-0.1.0/src/agent/agent.py +749 -0
  37. agens-0.1.0/src/agent/factory.py +77 -0
  38. agens-0.1.0/src/app_bootstrap.py +7 -0
  39. agens-0.1.0/src/cli.py +10 -0
  40. agens-0.1.0/src/config/__init__.py +0 -0
  41. agens-0.1.0/src/config/bootstrap.py +181 -0
  42. agens-0.1.0/src/config/config_manager.py +101 -0
  43. agens-0.1.0/src/config/logging.py +218 -0
  44. agens-0.1.0/src/config/runtime.py +319 -0
  45. agens-0.1.0/src/config/settings.py +73 -0
  46. agens-0.1.0/src/config/workspace.py +30 -0
  47. agens-0.1.0/src/core/__init__.py +0 -0
  48. agens-0.1.0/src/core/model_catalog.py +61 -0
  49. agens-0.1.0/src/core/registry.py +33 -0
  50. agens-0.1.0/src/core/tool_groups.py +53 -0
  51. agens-0.1.0/src/core/tool_interface.py +24 -0
  52. agens-0.1.0/src/core/types.py +93 -0
  53. agens-0.1.0/src/db/__init__.py +17 -0
  54. agens-0.1.0/src/db/database.py +59 -0
  55. agens-0.1.0/src/db/init.py +239 -0
  56. agens-0.1.0/src/db/migrations/__init__.py +1 -0
  57. agens-0.1.0/src/db/migrations/env.py +71 -0
  58. agens-0.1.0/src/db/migrations/script.py.mako +28 -0
  59. agens-0.1.0/src/db/migrations/versions/001_initial_migration.py +41 -0
  60. agens-0.1.0/src/db/migrations/versions/2349849567d7_feat_add_settings_table_with_only_one_.py +37 -0
  61. agens-0.1.0/src/db/migrations/versions/2d1f4e7a6c9b_backfill_session_message_created_at_utc.py +36 -0
  62. agens-0.1.0/src/db/migrations/versions/6aa5b8df0d23_add_model_cooldowns.py +32 -0
  63. agens-0.1.0/src/db/migrations/versions/740c09128175_remove_cooldown_until_consecutive_.py +36 -0
  64. agens-0.1.0/src/db/migrations/versions/8f6c1e2b9d3a_make_session_message_created_at_tzaware.py +64 -0
  65. agens-0.1.0/src/db/migrations/versions/__init__.py +1 -0
  66. agens-0.1.0/src/db/migrations/versions/b729aec83ffb_feat_add_schedule_model.py +59 -0
  67. agens-0.1.0/src/db/migrations/versions/c4e9a7b2d1f0_add_schedule_events.py +39 -0
  68. agens-0.1.0/src/db/migrations/versions/fb4736f26bf9_add_aki_key_table.py +55 -0
  69. agens-0.1.0/src/db/models.py +126 -0
  70. agens-0.1.0/src/db/repositories/__init__.py +17 -0
  71. agens-0.1.0/src/db/repositories/api_key.py +297 -0
  72. agens-0.1.0/src/db/repositories/settings.py +47 -0
  73. agens-0.1.0/src/db/repository.py +72 -0
  74. agens-0.1.0/src/interfaces/__init__.py +0 -0
  75. agens-0.1.0/src/interfaces/api_key_state.py +66 -0
  76. agens-0.1.0/src/interfaces/cli/__init__.py +0 -0
  77. agens-0.1.0/src/interfaces/dormant_agent.py +35 -0
  78. agens-0.1.0/src/interfaces/telegram/__init__.py +0 -0
  79. agens-0.1.0/src/interfaces/telegram/bot.py +137 -0
  80. agens-0.1.0/src/interfaces/telegram/handlers.py +1274 -0
  81. agens-0.1.0/src/interfaces/telegram/prefs.py +56 -0
  82. agens-0.1.0/src/interfaces/tui/__init__.py +5 -0
  83. agens-0.1.0/src/interfaces/tui/app.py +721 -0
  84. agens-0.1.0/src/interfaces/tui/commands.py +130 -0
  85. agens-0.1.0/src/interfaces/tui/history.py +40 -0
  86. agens-0.1.0/src/interfaces/tui/prefs.py +58 -0
  87. agens-0.1.0/src/interfaces/tui/runner.py +26 -0
  88. agens-0.1.0/src/interfaces/tui/theme.py +768 -0
  89. agens-0.1.0/src/interfaces/tui/widgets/__init__.py +27 -0
  90. agens-0.1.0/src/interfaces/tui/widgets/api_key_manage.py +394 -0
  91. agens-0.1.0/src/interfaces/tui/widgets/chat_view.py +67 -0
  92. agens-0.1.0/src/interfaces/tui/widgets/command_palette.py +79 -0
  93. agens-0.1.0/src/interfaces/tui/widgets/header.py +63 -0
  94. agens-0.1.0/src/interfaces/tui/widgets/horizontal_rule.py +13 -0
  95. agens-0.1.0/src/interfaces/tui/widgets/input_row.py +82 -0
  96. agens-0.1.0/src/interfaces/tui/widgets/messages.py +49 -0
  97. agens-0.1.0/src/interfaces/tui/widgets/model_select.py +326 -0
  98. agens-0.1.0/src/interfaces/tui/widgets/no_api_keys.py +86 -0
  99. agens-0.1.0/src/interfaces/tui/widgets/spinner.py +48 -0
  100. agens-0.1.0/src/interfaces/tui/widgets/sudo_prompt.py +77 -0
  101. agens-0.1.0/src/interfaces/tui/widgets/tool_block.py +117 -0
  102. agens-0.1.0/src/interfaces/tui/widgets/tool_group.py +65 -0
  103. agens-0.1.0/src/interfaces/tui/widgets/tool_group_select.py +123 -0
  104. agens-0.1.0/src/interfaces/tui/widgets/welcome_screen.py +65 -0
  105. agens-0.1.0/src/interfaces/web/__init__.py +0 -0
  106. agens-0.1.0/src/interfaces/web/api/__init__.py +1 -0
  107. agens-0.1.0/src/interfaces/web/api/api_keys/__init__.py +3 -0
  108. agens-0.1.0/src/interfaces/web/api/api_keys/router.py +103 -0
  109. agens-0.1.0/src/interfaces/web/api/api_keys/schemas.py +34 -0
  110. agens-0.1.0/src/interfaces/web/api/chat/__init__.py +1 -0
  111. agens-0.1.0/src/interfaces/web/api/chat/router.py +182 -0
  112. agens-0.1.0/src/interfaces/web/api/chat/schemas.py +31 -0
  113. agens-0.1.0/src/interfaces/web/api/models/__init__.py +1 -0
  114. agens-0.1.0/src/interfaces/web/api/models/router.py +120 -0
  115. agens-0.1.0/src/interfaces/web/api/models/schemas.py +31 -0
  116. agens-0.1.0/src/interfaces/web/api/prefs/__init__.py +1 -0
  117. agens-0.1.0/src/interfaces/web/api/prefs/router.py +19 -0
  118. agens-0.1.0/src/interfaces/web/api/prefs/schemas.py +11 -0
  119. agens-0.1.0/src/interfaces/web/api/sessions/__init__.py +1 -0
  120. agens-0.1.0/src/interfaces/web/api/sessions/router.py +50 -0
  121. agens-0.1.0/src/interfaces/web/api/sessions/schemas.py +45 -0
  122. agens-0.1.0/src/interfaces/web/api/settings/__init__.py +1 -0
  123. agens-0.1.0/src/interfaces/web/api/settings/router.py +42 -0
  124. agens-0.1.0/src/interfaces/web/api/settings/schemas.py +13 -0
  125. agens-0.1.0/src/interfaces/web/api/status/__init__.py +0 -0
  126. agens-0.1.0/src/interfaces/web/api/status/router.py +31 -0
  127. agens-0.1.0/src/interfaces/web/app.py +197 -0
  128. agens-0.1.0/src/interfaces/web/dist/assets/index-CBl6RRRQ.css +1 -0
  129. agens-0.1.0/src/interfaces/web/dist/assets/index-CRrk8pRe.js +69 -0
  130. agens-0.1.0/src/interfaces/web/dist/assets/logo-Byab_sjE.svg +1 -0
  131. agens-0.1.0/src/interfaces/web/dist/index.html +14 -0
  132. agens-0.1.0/src/interfaces/web/dist/logo.svg +1 -0
  133. agens-0.1.0/src/interfaces/web/prefs.py +31 -0
  134. agens-0.1.0/src/llm/__init__.py +13 -0
  135. agens-0.1.0/src/llm/catalog.py +275 -0
  136. agens-0.1.0/src/llm/client.py +270 -0
  137. agens-0.1.0/src/llm/errors.py +131 -0
  138. agens-0.1.0/src/llm/providers.py +67 -0
  139. agens-0.1.0/src/llm/router.py +74 -0
  140. agens-0.1.0/src/llm/stream.py +326 -0
  141. agens-0.1.0/src/main.py +13 -0
  142. agens-0.1.0/src/memory/__init__.py +0 -0
  143. agens-0.1.0/src/memory/manager.py +43 -0
  144. agens-0.1.0/src/planner/__init__.py +0 -0
  145. agens-0.1.0/src/planner/planner.py +5 -0
  146. agens-0.1.0/src/planner/prompt_builder.py +192 -0
  147. agens-0.1.0/src/services/__init__.py +0 -0
  148. agens-0.1.0/src/services/api_key_manager.py +190 -0
  149. agens-0.1.0/src/services/settings_service.py +30 -0
  150. agens-0.1.0/src/tools/__init__.py +0 -0
  151. agens-0.1.0/src/tools/file_edit.py +55 -0
  152. agens-0.1.0/src/tools/file_read.py +354 -0
  153. agens-0.1.0/src/tools/file_write.py +39 -0
  154. agens-0.1.0/src/tools/find.py +161 -0
  155. agens-0.1.0/src/tools/grep.py +172 -0
  156. agens-0.1.0/src/tools/list_directory.py +156 -0
  157. agens-0.1.0/src/tools/schedule_add.py +75 -0
  158. agens-0.1.0/src/tools/schedule_delete.py +57 -0
  159. agens-0.1.0/src/tools/schedule_list.py +93 -0
  160. agens-0.1.0/src/tools/schedule_update.py +87 -0
  161. agens-0.1.0/src/tools/shell_command.py +317 -0
  162. agens-0.1.0/src/tools/update_config.py +68 -0
  163. agens-0.1.0/src/tools/web_fetch.py +158 -0
  164. agens-0.1.0/src/tools/web_search.py +151 -0
@@ -0,0 +1,36 @@
1
+ .git
2
+ .agents
3
+ .codex
4
+ .venv
5
+ __pycache__/
6
+ *.py[cod]
7
+ *.egg-info/
8
+ build/
9
+ dist/
10
+ wheels/
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+ .coverage
15
+ htmlcov/
16
+
17
+ .env
18
+ *.local
19
+ logs/
20
+ data/
21
+ app.db
22
+
23
+ frontend/node_modules/
24
+ frontend/dist/
25
+ frontend/dist-ssr/
26
+ npm-debug.log*
27
+ yarn-debug.log*
28
+ yarn-error.log*
29
+ pnpm-debug.log*
30
+
31
+ .DS_Store
32
+ .idea/
33
+ .vscode/
34
+ todos/
35
+ test.py
36
+ example.py
agens-0.1.0/Dockerfile ADDED
@@ -0,0 +1,51 @@
1
+ # syntax=docker/dockerfile:1.7
2
+
3
+ FROM node:24-bookworm-slim AS frontend-builder
4
+ WORKDIR /app/frontend
5
+ COPY frontend/package.json frontend/package-lock.json ./
6
+ RUN npm ci
7
+ COPY frontend/ ./
8
+ RUN npm run build
9
+
10
+ FROM python:3.13-slim AS wheel-builder
11
+ ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
12
+ PIP_NO_CACHE_DIR=1 \
13
+ PYTHONDONTWRITEBYTECODE=1 \
14
+ PYTHONUNBUFFERED=1
15
+ WORKDIR /app
16
+ RUN apt-get update \
17
+ && apt-get install -y --no-install-recommends build-essential \
18
+ && rm -rf /var/lib/apt/lists/*
19
+ COPY pyproject.toml MANIFEST.in README.md ./
20
+ COPY src/ ./src/
21
+ COPY --from=frontend-builder /app/src/interfaces/web/dist ./src/interfaces/web/dist
22
+ RUN pip wheel --wheel-dir /wheels .
23
+
24
+ FROM python:3.13-slim AS runtime
25
+ ENV PYTHONDONTWRITEBYTECODE=1 \
26
+ PYTHONUNBUFFERED=1 \
27
+ PIP_DISABLE_PIP_VERSION_CHECK=1 \
28
+ PRODUCTION=true \
29
+ WEB_HOST=0.0.0.0 \
30
+ WEB_PORT=8000 \
31
+ XDG_CONFIG_HOME=/data/config \
32
+ DATABASE_URL=sqlite+aiosqlite:////data/db/agens.db \
33
+ WORKSPACE_ROOT=/workspace
34
+
35
+ RUN groupadd --system --gid 10001 agens \
36
+ && useradd --system --uid 10001 --gid agens --home-dir /home/agens --create-home agens \
37
+ && mkdir -p /data/config /data/db /data/memories /data/runtime /workspace \
38
+ && chown -R agens:agens /data /workspace /home/agens
39
+
40
+ WORKDIR /app
41
+ COPY --from=wheel-builder /wheels /wheels
42
+ RUN pip install --no-index --find-links=/wheels agens \
43
+ && rm -rf /wheels
44
+
45
+ USER agens
46
+ EXPOSE 8000
47
+ VOLUME ["/data/config", "/data/db", "/data/memories", "/data/runtime", "/workspace"]
48
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
49
+ CMD python -c "from urllib.request import urlopen; urlopen('http://127.0.0.1:8000/health', timeout=3).read()" || exit 1
50
+
51
+ CMD ["agens", "_run-interfaces", "web"]
@@ -0,0 +1,41 @@
1
+ # syntax=docker/dockerfile:1.7
2
+
3
+ FROM python:3.13-slim AS dev
4
+ ENV PYTHONDONTWRITEBYTECODE=1 \
5
+ PYTHONUNBUFFERED=1 \
6
+ PIP_DISABLE_PIP_VERSION_CHECK=1 \
7
+ PRODUCTION=false \
8
+ WEB_HOST=0.0.0.0 \
9
+ WEB_PORT=8000 \
10
+ FRONTEND_LINK=http://localhost:5173 \
11
+ XDG_CONFIG_HOME=/data/config \
12
+ DATABASE_URL=sqlite+aiosqlite:////data/db/agens.db \
13
+ WORKSPACE_ROOT=/workspace
14
+
15
+ RUN apt-get update \
16
+ && apt-get install -y --no-install-recommends curl ca-certificates nodejs npm build-essential \
17
+ && rm -rf /var/lib/apt/lists/* \
18
+ && groupadd --system --gid 10001 agens \
19
+ && useradd --system --uid 10001 --gid agens --home-dir /home/agens --create-home agens \
20
+ && mkdir -p /app /data/config /data/db /data/memories /data/runtime /workspace \
21
+ && chown -R agens:agens /app /data /workspace /home/agens
22
+
23
+ WORKDIR /app
24
+ COPY pyproject.toml MANIFEST.in README.md ./
25
+ COPY src/ ./src/
26
+ RUN pip install -e .
27
+
28
+ WORKDIR /app/frontend
29
+ COPY frontend/package.json frontend/package-lock.json ./
30
+ RUN npm ci
31
+
32
+ WORKDIR /app
33
+ COPY frontend/ ./frontend/
34
+
35
+ USER agens
36
+ EXPOSE 8000 5173
37
+ VOLUME ["/data/config", "/data/db", "/data/memories", "/data/runtime", "/workspace"]
38
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
39
+ CMD python -c "from urllib.request import urlopen; urlopen('http://127.0.0.1:8000/health', timeout=3).read()" || exit 1
40
+
41
+ CMD ["sh", "-c", "cd /app/frontend && npm run dev -- --host 0.0.0.0 & cd /app && agens _run-interfaces web"]
agens-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kayesFerdous
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ include README.md
2
+ include Dockerfile Dockerfile.dev docker-compose.yml .dockerignore
3
+ graft docs
4
+ graft scripts
5
+ graft src
6
+ prune src/**/__pycache__
7
+ global-exclude __pycache__/*
8
+ global-exclude *.py[cod]
agens-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,239 @@
1
+ Metadata-Version: 2.4
2
+ Name: agens
3
+ Version: 0.1.0
4
+ Summary: An interface-agnostic AI agent platform that executes complex system-level and web tasks through a centralized ReAct orchestration engine.
5
+ Author: kayesFerdous
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 kayesFerdous
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
+ Project-URL: Homepage, https://github.com/kayesFerdous/agens
28
+ Project-URL: Repository, https://github.com/kayesFerdous/agens.git
29
+ Project-URL: Bug Tracker, https://github.com/kayesFerdous/agens/issues
30
+ Project-URL: Documentation, https://github.com/kayesFerdous/agens#readme
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: Intended Audience :: System Administrators
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: OS Independent
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.13
38
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
39
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
40
+ Requires-Python: >=3.13
41
+ Description-Content-Type: text/markdown
42
+ License-File: LICENSE
43
+ Requires-Dist: aiosqlite>=0.20.0
44
+ Requires-Dist: alembic>=1.13.0
45
+ Requires-Dist: beautifulsoup4>=4.14.3
46
+ Requires-Dist: cryptography>=46.0.5
47
+ Requires-Dist: ddgs>=9.14.4
48
+ Requires-Dist: fastapi>=0.115.0
49
+ Requires-Dist: httpx>=0.28.1
50
+ Requires-Dist: markdown>=3.10.2
51
+ Requires-Dist: openai>=2.37.0
52
+ Requires-Dist: platformdirs>=4.9.6
53
+ Requires-Dist: pydantic>=2.12.5
54
+ Requires-Dist: pydantic-settings>=2.13.1
55
+ Requires-Dist: python-dateutil>=2.9.0.post0
56
+ Requires-Dist: python-telegram-bot>=22.7
57
+ Requires-Dist: sqlalchemy[asyncio]>=2.0.48
58
+ Requires-Dist: textual>=0.60.0
59
+ Requires-Dist: typer>=0.25.1
60
+ Requires-Dist: uvicorn[standard]>=0.34.0
61
+ Provides-Extra: dev
62
+ Requires-Dist: black>=24.0.0; extra == "dev"
63
+ Requires-Dist: ruff>=0.3.0; extra == "dev"
64
+ Requires-Dist: mypy>=1.9.0; extra == "dev"
65
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
66
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
67
+ Requires-Dist: build>=1.0.0; extra == "dev"
68
+ Requires-Dist: twine>=5.0.0; extra == "dev"
69
+ Requires-Dist: validate-pyproject>=0.16; extra == "dev"
70
+ Dynamic: license-file
71
+
72
+ <div align="center">
73
+
74
+ <img src="frontend/src/assets/logo.svg" alt="Agens Logo" width="180" />
75
+
76
+ # Agens
77
+
78
+ **An interface-agnostic AI agent platform that executes complex system-level and web tasks through a centralized ReAct orchestration engine.**
79
+
80
+ [![PyPI](https://img.shields.io/badge/pypi-placeholder-blue?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/agens/)
81
+ [![Python](https://img.shields.io/badge/python-%3E%3D3.13-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
82
+ [![License: MIT](https://img.shields.io/badge/license-MIT-22c55e?style=flat-square)](./LICENSE)
83
+ [![Interfaces](https://img.shields.io/badge/interfaces-CLI%20%7C%20TUI%20%7C%20Web%20%7C%20Telegram-f97316?style=flat-square)](#interface-overview)
84
+
85
+ </div>
86
+
87
+ <div align="center">
88
+ <img src="assets/demo.gif" alt="Agens Multi-Tool Live Demo" width="700" style="border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); margin: 20px 0;" />
89
+ </div>
90
+
91
+ ---
92
+
93
+ Agens decouples stateful AI reasoning from delivery channels. A centralized agent engine (`agent.py`) coordinates session histories, tool execution routing, and provider-fallback logic — exposing a unified interface to thin transport-layer adapters. All client interfaces share the same SQLite database, memory, and configuration with zero context drift.
94
+
95
+ > **Agens is completely free to use.** The platform itself costs nothing — you only need a personal API key from any supported provider (Gemini, OpenAI, Groq, Cerebras, SiliconFlow, DeepSeek).
96
+
97
+ ---
98
+
99
+ ## Why Agens?
100
+
101
+ * 🧠 **Centralized Intelligence**: Decoupled Ports & Adapters (Hexagonal) architecture. All client interfaces share a single database, settings, and memories with zero context drift.
102
+ * 🔒 **Zero-Trust Key Security**: API keys are Fernet-encrypted at rest and decrypted purely in-memory. They are never saved in plaintext configuration files.
103
+ * 🔄 **Automatic Rate-Limit Cooldown**: Transparent key rotation and failover. If an API key hits a `429 Rate Limit`, Agens automatically shifts to the next available key and retries the request seamlessly.
104
+ * 🌐 **Free Native Tools**: Built-in DuckDuckGo web search and HTML page retrieval — zero external paid search API subscriptions required.
105
+ * 🛡️ **Layered Safety Controls**: Built-in Safety Mode gates dangerous subprocess executions, while local Textual TUI collects `sudo` credentials securely on-the-fly.
106
+
107
+ ---
108
+
109
+ ## 📚 Documentation Hub
110
+
111
+ Explore the detailed technical manuals and operational guides:
112
+
113
+ * 🚀 **[Installation & Setup](docs/installation.md)**: Native and containerized setups across Linux, macOS, and Windows.
114
+ * 🏗️ **[Architecture Deep Dive](docs/architecture.md)**: Learn about the Hexagonal Ports & Adapters layout, the ReAct stream loop, and key database connection designs.
115
+ * 🛠️ **[Tool System & Custom Tools](docs/tools.md)**: Explore the core tool directory, layered safety rules, and step-by-step custom tool development tutorials.
116
+ * ⚙️ **[Configuration & Key Management](docs/configuration.md)**: Deep dive into environments, user memory settings, encrypted API credentials, and automatic rate-limit cooldown algorithms.
117
+ * 💻 **[Developer & Contributor Manual](docs/development.md)**: Workspace setup guides, release packaging commands, custom interface implementation, and open-source contribution rules.
118
+
119
+ ---
120
+
121
+ ## Quick Start
122
+
123
+ ### 1. Install Agens
124
+ ```bash
125
+ pipx install agens
126
+ ```
127
+
128
+ ### 2. Register an API Key
129
+ ```bash
130
+ # agens apikey add <label> <provider> <api_key>
131
+ agens apikey add my-gemini gemini AIzaSyB...
132
+ ```
133
+
134
+ ### 3. Launch an Interface
135
+ ```bash
136
+ agens web # Web UI (Svelte 5) → http://localhost:8000
137
+ agens tui # Terminal UI Dashboard (Textual)
138
+ agens chat "List the contents of my workspace" # Single-line Typer CLI query
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Interface Overview
144
+
145
+ All interface adapters communicate with the exact same central brain and write to the same database. Prompt behavior and safety policies dynamically adjust depending on the interface:
146
+
147
+ | Interface | Launch Command | Core Capabilities | Concurrency Model |
148
+ | :--- | :--- | :--- | :--- |
149
+ | **CLI** | `agens chat "<msg>"` | One-shot queries, API key administration, safety overrides | Ephemeral process; runs one ReAct loop and exits |
150
+ | **Terminal UI (TUI)** | `agens tui [--session <id>]` | **Full feature parity with Web UI** (session handling, dynamic API key administration, provider model selection, granular tool group toggles) + secure local `sudo` password collection | Stateful Textual app; blocks terminal during execution |
151
+ | **Web UI** | `agens web` | Svelte 5 + FastAPI SPA with SSE streaming, interactive model picker, encrypted key management, granular tool settings & status blocks | Client-server; tokens stream live via Server-Sent Events |
152
+ | **Telegram Bot** | `agens telegram` | Remote message-based assistant via `python-telegram-bot`, polling + webhooks | Long-polling or webhook updater; edits messages sequentially to stay within Telegram rate limits |
153
+
154
+ ---
155
+
156
+ ## 🎨 Visual Showcase
157
+
158
+ Experience Agens' premium, interface-agnostic design with absolute feature parity:
159
+
160
+ ### 🌐 Web UI Dashboard (`agens web`)
161
+ The modern Web UI features real-time SSE streaming, interactive model selection, active key management, and fine-grained tool settings.
162
+
163
+ <div align="center">
164
+ <table border="0">
165
+ <tr>
166
+ <td width="50%" align="center">
167
+ <b>Workspace Chat</b><br/>
168
+ <img src="assets/web-home.png" alt="Web UI Home" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
169
+ </td>
170
+ <td width="50%" align="center">
171
+ <b>Streaming Message with Tool Output</b><br/>
172
+ <img src="assets/web-message.png" alt="Web Streaming & Tool Execution" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
173
+ </td>
174
+ </tr>
175
+ <tr>
176
+ <td width="50%" align="center">
177
+ <b>Decoupled Provider Model Selection</b><br/>
178
+ <img src="assets/web-model-selection.png" alt="Interactive Model Selector" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
179
+ </td>
180
+ <td width="50%" align="center">
181
+ <b>Granular Tool Control Panel</b><br/>
182
+ <img src="assets/web-tool-group.png" alt="Tool Permissions Dashboard" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
183
+ </td>
184
+ </tr>
185
+ </table>
186
+ </div>
187
+
188
+ ### 💻 Terminal UI (TUI) Dashboard (`agens tui`)
189
+ For developers working in terminal or remote SSH environments, the Textual-powered TUI provides **absolute feature parity with the Web UI**. It supports the complete suite of administration controls (adding/managing Fernet-encrypted API keys, selecting providers and fallback models, toggling granular tool group permissions, and safety controls) alongside dynamic tool status animations and secure local `sudo` handling.
190
+
191
+ <div align="center">
192
+ <table border="0">
193
+ <tr>
194
+ <td width="50%" align="center">
195
+ <b>Interactive TUI Home Dashboard</b><br/>
196
+ <img src="assets/tui-home.png" alt="TUI Dashboard" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
197
+ </td>
198
+ <td width="50%" align="center">
199
+ <b>Stateful TUI Chat Session</b><br/>
200
+ <img src="assets/tui-message.png" alt="TUI Conversation" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
201
+ </td>
202
+ </tr>
203
+ </table>
204
+ </div>
205
+
206
+ ---
207
+
208
+ ## Architecture Diagram
209
+
210
+ ```mermaid
211
+ graph TD
212
+ Input["User Input<br/>(Web · TUI · Telegram · CLI)"]
213
+ Adapter["Interface Adapter<br/>src/interfaces/"]
214
+ Agent["Agent Orchestrator<br/>src/agent/agent.py"]
215
+ DB[("Local SQLite<br/>src/db/")]
216
+ PromptBuilder["Prompt Builder<br/>src/planner/prompt_builder.py"]
217
+ LLMClient["LLM Client & Router<br/>src/llm/"]
218
+ ToolRegistry["Tool Registry<br/>src/core/registry.py"]
219
+ Tools["Tool Execution<br/>src/tools/"]
220
+
221
+ Input -->|triggers| Adapter
222
+ Adapter -->|".chat(message, session_id, channel)"| Agent
223
+ Agent -->|loads session history| DB
224
+ Agent -->|requests system prompt| PromptBuilder
225
+ PromptBuilder -->|reads settings & memories| DB
226
+ Agent -->|invokes ReAct loop| LLMClient
227
+ LLMClient -->|"chunks / tool_calls"| Agent
228
+ Agent -->|routes tool call| ToolRegistry
229
+ ToolRegistry -->|executes| Tools
230
+ Tools -->|returns result dict| Agent
231
+ Agent -->|"yields StreamEvent"| Adapter
232
+ Adapter -->|renders live output| Input
233
+ ```
234
+
235
+ ---
236
+
237
+ ## License
238
+
239
+ Agens is distributed under the [MIT License](LICENSE).
agens-0.1.0/README.md ADDED
@@ -0,0 +1,168 @@
1
+ <div align="center">
2
+
3
+ <img src="frontend/src/assets/logo.svg" alt="Agens Logo" width="180" />
4
+
5
+ # Agens
6
+
7
+ **An interface-agnostic AI agent platform that executes complex system-level and web tasks through a centralized ReAct orchestration engine.**
8
+
9
+ [![PyPI](https://img.shields.io/badge/pypi-placeholder-blue?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/agens/)
10
+ [![Python](https://img.shields.io/badge/python-%3E%3D3.13-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/)
11
+ [![License: MIT](https://img.shields.io/badge/license-MIT-22c55e?style=flat-square)](./LICENSE)
12
+ [![Interfaces](https://img.shields.io/badge/interfaces-CLI%20%7C%20TUI%20%7C%20Web%20%7C%20Telegram-f97316?style=flat-square)](#interface-overview)
13
+
14
+ </div>
15
+
16
+ <div align="center">
17
+ <img src="assets/demo.gif" alt="Agens Multi-Tool Live Demo" width="700" style="border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); margin: 20px 0;" />
18
+ </div>
19
+
20
+ ---
21
+
22
+ Agens decouples stateful AI reasoning from delivery channels. A centralized agent engine (`agent.py`) coordinates session histories, tool execution routing, and provider-fallback logic — exposing a unified interface to thin transport-layer adapters. All client interfaces share the same SQLite database, memory, and configuration with zero context drift.
23
+
24
+ > **Agens is completely free to use.** The platform itself costs nothing — you only need a personal API key from any supported provider (Gemini, OpenAI, Groq, Cerebras, SiliconFlow, DeepSeek).
25
+
26
+ ---
27
+
28
+ ## Why Agens?
29
+
30
+ * 🧠 **Centralized Intelligence**: Decoupled Ports & Adapters (Hexagonal) architecture. All client interfaces share a single database, settings, and memories with zero context drift.
31
+ * 🔒 **Zero-Trust Key Security**: API keys are Fernet-encrypted at rest and decrypted purely in-memory. They are never saved in plaintext configuration files.
32
+ * 🔄 **Automatic Rate-Limit Cooldown**: Transparent key rotation and failover. If an API key hits a `429 Rate Limit`, Agens automatically shifts to the next available key and retries the request seamlessly.
33
+ * 🌐 **Free Native Tools**: Built-in DuckDuckGo web search and HTML page retrieval — zero external paid search API subscriptions required.
34
+ * 🛡️ **Layered Safety Controls**: Built-in Safety Mode gates dangerous subprocess executions, while local Textual TUI collects `sudo` credentials securely on-the-fly.
35
+
36
+ ---
37
+
38
+ ## 📚 Documentation Hub
39
+
40
+ Explore the detailed technical manuals and operational guides:
41
+
42
+ * 🚀 **[Installation & Setup](docs/installation.md)**: Native and containerized setups across Linux, macOS, and Windows.
43
+ * 🏗️ **[Architecture Deep Dive](docs/architecture.md)**: Learn about the Hexagonal Ports & Adapters layout, the ReAct stream loop, and key database connection designs.
44
+ * 🛠️ **[Tool System & Custom Tools](docs/tools.md)**: Explore the core tool directory, layered safety rules, and step-by-step custom tool development tutorials.
45
+ * ⚙️ **[Configuration & Key Management](docs/configuration.md)**: Deep dive into environments, user memory settings, encrypted API credentials, and automatic rate-limit cooldown algorithms.
46
+ * 💻 **[Developer & Contributor Manual](docs/development.md)**: Workspace setup guides, release packaging commands, custom interface implementation, and open-source contribution rules.
47
+
48
+ ---
49
+
50
+ ## Quick Start
51
+
52
+ ### 1. Install Agens
53
+ ```bash
54
+ pipx install agens
55
+ ```
56
+
57
+ ### 2. Register an API Key
58
+ ```bash
59
+ # agens apikey add <label> <provider> <api_key>
60
+ agens apikey add my-gemini gemini AIzaSyB...
61
+ ```
62
+
63
+ ### 3. Launch an Interface
64
+ ```bash
65
+ agens web # Web UI (Svelte 5) → http://localhost:8000
66
+ agens tui # Terminal UI Dashboard (Textual)
67
+ agens chat "List the contents of my workspace" # Single-line Typer CLI query
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Interface Overview
73
+
74
+ All interface adapters communicate with the exact same central brain and write to the same database. Prompt behavior and safety policies dynamically adjust depending on the interface:
75
+
76
+ | Interface | Launch Command | Core Capabilities | Concurrency Model |
77
+ | :--- | :--- | :--- | :--- |
78
+ | **CLI** | `agens chat "<msg>"` | One-shot queries, API key administration, safety overrides | Ephemeral process; runs one ReAct loop and exits |
79
+ | **Terminal UI (TUI)** | `agens tui [--session <id>]` | **Full feature parity with Web UI** (session handling, dynamic API key administration, provider model selection, granular tool group toggles) + secure local `sudo` password collection | Stateful Textual app; blocks terminal during execution |
80
+ | **Web UI** | `agens web` | Svelte 5 + FastAPI SPA with SSE streaming, interactive model picker, encrypted key management, granular tool settings & status blocks | Client-server; tokens stream live via Server-Sent Events |
81
+ | **Telegram Bot** | `agens telegram` | Remote message-based assistant via `python-telegram-bot`, polling + webhooks | Long-polling or webhook updater; edits messages sequentially to stay within Telegram rate limits |
82
+
83
+ ---
84
+
85
+ ## 🎨 Visual Showcase
86
+
87
+ Experience Agens' premium, interface-agnostic design with absolute feature parity:
88
+
89
+ ### 🌐 Web UI Dashboard (`agens web`)
90
+ The modern Web UI features real-time SSE streaming, interactive model selection, active key management, and fine-grained tool settings.
91
+
92
+ <div align="center">
93
+ <table border="0">
94
+ <tr>
95
+ <td width="50%" align="center">
96
+ <b>Workspace Chat</b><br/>
97
+ <img src="assets/web-home.png" alt="Web UI Home" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
98
+ </td>
99
+ <td width="50%" align="center">
100
+ <b>Streaming Message with Tool Output</b><br/>
101
+ <img src="assets/web-message.png" alt="Web Streaming & Tool Execution" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
102
+ </td>
103
+ </tr>
104
+ <tr>
105
+ <td width="50%" align="center">
106
+ <b>Decoupled Provider Model Selection</b><br/>
107
+ <img src="assets/web-model-selection.png" alt="Interactive Model Selector" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
108
+ </td>
109
+ <td width="50%" align="center">
110
+ <b>Granular Tool Control Panel</b><br/>
111
+ <img src="assets/web-tool-group.png" alt="Tool Permissions Dashboard" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
112
+ </td>
113
+ </tr>
114
+ </table>
115
+ </div>
116
+
117
+ ### 💻 Terminal UI (TUI) Dashboard (`agens tui`)
118
+ For developers working in terminal or remote SSH environments, the Textual-powered TUI provides **absolute feature parity with the Web UI**. It supports the complete suite of administration controls (adding/managing Fernet-encrypted API keys, selecting providers and fallback models, toggling granular tool group permissions, and safety controls) alongside dynamic tool status animations and secure local `sudo` handling.
119
+
120
+ <div align="center">
121
+ <table border="0">
122
+ <tr>
123
+ <td width="50%" align="center">
124
+ <b>Interactive TUI Home Dashboard</b><br/>
125
+ <img src="assets/tui-home.png" alt="TUI Dashboard" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
126
+ </td>
127
+ <td width="50%" align="center">
128
+ <b>Stateful TUI Chat Session</b><br/>
129
+ <img src="assets/tui-message.png" alt="TUI Conversation" width="100%" style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);" />
130
+ </td>
131
+ </tr>
132
+ </table>
133
+ </div>
134
+
135
+ ---
136
+
137
+ ## Architecture Diagram
138
+
139
+ ```mermaid
140
+ graph TD
141
+ Input["User Input<br/>(Web · TUI · Telegram · CLI)"]
142
+ Adapter["Interface Adapter<br/>src/interfaces/"]
143
+ Agent["Agent Orchestrator<br/>src/agent/agent.py"]
144
+ DB[("Local SQLite<br/>src/db/")]
145
+ PromptBuilder["Prompt Builder<br/>src/planner/prompt_builder.py"]
146
+ LLMClient["LLM Client & Router<br/>src/llm/"]
147
+ ToolRegistry["Tool Registry<br/>src/core/registry.py"]
148
+ Tools["Tool Execution<br/>src/tools/"]
149
+
150
+ Input -->|triggers| Adapter
151
+ Adapter -->|".chat(message, session_id, channel)"| Agent
152
+ Agent -->|loads session history| DB
153
+ Agent -->|requests system prompt| PromptBuilder
154
+ PromptBuilder -->|reads settings & memories| DB
155
+ Agent -->|invokes ReAct loop| LLMClient
156
+ LLMClient -->|"chunks / tool_calls"| Agent
157
+ Agent -->|routes tool call| ToolRegistry
158
+ ToolRegistry -->|executes| Tools
159
+ Tools -->|returns result dict| Agent
160
+ Agent -->|"yields StreamEvent"| Adapter
161
+ Adapter -->|renders live output| Input
162
+ ```
163
+
164
+ ---
165
+
166
+ ## License
167
+
168
+ Agens is distributed under the [MIT License](LICENSE).
@@ -0,0 +1,89 @@
1
+ services:
2
+ agens:
3
+ build:
4
+ context: .
5
+ dockerfile: Dockerfile
6
+ image: agens:latest
7
+ restart: unless-stopped
8
+ ports:
9
+ - "${AGENS_WEB_PORT:-8000}:8000"
10
+ environment:
11
+ PRODUCTION: "true"
12
+ WEB_HOST: "0.0.0.0"
13
+ WEB_PORT: "8000"
14
+ XDG_CONFIG_HOME: "/data/config"
15
+ DATABASE_URL: "sqlite+aiosqlite:////data/db/agens.db"
16
+ WORKSPACE_ROOT: "/workspace"
17
+ AGENS_ENV_FILE: "${AGENS_ENV_FILE:-}"
18
+ DEFAULT_PROVIDER: "${DEFAULT_PROVIDER:-gemini}"
19
+ DEFAULT_MODEL: "${DEFAULT_MODEL:-gemini-2.5-flash-lite}"
20
+ volumes:
21
+ - agens_config:/data/config
22
+ - agens_database:/data/db
23
+ - agens_memories:/data/memories
24
+ - agens_runtime:/data/runtime
25
+ - agens_workspace:/workspace
26
+ healthcheck:
27
+ test:
28
+ [
29
+ "CMD",
30
+ "python",
31
+ "-c",
32
+ "from urllib.request import urlopen; urlopen('http://127.0.0.1:8000/health', timeout=3).read()",
33
+ ]
34
+ interval: 30s
35
+ timeout: 5s
36
+ start_period: 20s
37
+ retries: 3
38
+
39
+ agens-dev:
40
+ profiles: ["dev"]
41
+ build:
42
+ context: .
43
+ dockerfile: Dockerfile.dev
44
+ image: agens:dev
45
+ command:
46
+ [
47
+ "sh",
48
+ "-c",
49
+ "cd /app/frontend && npm run dev -- --host 0.0.0.0 & cd /app && agens _run-interfaces web",
50
+ ]
51
+ ports:
52
+ - "${AGENS_WEB_PORT:-8000}:8000"
53
+ - "${AGENS_FRONTEND_PORT:-5173}:5173"
54
+ environment:
55
+ PRODUCTION: "false"
56
+ WEB_HOST: "0.0.0.0"
57
+ WEB_PORT: "8000"
58
+ FRONTEND_LINK: "http://localhost:5173"
59
+ XDG_CONFIG_HOME: "/data/config"
60
+ DATABASE_URL: "sqlite+aiosqlite:////data/db/agens.db"
61
+ WORKSPACE_ROOT: "/workspace"
62
+ volumes:
63
+ - .:/app
64
+ - /app/.venv
65
+ - /app/frontend/node_modules
66
+ - agens_config:/data/config
67
+ - agens_database:/data/db
68
+ - agens_memories:/data/memories
69
+ - agens_runtime:/data/runtime
70
+ - agens_workspace:/workspace
71
+ healthcheck:
72
+ test:
73
+ [
74
+ "CMD",
75
+ "python",
76
+ "-c",
77
+ "from urllib.request import urlopen; urlopen('http://127.0.0.1:8000/health', timeout=3).read()",
78
+ ]
79
+ interval: 30s
80
+ timeout: 5s
81
+ start_period: 20s
82
+ retries: 3
83
+
84
+ volumes:
85
+ agens_config:
86
+ agens_database:
87
+ agens_memories:
88
+ agens_runtime:
89
+ agens_workspace: