agento-core 0.1.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.
- agento_core-0.1.4/.gitignore +58 -0
- agento_core-0.1.4/LICENSE +21 -0
- agento_core-0.1.4/PKG-INFO +160 -0
- agento_core-0.1.4/README.md +126 -0
- agento_core-0.1.4/pyproject.toml +85 -0
- agento_core-0.1.4/src/agento/__init__.py +0 -0
- agento_core-0.1.4/src/agento/framework/__init__.py +0 -0
- agento_core-0.1.4/src/agento/framework/agent_config_writer.py +162 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/__init__.py +36 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/active.py +62 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/auth.py +131 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/config.py +22 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/models.py +55 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/rotator.py +101 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/runner.py +182 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/token_resolver.py +45 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/token_store.py +145 -0
- agento_core-0.1.4/src/agento/framework/agent_manager/usage_store.py +92 -0
- agento_core-0.1.4/src/agento/framework/agent_view_runtime.py +96 -0
- agento_core-0.1.4/src/agento/framework/agent_view_worker.py +120 -0
- agento_core-0.1.4/src/agento/framework/bootstrap.py +312 -0
- agento_core-0.1.4/src/agento/framework/channels/__init__.py +3 -0
- agento_core-0.1.4/src/agento/framework/channels/base.py +80 -0
- agento_core-0.1.4/src/agento/framework/channels/registry.py +26 -0
- agento_core-0.1.4/src/agento/framework/channels/test.py +22 -0
- agento_core-0.1.4/src/agento/framework/cli/__init__.py +145 -0
- agento_core-0.1.4/src/agento/framework/cli/__main__.py +3 -0
- agento_core-0.1.4/src/agento/framework/cli/_env.py +56 -0
- agento_core-0.1.4/src/agento/framework/cli/_output.py +41 -0
- agento_core-0.1.4/src/agento/framework/cli/_project.py +45 -0
- agento_core-0.1.4/src/agento/framework/cli/compose.py +129 -0
- agento_core-0.1.4/src/agento/framework/cli/config.py +377 -0
- agento_core-0.1.4/src/agento/framework/cli/doctor.py +154 -0
- agento_core-0.1.4/src/agento/framework/cli/init.py +151 -0
- agento_core-0.1.4/src/agento/framework/cli/module.py +204 -0
- agento_core-0.1.4/src/agento/framework/cli/runtime.py +315 -0
- agento_core-0.1.4/src/agento/framework/cli/templates/docker-compose.yml +93 -0
- agento_core-0.1.4/src/agento/framework/cli/templates/env.example +2 -0
- agento_core-0.1.4/src/agento/framework/cli/templates/gitignore +14 -0
- agento_core-0.1.4/src/agento/framework/cli/templates/secrets.env.example +10 -0
- agento_core-0.1.4/src/agento/framework/cli/terminal.py +101 -0
- agento_core-0.1.4/src/agento/framework/cli/token.py +350 -0
- agento_core-0.1.4/src/agento/framework/commands.py +73 -0
- agento_core-0.1.4/src/agento/framework/config_resolver.py +227 -0
- agento_core-0.1.4/src/agento/framework/consumer.py +524 -0
- agento_core-0.1.4/src/agento/framework/consumer_config.py +40 -0
- agento_core-0.1.4/src/agento/framework/contracts/__init__.py +88 -0
- agento_core-0.1.4/src/agento/framework/core_config.py +246 -0
- agento_core-0.1.4/src/agento/framework/cron.json +9 -0
- agento_core-0.1.4/src/agento/framework/crontab.py +132 -0
- agento_core-0.1.4/src/agento/framework/crypto.py +56 -0
- agento_core-0.1.4/src/agento/framework/data_patch.py +176 -0
- agento_core-0.1.4/src/agento/framework/database_config.py +34 -0
- agento_core-0.1.4/src/agento/framework/db.py +47 -0
- agento_core-0.1.4/src/agento/framework/dependency_resolver.py +142 -0
- agento_core-0.1.4/src/agento/framework/e2e.py +209 -0
- agento_core-0.1.4/src/agento/framework/encryptor.py +44 -0
- agento_core-0.1.4/src/agento/framework/event_manager.py +70 -0
- agento_core-0.1.4/src/agento/framework/events.py +244 -0
- agento_core-0.1.4/src/agento/framework/ingress_identity.py +88 -0
- agento_core-0.1.4/src/agento/framework/job_models.py +105 -0
- agento_core-0.1.4/src/agento/framework/lock.py +32 -0
- agento_core-0.1.4/src/agento/framework/log.py +63 -0
- agento_core-0.1.4/src/agento/framework/migrate.py +161 -0
- agento_core-0.1.4/src/agento/framework/module_loader.py +162 -0
- agento_core-0.1.4/src/agento/framework/module_scaffold.py +127 -0
- agento_core-0.1.4/src/agento/framework/module_status.py +80 -0
- agento_core-0.1.4/src/agento/framework/module_validator.py +179 -0
- agento_core-0.1.4/src/agento/framework/onboarding.py +40 -0
- agento_core-0.1.4/src/agento/framework/publisher.py +68 -0
- agento_core-0.1.4/src/agento/framework/replay.py +103 -0
- agento_core-0.1.4/src/agento/framework/retry_policy.py +54 -0
- agento_core-0.1.4/src/agento/framework/router.py +138 -0
- agento_core-0.1.4/src/agento/framework/router_registry.py +25 -0
- agento_core-0.1.4/src/agento/framework/run_dir.py +35 -0
- agento_core-0.1.4/src/agento/framework/runner.py +39 -0
- agento_core-0.1.4/src/agento/framework/runner_factory.py +52 -0
- agento_core-0.1.4/src/agento/framework/scoped_config.py +309 -0
- agento_core-0.1.4/src/agento/framework/setup.py +191 -0
- agento_core-0.1.4/src/agento/framework/sql/001_create_tables.sql +41 -0
- agento_core-0.1.4/src/agento/framework/sql/002_generalize_jobs.sql +6 -0
- agento_core-0.1.4/src/agento/framework/sql/003_rename_queued_to_todo.sql +8 -0
- agento_core-0.1.4/src/agento/framework/sql/004_add_followup_type.sql +8 -0
- agento_core-0.1.4/src/agento/framework/sql/005_agent_manager.sql +29 -0
- agento_core-0.1.4/src/agento/framework/sql/007_model_and_tracking.sql +12 -0
- agento_core-0.1.4/src/agento/framework/sql/008_job_prompt_output.sql +3 -0
- agento_core-0.1.4/src/agento/framework/sql/009_add_blank_type.sql +3 -0
- agento_core-0.1.4/src/agento/framework/sql/010_core_config_data.sql +10 -0
- agento_core-0.1.4/src/agento/framework/sql/011_module_migrations.sql +3 -0
- agento_core-0.1.4/src/agento/framework/sql/012_data_patches_table.sql +9 -0
- agento_core-0.1.4/src/agento/framework/sql/013_singular_table_names.sql +4 -0
- agento_core-0.1.4/src/agento/framework/sql/014_workspace_agent_view.sql +38 -0
- agento_core-0.1.4/src/agento/framework/sql/015_ingress_identity.sql +13 -0
- agento_core-0.1.4/src/agento/framework/sql/016_job_priority.sql +6 -0
- agento_core-0.1.4/src/agento/framework/workflows/__init__.py +26 -0
- agento_core-0.1.4/src/agento/framework/workflows/base.py +55 -0
- agento_core-0.1.4/src/agento/framework/workflows/blank.py +18 -0
- agento_core-0.1.4/src/agento/framework/workspace.py +85 -0
- agento_core-0.1.4/src/agento/modules/agent_view/config.json +4 -0
- agento_core-0.1.4/src/agento/modules/agent_view/events.json +5 -0
- agento_core-0.1.4/src/agento/modules/agent_view/module.json +7 -0
- agento_core-0.1.4/src/agento/modules/agent_view/src/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/agent_view/src/instruction_writer.py +50 -0
- agento_core-0.1.4/src/agento/modules/agent_view/src/observers.py +46 -0
- agento_core-0.1.4/src/agento/modules/agent_view/system.json +7 -0
- agento_core-0.1.4/src/agento/modules/claude/di.json +8 -0
- agento_core-0.1.4/src/agento/modules/claude/module.json +7 -0
- agento_core-0.1.4/src/agento/modules/claude/src/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/claude/src/auth.py +43 -0
- agento_core-0.1.4/src/agento/modules/claude/src/output_parser.py +50 -0
- agento_core-0.1.4/src/agento/modules/claude/src/runner.py +35 -0
- agento_core-0.1.4/src/agento/modules/codex/di.json +8 -0
- agento_core-0.1.4/src/agento/modules/codex/module.json +7 -0
- agento_core-0.1.4/src/agento/modules/codex/src/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/codex/src/auth.py +45 -0
- agento_core-0.1.4/src/agento/modules/codex/src/runner.py +68 -0
- agento_core-0.1.4/src/agento/modules/core/config.json +7 -0
- agento_core-0.1.4/src/agento/modules/core/data_patch.json +5 -0
- agento_core-0.1.4/src/agento/modules/core/di.json +10 -0
- agento_core-0.1.4/src/agento/modules/core/module.json +7 -0
- agento_core-0.1.4/src/agento/modules/core/src/commands/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/core/src/commands/ingress_bind.py +41 -0
- agento_core-0.1.4/src/agento/modules/core/src/commands/ingress_list.py +54 -0
- agento_core-0.1.4/src/agento/modules/core/src/commands/ingress_unbind.py +38 -0
- agento_core-0.1.4/src/agento/modules/core/src/patches/seed_workspace.py +19 -0
- agento_core-0.1.4/src/agento/modules/core/src/routers/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/core/src/routers/identity_router.py +26 -0
- agento_core-0.1.4/src/agento/modules/core/system.json +14 -0
- agento_core-0.1.4/src/agento/modules/core/toolbox/browser.js +367 -0
- agento_core-0.1.4/src/agento/modules/core/toolbox/email.js +122 -0
- agento_core-0.1.4/src/agento/modules/core/toolbox/schedule.js +97 -0
- agento_core-0.1.4/src/agento/modules/crypt/events.json +5 -0
- agento_core-0.1.4/src/agento/modules/crypt/module.json +6 -0
- agento_core-0.1.4/src/agento/modules/crypt/src/aes_cbc_backend.py +13 -0
- agento_core-0.1.4/src/agento/modules/crypt/src/observers.py +21 -0
- agento_core-0.1.4/src/agento/modules/jira/config.json +4 -0
- agento_core-0.1.4/src/agento/modules/jira/cron.json +6 -0
- agento_core-0.1.4/src/agento/modules/jira/di.json +15 -0
- agento_core-0.1.4/src/agento/modules/jira/module.json +7 -0
- agento_core-0.1.4/src/agento/modules/jira/src/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/jira/src/channel.py +289 -0
- agento_core-0.1.4/src/agento/modules/jira/src/commands/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/jira/src/commands/exec_todo.py +48 -0
- agento_core-0.1.4/src/agento/modules/jira/src/commands/publish.py +76 -0
- agento_core-0.1.4/src/agento/modules/jira/src/config.py +41 -0
- agento_core-0.1.4/src/agento/modules/jira/src/mention_detector.py +40 -0
- agento_core-0.1.4/src/agento/modules/jira/src/models.py +38 -0
- agento_core-0.1.4/src/agento/modules/jira/src/onboarding.py +171 -0
- agento_core-0.1.4/src/agento/modules/jira/src/task_list.py +103 -0
- agento_core-0.1.4/src/agento/modules/jira/src/toolbox_client.py +57 -0
- agento_core-0.1.4/src/agento/modules/jira/src/workflows/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/jira/src/workflows/followup.py +52 -0
- agento_core-0.1.4/src/agento/modules/jira/src/workflows/todo.py +84 -0
- agento_core-0.1.4/src/agento/modules/jira/system.json +12 -0
- agento_core-0.1.4/src/agento/modules/jira/toolbox/api.js +113 -0
- agento_core-0.1.4/src/agento/modules/jira/toolbox/jira-proxy.js +67 -0
- agento_core-0.1.4/src/agento/modules/jira/toolbox/jira.js +666 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/config.json +12 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/cron.json +5 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/di.json +11 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/module.json +7 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/commands/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/commands/exec_cron.py +36 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/commands/sync.py +47 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/config.py +19 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/crontab.py +91 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/onboarding.py +316 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/sync.py +162 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/workflows/__init__.py +0 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/src/workflows/cron.py +37 -0
- agento_core-0.1.4/src/agento/modules/jira_periodic_tasks/system.json +5 -0
- agento_core-0.1.4/src/agento/toolbox/adapters/index.js +38 -0
- agento_core-0.1.4/src/agento/toolbox/adapters/mssql.js +116 -0
- agento_core-0.1.4/src/agento/toolbox/adapters/mysql.js +112 -0
- agento_core-0.1.4/src/agento/toolbox/adapters/opensearch.js +94 -0
- agento_core-0.1.4/src/agento/toolbox/adapters/sql-timeout.js +12 -0
- agento_core-0.1.4/src/agento/toolbox/config-loader.js +410 -0
- agento_core-0.1.4/src/agento/toolbox/crypto.js +51 -0
- agento_core-0.1.4/src/agento/toolbox/db.js +18 -0
- agento_core-0.1.4/src/agento/toolbox/eslint.config.js +33 -0
- agento_core-0.1.4/src/agento/toolbox/log.js +35 -0
- agento_core-0.1.4/src/agento/toolbox/package-lock.json +5296 -0
- agento_core-0.1.4/src/agento/toolbox/package.json +24 -0
- agento_core-0.1.4/src/agento/toolbox/playwright-client.js +89 -0
- agento_core-0.1.4/src/agento/toolbox/server.js +198 -0
- agento_core-0.1.4/src/agento/toolbox/tests/config-loader.test.js +797 -0
- agento_core-0.1.4/src/agento/toolbox/tests/crypto.test.js +61 -0
- agento_core-0.1.4/src/agento/toolbox/tests/healthcheck.test.js +198 -0
- agento_core-0.1.4/src/agento/toolbox/tests/jira-proxy.test.js +120 -0
- agento_core-0.1.4/src/agento/toolbox/tests/log.test.js +46 -0
- agento_core-0.1.4/src/agento/toolbox/tests/sql-timeout.test.js +129 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
logs/
|
|
3
|
+
workspace/.claude.json
|
|
4
|
+
|
|
5
|
+
# Python
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.pyc
|
|
8
|
+
.venv/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
.pytest_cache/
|
|
11
|
+
|
|
12
|
+
# Storage (MySQL data, etc.)
|
|
13
|
+
storage/*
|
|
14
|
+
!storage/.gitkeep
|
|
15
|
+
|
|
16
|
+
# OAuth credential files
|
|
17
|
+
tokens/
|
|
18
|
+
|
|
19
|
+
# Cloned app repositories
|
|
20
|
+
workspace/app/*
|
|
21
|
+
!workspace/app/.gitkeep
|
|
22
|
+
|
|
23
|
+
# Local env overrides
|
|
24
|
+
secrets.env
|
|
25
|
+
docker/.cron.env
|
|
26
|
+
docker/.toolbox.env
|
|
27
|
+
node_modules/
|
|
28
|
+
|
|
29
|
+
# Generated config files (created by bin/agento install)
|
|
30
|
+
workspace/SOUL.md
|
|
31
|
+
workspace/AGENTS.md
|
|
32
|
+
docker/.cron.env
|
|
33
|
+
|
|
34
|
+
# User modules (company-specific, like Magento app/code/)
|
|
35
|
+
app/code/*
|
|
36
|
+
!app/code/_example/
|
|
37
|
+
|
|
38
|
+
# Deployment-specific module state (like Magento app/etc/config.php)
|
|
39
|
+
app/etc/*
|
|
40
|
+
!app/etc/.gitkeep
|
|
41
|
+
|
|
42
|
+
# Build artifacts
|
|
43
|
+
dist/
|
|
44
|
+
|
|
45
|
+
# Reindexed data (generated by bin/agento reindex)
|
|
46
|
+
workspace/systems/
|
|
47
|
+
|
|
48
|
+
# Company-specific knowledge base and prompts (legacy, migrated to systems/)
|
|
49
|
+
workspace/KnowledgeBase/
|
|
50
|
+
workspace/prompts/
|
|
51
|
+
|
|
52
|
+
# Toolbox session
|
|
53
|
+
docker/toolbox/session.json
|
|
54
|
+
|
|
55
|
+
# Claude worktrees
|
|
56
|
+
.claude/worktrees/
|
|
57
|
+
|
|
58
|
+
.mcp
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present Marcin Klauza
|
|
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,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agento-core
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: AI Agent Framework — automates tasks using AI agents in Docker containers
|
|
5
|
+
Project-URL: Homepage, https://github.com/agento-cc/agento
|
|
6
|
+
Project-URL: Repository, https://github.com/agento-cc/agento
|
|
7
|
+
Project-URL: Documentation, https://github.com/agento-cc/agento/tree/main/docs
|
|
8
|
+
Project-URL: Issues, https://github.com/agento-cc/agento/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/agento-cc/agento/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Marcin Klauza
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agent,ai,automation,docker,framework,modular
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Requires-Dist: cryptography>=43.0
|
|
21
|
+
Requires-Dist: httpx>=0.27
|
|
22
|
+
Requires-Dist: pymysql>=1.1
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: basedpyright>=1.29; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-mock>=3.14; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: respx>=0.22; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff>=0.11; extra == 'dev'
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest-mock>=3.14; extra == 'test'
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == 'test'
|
|
32
|
+
Requires-Dist: respx>=0.22; extra == 'test'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Agento
|
|
36
|
+
|
|
37
|
+
[](https://github.com/saipix/agento/actions/workflows/ci.yml)
|
|
38
|
+
[](https://opensource.org/licenses/MIT)
|
|
39
|
+
[](https://www.python.org/downloads/)
|
|
40
|
+
|
|
41
|
+
Self-hosted agent automation platform with modular integrations, Python execution runtime, Node.js toolbox, scoped config, and extension modules. Automates tasks using AI agents (Claude Code, OpenAI Codex) in Docker containers.
|
|
42
|
+
|
|
43
|
+
## Why Two Runtimes?
|
|
44
|
+
|
|
45
|
+
Agento enforces a strict security boundary between the AI sandbox and credentials. The sandbox where agents run has **zero access** to secrets. The toolbox is the only container that holds credentials, exposed via an MCP server that the agent calls through controlled tool interfaces.
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
┌───────────────────────────────────────────────────────┐
|
|
49
|
+
│ Docker Network │
|
|
50
|
+
│ │
|
|
51
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
52
|
+
│ │ Sandbox │ │ Toolbox │ │ Cron │ │
|
|
53
|
+
│ │ Claude/ │ │ Node.js │ │ Python │ │
|
|
54
|
+
│ │ Codex │ │ MCP Server │ │ Consumer │ │
|
|
55
|
+
│ │ │ │ │ │ + Scheduler │ │
|
|
56
|
+
│ │ NO secrets │ │ Credentials │ │ Job Queue │ │
|
|
57
|
+
│ └─────────────┘ └──────┬──────┘ └─────────────┘ │
|
|
58
|
+
│ │ │
|
|
59
|
+
│ ┌─────┴─────┐ │
|
|
60
|
+
│ │ MySQL │ │
|
|
61
|
+
│ └───────────┘ │
|
|
62
|
+
└───────────────────────────────────────────────────────┘
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uv tool install agento # Install the CLI
|
|
69
|
+
agento init my-project # Scaffold a new project
|
|
70
|
+
cd my-project
|
|
71
|
+
agento up # Start Docker Compose
|
|
72
|
+
agento setup:upgrade # Apply migrations
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Architecture
|
|
76
|
+
|
|
77
|
+
Agento runs three Docker containers on a shared network:
|
|
78
|
+
|
|
79
|
+
- **Cron** (Python) -- Job queue consumer, scheduler, CLI host. Manages the lifecycle of agent jobs, runs migrations, and dispatches events. Connects to MySQL for job state, config, and module metadata.
|
|
80
|
+
- **Toolbox** (Node.js) -- MCP credential broker. Registers tools from modules (MySQL adapters, API clients) and exposes them over stdio. The only container with access to secrets.
|
|
81
|
+
- **Sandbox** (Claude Code / OpenAI Codex) -- Ephemeral container where the AI agent executes. Has no credentials, no direct database access. Communicates with the toolbox exclusively through MCP tool calls.
|
|
82
|
+
|
|
83
|
+
## Module System
|
|
84
|
+
|
|
85
|
+
Agento uses a Magento-inspired modular architecture. Each module is a self-contained package.
|
|
86
|
+
|
|
87
|
+
**Core modules** ship with the framework in `src/agento/modules/` (jira, claude, codex, core, crypt, agent_view).
|
|
88
|
+
|
|
89
|
+
**User modules** live in `app/code/` and are deployment-specific (gitignored by default).
|
|
90
|
+
|
|
91
|
+
Every module contains a `module.json` manifest and optional companion files:
|
|
92
|
+
|
|
93
|
+
| File | Purpose |
|
|
94
|
+
|------|---------|
|
|
95
|
+
| `module.json` | Module manifest (name, version, tools, knowledge) |
|
|
96
|
+
| `di.json` | Dependency injection configuration |
|
|
97
|
+
| `events.json` | Observer declarations for event-driven extensibility |
|
|
98
|
+
| `config.json` | Default config values with field metadata |
|
|
99
|
+
| `cron.json` | Scheduled job definitions |
|
|
100
|
+
| `sql/*.sql` | Schema migrations |
|
|
101
|
+
| `data_patch.json` | Data patches applied during setup |
|
|
102
|
+
|
|
103
|
+
**Config** follows a 3-level fallback: ENV vars (`CONFIG__MODULE__PATH`) take highest priority, then DB (`core_config_data`), then `config.json` defaults. Config can be scoped per agent_view for multi-tenant setups.
|
|
104
|
+
|
|
105
|
+
**Events** use an observer pattern. Modules declare observers in `events.json` and the framework dispatches events synchronously during lifecycle hooks (job start, job complete, schedule tick, etc.).
|
|
106
|
+
|
|
107
|
+
## Installation
|
|
108
|
+
|
|
109
|
+
### Path A — Docker Compose (recommended)
|
|
110
|
+
|
|
111
|
+
For end users, demos, PoC, and self-hosting:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
uv tool install agento # or: pip install agento
|
|
115
|
+
agento init my-project # Scaffold project with Docker Compose
|
|
116
|
+
cd my-project
|
|
117
|
+
agento up # Start containers (cron + toolbox + MySQL)
|
|
118
|
+
agento setup:upgrade # Apply migrations, install crontab
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### System check
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
agento doctor # Verify prerequisites
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Creating Your First Module
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
agento module:add my-app \
|
|
131
|
+
--description="My application module" \
|
|
132
|
+
--tool mysql:mysql_prod:"Production database (read-only)"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This creates a module in `app/code/my-app/` with a `module.json`, `config.json`, and `knowledge/` directory. Set credentials with:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
agento config:set my_app/tools/mysql_prod/host 10.0.0.1
|
|
139
|
+
agento config:set my_app/tools/mysql_prod/pass secret123
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
See [Creating a Module](docs/modules/creating-a-module.md) for the full guide.
|
|
143
|
+
|
|
144
|
+
## Documentation
|
|
145
|
+
|
|
146
|
+
Full developer documentation is available in [docs/](docs/):
|
|
147
|
+
|
|
148
|
+
- [Getting Started](docs/getting-started.md) -- Install and create your first module
|
|
149
|
+
- [CLI Reference](docs/cli/) -- All `agento` commands
|
|
150
|
+
- [Module Guide](docs/modules/) -- Creating and managing modules
|
|
151
|
+
- [Config System](docs/config/) -- 3-level fallback, encryption, ENV vars
|
|
152
|
+
- [Architecture](docs/architecture/) -- Containers, zero-trust, job queue
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
|
|
156
|
+
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on setting up a development environment, running tests, and submitting pull requests.
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT. See [LICENSE](LICENSE) for the full text.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Agento
|
|
2
|
+
|
|
3
|
+
[](https://github.com/saipix/agento/actions/workflows/ci.yml)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
|
|
7
|
+
Self-hosted agent automation platform with modular integrations, Python execution runtime, Node.js toolbox, scoped config, and extension modules. Automates tasks using AI agents (Claude Code, OpenAI Codex) in Docker containers.
|
|
8
|
+
|
|
9
|
+
## Why Two Runtimes?
|
|
10
|
+
|
|
11
|
+
Agento enforces a strict security boundary between the AI sandbox and credentials. The sandbox where agents run has **zero access** to secrets. The toolbox is the only container that holds credentials, exposed via an MCP server that the agent calls through controlled tool interfaces.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
┌───────────────────────────────────────────────────────┐
|
|
15
|
+
│ Docker Network │
|
|
16
|
+
│ │
|
|
17
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
18
|
+
│ │ Sandbox │ │ Toolbox │ │ Cron │ │
|
|
19
|
+
│ │ Claude/ │ │ Node.js │ │ Python │ │
|
|
20
|
+
│ │ Codex │ │ MCP Server │ │ Consumer │ │
|
|
21
|
+
│ │ │ │ │ │ + Scheduler │ │
|
|
22
|
+
│ │ NO secrets │ │ Credentials │ │ Job Queue │ │
|
|
23
|
+
│ └─────────────┘ └──────┬──────┘ └─────────────┘ │
|
|
24
|
+
│ │ │
|
|
25
|
+
│ ┌─────┴─────┐ │
|
|
26
|
+
│ │ MySQL │ │
|
|
27
|
+
│ └───────────┘ │
|
|
28
|
+
└───────────────────────────────────────────────────────┘
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv tool install agento # Install the CLI
|
|
35
|
+
agento init my-project # Scaffold a new project
|
|
36
|
+
cd my-project
|
|
37
|
+
agento up # Start Docker Compose
|
|
38
|
+
agento setup:upgrade # Apply migrations
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Architecture
|
|
42
|
+
|
|
43
|
+
Agento runs three Docker containers on a shared network:
|
|
44
|
+
|
|
45
|
+
- **Cron** (Python) -- Job queue consumer, scheduler, CLI host. Manages the lifecycle of agent jobs, runs migrations, and dispatches events. Connects to MySQL for job state, config, and module metadata.
|
|
46
|
+
- **Toolbox** (Node.js) -- MCP credential broker. Registers tools from modules (MySQL adapters, API clients) and exposes them over stdio. The only container with access to secrets.
|
|
47
|
+
- **Sandbox** (Claude Code / OpenAI Codex) -- Ephemeral container where the AI agent executes. Has no credentials, no direct database access. Communicates with the toolbox exclusively through MCP tool calls.
|
|
48
|
+
|
|
49
|
+
## Module System
|
|
50
|
+
|
|
51
|
+
Agento uses a Magento-inspired modular architecture. Each module is a self-contained package.
|
|
52
|
+
|
|
53
|
+
**Core modules** ship with the framework in `src/agento/modules/` (jira, claude, codex, core, crypt, agent_view).
|
|
54
|
+
|
|
55
|
+
**User modules** live in `app/code/` and are deployment-specific (gitignored by default).
|
|
56
|
+
|
|
57
|
+
Every module contains a `module.json` manifest and optional companion files:
|
|
58
|
+
|
|
59
|
+
| File | Purpose |
|
|
60
|
+
|------|---------|
|
|
61
|
+
| `module.json` | Module manifest (name, version, tools, knowledge) |
|
|
62
|
+
| `di.json` | Dependency injection configuration |
|
|
63
|
+
| `events.json` | Observer declarations for event-driven extensibility |
|
|
64
|
+
| `config.json` | Default config values with field metadata |
|
|
65
|
+
| `cron.json` | Scheduled job definitions |
|
|
66
|
+
| `sql/*.sql` | Schema migrations |
|
|
67
|
+
| `data_patch.json` | Data patches applied during setup |
|
|
68
|
+
|
|
69
|
+
**Config** follows a 3-level fallback: ENV vars (`CONFIG__MODULE__PATH`) take highest priority, then DB (`core_config_data`), then `config.json` defaults. Config can be scoped per agent_view for multi-tenant setups.
|
|
70
|
+
|
|
71
|
+
**Events** use an observer pattern. Modules declare observers in `events.json` and the framework dispatches events synchronously during lifecycle hooks (job start, job complete, schedule tick, etc.).
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
### Path A — Docker Compose (recommended)
|
|
76
|
+
|
|
77
|
+
For end users, demos, PoC, and self-hosting:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
uv tool install agento # or: pip install agento
|
|
81
|
+
agento init my-project # Scaffold project with Docker Compose
|
|
82
|
+
cd my-project
|
|
83
|
+
agento up # Start containers (cron + toolbox + MySQL)
|
|
84
|
+
agento setup:upgrade # Apply migrations, install crontab
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### System check
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
agento doctor # Verify prerequisites
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Creating Your First Module
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
agento module:add my-app \
|
|
97
|
+
--description="My application module" \
|
|
98
|
+
--tool mysql:mysql_prod:"Production database (read-only)"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
This creates a module in `app/code/my-app/` with a `module.json`, `config.json`, and `knowledge/` directory. Set credentials with:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
agento config:set my_app/tools/mysql_prod/host 10.0.0.1
|
|
105
|
+
agento config:set my_app/tools/mysql_prod/pass secret123
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
See [Creating a Module](docs/modules/creating-a-module.md) for the full guide.
|
|
109
|
+
|
|
110
|
+
## Documentation
|
|
111
|
+
|
|
112
|
+
Full developer documentation is available in [docs/](docs/):
|
|
113
|
+
|
|
114
|
+
- [Getting Started](docs/getting-started.md) -- Install and create your first module
|
|
115
|
+
- [CLI Reference](docs/cli/) -- All `agento` commands
|
|
116
|
+
- [Module Guide](docs/modules/) -- Creating and managing modules
|
|
117
|
+
- [Config System](docs/config/) -- 3-level fallback, encryption, ENV vars
|
|
118
|
+
- [Architecture](docs/architecture/) -- Containers, zero-trust, job queue
|
|
119
|
+
|
|
120
|
+
## Contributing
|
|
121
|
+
|
|
122
|
+
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on setting up a development environment, running tests, and submitting pull requests.
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT. See [LICENSE](LICENSE) for the full text.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[tool.hatch.build]
|
|
6
|
+
include = [
|
|
7
|
+
"src/agento/**/*.py",
|
|
8
|
+
"src/agento/**/*.json",
|
|
9
|
+
"src/agento/**/*.js",
|
|
10
|
+
"src/agento/**/*.yml",
|
|
11
|
+
"src/agento/**/*.yaml",
|
|
12
|
+
"src/agento/**/*.md",
|
|
13
|
+
"src/agento/**/*.sql",
|
|
14
|
+
"src/agento/framework/cli/templates/*",
|
|
15
|
+
"src/agento/toolbox/package.json",
|
|
16
|
+
"src/agento/toolbox/package-lock.json",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[tool.hatch.build.targets.wheel]
|
|
20
|
+
packages = ["src/agento"]
|
|
21
|
+
|
|
22
|
+
[project]
|
|
23
|
+
name = "agento-core"
|
|
24
|
+
version = "0.1.4"
|
|
25
|
+
description = "AI Agent Framework — automates tasks using AI agents in Docker containers"
|
|
26
|
+
requires-python = ">=3.12"
|
|
27
|
+
dependencies = [
|
|
28
|
+
"httpx>=0.27",
|
|
29
|
+
"PyMySQL>=1.1",
|
|
30
|
+
"cryptography>=43.0",
|
|
31
|
+
]
|
|
32
|
+
authors = [{name = "Marcin Klauza"}]
|
|
33
|
+
license = {text = "MIT"}
|
|
34
|
+
readme = "README.md"
|
|
35
|
+
keywords = ["ai", "agent", "automation", "framework", "docker", "modular"]
|
|
36
|
+
classifiers = [
|
|
37
|
+
"Development Status :: 3 - Alpha",
|
|
38
|
+
"License :: OSI Approved :: MIT License",
|
|
39
|
+
"Programming Language :: Python :: 3",
|
|
40
|
+
"Programming Language :: Python :: 3.12",
|
|
41
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.scripts]
|
|
45
|
+
agento = "agento.framework.cli:main"
|
|
46
|
+
agent = "agento.framework.cli:main"
|
|
47
|
+
|
|
48
|
+
[project.entry-points."agento.modules"]
|
|
49
|
+
jira = "agento.modules.jira"
|
|
50
|
+
claude = "agento.modules.claude"
|
|
51
|
+
codex = "agento.modules.codex"
|
|
52
|
+
|
|
53
|
+
[project.urls]
|
|
54
|
+
Homepage = "https://github.com/agento-cc/agento"
|
|
55
|
+
Repository = "https://github.com/agento-cc/agento"
|
|
56
|
+
Documentation = "https://github.com/agento-cc/agento/tree/main/docs"
|
|
57
|
+
Issues = "https://github.com/agento-cc/agento/issues"
|
|
58
|
+
Changelog = "https://github.com/agento-cc/agento/blob/main/CHANGELOG.md"
|
|
59
|
+
|
|
60
|
+
[tool.pytest.ini_options]
|
|
61
|
+
testpaths = ["tests", "app/code"]
|
|
62
|
+
|
|
63
|
+
[tool.ruff]
|
|
64
|
+
target-version = "py312"
|
|
65
|
+
line-length = 120
|
|
66
|
+
|
|
67
|
+
[tool.ruff.lint]
|
|
68
|
+
select = ["E", "F", "W", "I", "UP", "B", "SIM", "RUF"]
|
|
69
|
+
ignore = ["E501"]
|
|
70
|
+
|
|
71
|
+
[tool.ruff.lint.isort]
|
|
72
|
+
known-first-party = ["agento"]
|
|
73
|
+
|
|
74
|
+
[project.optional-dependencies]
|
|
75
|
+
dev = ["pytest>=8.0", "pytest-mock>=3.14", "respx>=0.22", "ruff>=0.11", "basedpyright>=1.29"]
|
|
76
|
+
test = ["pytest>=8.0", "pytest-mock>=3.14", "respx>=0.22"]
|
|
77
|
+
|
|
78
|
+
[dependency-groups]
|
|
79
|
+
dev = [
|
|
80
|
+
"pytest>=8.0",
|
|
81
|
+
"pytest-mock>=3.14",
|
|
82
|
+
"respx>=0.22",
|
|
83
|
+
"ruff>=0.11",
|
|
84
|
+
"basedpyright>=1.29",
|
|
85
|
+
]
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""Generate agent CLI config files from resolved scoped config.
|
|
2
|
+
|
|
3
|
+
Before each worker run, generates native config files that agent CLIs expect:
|
|
4
|
+
- .claude.json (Claude Code project config)
|
|
5
|
+
- .claude/settings.json (Claude Code user settings)
|
|
6
|
+
- .mcp.json (MCP server configuration)
|
|
7
|
+
- .codex/config.toml (Codex CLI config)
|
|
8
|
+
|
|
9
|
+
Config field paths follow the convention:
|
|
10
|
+
agent/claude/model -> model for Claude CLI
|
|
11
|
+
agent/claude/personality -> system prompt / personality
|
|
12
|
+
agent/mcp/servers -> MCP server definitions (JSON)
|
|
13
|
+
agent/codex/model -> model for Codex CLI
|
|
14
|
+
"""
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import logging
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Any
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
# Config path prefix for agent CLI settings
|
|
25
|
+
AGENT_CONFIG_PREFIX = "agent/"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _get_agent_config(resolved_config: dict[str, tuple[str, bool]]) -> dict[str, str]:
|
|
29
|
+
"""Extract agent/* paths from resolved DB overrides into a flat dict.
|
|
30
|
+
|
|
31
|
+
Returns {relative_path: value}, e.g. {"claude/model": "opus-4"}.
|
|
32
|
+
"""
|
|
33
|
+
result = {}
|
|
34
|
+
for path, (value, _encrypted) in resolved_config.items():
|
|
35
|
+
if path.startswith(AGENT_CONFIG_PREFIX) and value is not None:
|
|
36
|
+
relative = path[len(AGENT_CONFIG_PREFIX):]
|
|
37
|
+
result[relative] = value
|
|
38
|
+
return result
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def generate_claude_config(working_dir: Path, agent_config: dict[str, str]) -> None:
|
|
42
|
+
"""Generate .claude.json and .claude/settings.json in the working directory."""
|
|
43
|
+
# .claude.json — project-level config
|
|
44
|
+
claude_json: dict[str, Any] = {}
|
|
45
|
+
|
|
46
|
+
model = agent_config.get("claude/model")
|
|
47
|
+
if model:
|
|
48
|
+
claude_json["model"] = model
|
|
49
|
+
|
|
50
|
+
personality = agent_config.get("claude/personality")
|
|
51
|
+
if personality:
|
|
52
|
+
claude_json["systemPrompt"] = personality
|
|
53
|
+
|
|
54
|
+
permissions = agent_config.get("claude/permissions")
|
|
55
|
+
if permissions:
|
|
56
|
+
try:
|
|
57
|
+
claude_json["permissions"] = json.loads(permissions)
|
|
58
|
+
except (json.JSONDecodeError, TypeError):
|
|
59
|
+
logger.warning("Invalid JSON in agent/claude/permissions, skipping")
|
|
60
|
+
|
|
61
|
+
if claude_json:
|
|
62
|
+
config_path = working_dir / ".claude.json"
|
|
63
|
+
config_path.write_text(json.dumps(claude_json, indent=2) + "\n")
|
|
64
|
+
logger.debug("Generated %s", config_path)
|
|
65
|
+
|
|
66
|
+
# .claude/settings.json — user-level settings
|
|
67
|
+
settings: dict[str, Any] = {}
|
|
68
|
+
|
|
69
|
+
trust_level = agent_config.get("claude/trust_level")
|
|
70
|
+
if trust_level:
|
|
71
|
+
settings["permissions"] = {"dangerouslySkipPermissions": trust_level == "full"}
|
|
72
|
+
|
|
73
|
+
if settings:
|
|
74
|
+
settings_dir = working_dir / ".claude"
|
|
75
|
+
settings_dir.mkdir(parents=True, exist_ok=True)
|
|
76
|
+
settings_path = settings_dir / "settings.json"
|
|
77
|
+
settings_path.write_text(json.dumps(settings, indent=2) + "\n")
|
|
78
|
+
logger.debug("Generated %s", settings_path)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _inject_agent_view_id(servers: dict, agent_view_id: int) -> dict:
|
|
82
|
+
"""Append ?agent_view_id=N to toolbox SSE/MCP URLs in mcpServers config."""
|
|
83
|
+
for server_cfg in servers.values():
|
|
84
|
+
url = server_cfg.get("url", "")
|
|
85
|
+
if "/sse" in url or "/mcp" in url:
|
|
86
|
+
sep = "&" if "?" in url else "?"
|
|
87
|
+
server_cfg["url"] = f"{url}{sep}agent_view_id={agent_view_id}"
|
|
88
|
+
return servers
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def generate_mcp_config(
|
|
92
|
+
working_dir: Path,
|
|
93
|
+
agent_config: dict[str, str],
|
|
94
|
+
*,
|
|
95
|
+
agent_view_id: int | None = None,
|
|
96
|
+
) -> None:
|
|
97
|
+
"""Generate .mcp.json in the working directory."""
|
|
98
|
+
servers_raw = agent_config.get("mcp/servers")
|
|
99
|
+
if not servers_raw:
|
|
100
|
+
return
|
|
101
|
+
|
|
102
|
+
try:
|
|
103
|
+
servers = json.loads(servers_raw)
|
|
104
|
+
except (json.JSONDecodeError, TypeError):
|
|
105
|
+
logger.warning("Invalid JSON in agent/mcp/servers, skipping .mcp.json generation")
|
|
106
|
+
return
|
|
107
|
+
|
|
108
|
+
if agent_view_id is not None:
|
|
109
|
+
servers = _inject_agent_view_id(servers, agent_view_id)
|
|
110
|
+
|
|
111
|
+
mcp_config = {"mcpServers": servers}
|
|
112
|
+
config_path = working_dir / ".mcp.json"
|
|
113
|
+
config_path.write_text(json.dumps(mcp_config, indent=2) + "\n")
|
|
114
|
+
logger.debug("Generated %s", config_path)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def generate_codex_config(working_dir: Path, agent_config: dict[str, str]) -> None:
|
|
118
|
+
"""Generate .codex/config.toml in the working directory."""
|
|
119
|
+
lines: list[str] = []
|
|
120
|
+
|
|
121
|
+
model = agent_config.get("codex/model")
|
|
122
|
+
if model:
|
|
123
|
+
lines.append(f'model = "{model}"')
|
|
124
|
+
|
|
125
|
+
approval_mode = agent_config.get("codex/approval_mode")
|
|
126
|
+
if approval_mode:
|
|
127
|
+
lines.append(f'approval_mode = "{approval_mode}"')
|
|
128
|
+
|
|
129
|
+
if not lines:
|
|
130
|
+
return
|
|
131
|
+
|
|
132
|
+
codex_dir = working_dir / ".codex"
|
|
133
|
+
codex_dir.mkdir(parents=True, exist_ok=True)
|
|
134
|
+
config_path = codex_dir / "config.toml"
|
|
135
|
+
config_path.write_text("\n".join(lines) + "\n")
|
|
136
|
+
logger.debug("Generated %s", config_path)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def populate_agent_configs(
|
|
140
|
+
working_dir: str | Path,
|
|
141
|
+
scoped_overrides: dict[str, tuple[str, bool]],
|
|
142
|
+
*,
|
|
143
|
+
agent_view_id: int | None = None,
|
|
144
|
+
) -> None:
|
|
145
|
+
"""Generate all agent CLI config files from scoped DB overrides.
|
|
146
|
+
|
|
147
|
+
Called before each worker run with the merged (agent_view -> workspace -> global) overrides.
|
|
148
|
+
"""
|
|
149
|
+
wd = Path(working_dir)
|
|
150
|
+
wd.mkdir(parents=True, exist_ok=True)
|
|
151
|
+
|
|
152
|
+
agent_config = _get_agent_config(scoped_overrides)
|
|
153
|
+
|
|
154
|
+
if not agent_config:
|
|
155
|
+
logger.debug("No agent/* config paths found, skipping config file generation")
|
|
156
|
+
return
|
|
157
|
+
|
|
158
|
+
generate_claude_config(wd, agent_config)
|
|
159
|
+
generate_mcp_config(wd, agent_config, agent_view_id=agent_view_id)
|
|
160
|
+
generate_codex_config(wd, agent_config)
|
|
161
|
+
|
|
162
|
+
logger.info("Populated agent config files in %s", wd)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Agent Manager — multi-token orchestration for LLM agent providers."""
|
|
2
|
+
|
|
3
|
+
from .active import read_credentials, resolve_active_token, update_active_token
|
|
4
|
+
from .auth import AuthenticationError, AuthResult, authenticate_interactive, save_credentials
|
|
5
|
+
from .config import AgentManagerConfig
|
|
6
|
+
from .models import AgentProvider, RotationResult, Token, UsageSummary
|
|
7
|
+
from .rotator import rotate_all, rotate_tokens, select_best_token
|
|
8
|
+
from .token_store import deregister_token, get_token, get_token_by_path, list_tokens, register_token, set_primary_token
|
|
9
|
+
from .usage_store import get_usage_summaries, get_usage_summary, record_usage
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"AgentManagerConfig",
|
|
13
|
+
"AgentProvider",
|
|
14
|
+
"AuthResult",
|
|
15
|
+
"AuthenticationError",
|
|
16
|
+
"RotationResult",
|
|
17
|
+
"Token",
|
|
18
|
+
"UsageSummary",
|
|
19
|
+
"authenticate_interactive",
|
|
20
|
+
"deregister_token",
|
|
21
|
+
"get_token",
|
|
22
|
+
"get_token_by_path",
|
|
23
|
+
"get_usage_summaries",
|
|
24
|
+
"get_usage_summary",
|
|
25
|
+
"list_tokens",
|
|
26
|
+
"read_credentials",
|
|
27
|
+
"record_usage",
|
|
28
|
+
"register_token",
|
|
29
|
+
"resolve_active_token",
|
|
30
|
+
"rotate_all",
|
|
31
|
+
"rotate_tokens",
|
|
32
|
+
"save_credentials",
|
|
33
|
+
"select_best_token",
|
|
34
|
+
"set_primary_token",
|
|
35
|
+
"update_active_token",
|
|
36
|
+
]
|