soveren-agent-platform 0.2.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 (136) hide show
  1. soveren_agent_platform-0.2.0/.github/workflows/ci.yml +53 -0
  2. soveren_agent_platform-0.2.0/.github/workflows/publish.yml +40 -0
  3. soveren_agent_platform-0.2.0/.gitignore +11 -0
  4. soveren_agent_platform-0.2.0/AGENTS.md +83 -0
  5. soveren_agent_platform-0.2.0/LICENSE +21 -0
  6. soveren_agent_platform-0.2.0/PKG-INFO +114 -0
  7. soveren_agent_platform-0.2.0/README.md +97 -0
  8. soveren_agent_platform-0.2.0/docs/API.md +335 -0
  9. soveren_agent_platform-0.2.0/docs/ARCHITECTURE.md +307 -0
  10. soveren_agent_platform-0.2.0/docs/EXTRACTION_PLAN.md +455 -0
  11. soveren_agent_platform-0.2.0/docs/PORTS.md +133 -0
  12. soveren_agent_platform-0.2.0/docs/assets/soveren-logo.svg +50 -0
  13. soveren_agent_platform-0.2.0/pyproject.toml +50 -0
  14. soveren_agent_platform-0.2.0/src/soveren_agent_platform/__init__.py +5 -0
  15. soveren_agent_platform-0.2.0/src/soveren_agent_platform/actions/__init__.py +33 -0
  16. soveren_agent_platform-0.2.0/src/soveren_agent_platform/actions/contracts.py +108 -0
  17. soveren_agent_platform-0.2.0/src/soveren_agent_platform/actions/registry.py +21 -0
  18. soveren_agent_platform-0.2.0/src/soveren_agent_platform/actions/sqlite.py +86 -0
  19. soveren_agent_platform-0.2.0/src/soveren_agent_platform/actions/store.py +171 -0
  20. soveren_agent_platform-0.2.0/src/soveren_agent_platform/actions/worker.py +243 -0
  21. soveren_agent_platform-0.2.0/src/soveren_agent_platform/agent/__init__.py +6 -0
  22. soveren_agent_platform-0.2.0/src/soveren_agent_platform/agent/contracts.py +22 -0
  23. soveren_agent_platform-0.2.0/src/soveren_agent_platform/agent/worker.py +118 -0
  24. soveren_agent_platform-0.2.0/src/soveren_agent_platform/app_api/__init__.py +6 -0
  25. soveren_agent_platform-0.2.0/src/soveren_agent_platform/app_api/runtime.py +240 -0
  26. soveren_agent_platform-0.2.0/src/soveren_agent_platform/approvals/__init__.py +6 -0
  27. soveren_agent_platform-0.2.0/src/soveren_agent_platform/batching/__init__.py +20 -0
  28. soveren_agent_platform-0.2.0/src/soveren_agent_platform/batching/contracts.py +121 -0
  29. soveren_agent_platform-0.2.0/src/soveren_agent_platform/batching/rules.py +184 -0
  30. soveren_agent_platform-0.2.0/src/soveren_agent_platform/batching/sqlite.py +80 -0
  31. soveren_agent_platform-0.2.0/src/soveren_agent_platform/batching/store.py +253 -0
  32. soveren_agent_platform-0.2.0/src/soveren_agent_platform/batching/worker.py +274 -0
  33. soveren_agent_platform-0.2.0/src/soveren_agent_platform/context/__init__.py +33 -0
  34. soveren_agent_platform-0.2.0/src/soveren_agent_platform/context/builder.py +359 -0
  35. soveren_agent_platform-0.2.0/src/soveren_agent_platform/context/contracts.py +28 -0
  36. soveren_agent_platform-0.2.0/src/soveren_agent_platform/context/formatting.py +117 -0
  37. soveren_agent_platform-0.2.0/src/soveren_agent_platform/context/redaction.py +92 -0
  38. soveren_agent_platform-0.2.0/src/soveren_agent_platform/cron/__init__.py +19 -0
  39. soveren_agent_platform-0.2.0/src/soveren_agent_platform/cron/contracts.py +52 -0
  40. soveren_agent_platform-0.2.0/src/soveren_agent_platform/cron/queue_handler.py +34 -0
  41. soveren_agent_platform-0.2.0/src/soveren_agent_platform/cron/sqlite.py +64 -0
  42. soveren_agent_platform-0.2.0/src/soveren_agent_platform/cron/store.py +191 -0
  43. soveren_agent_platform-0.2.0/src/soveren_agent_platform/cron/worker.py +80 -0
  44. soveren_agent_platform-0.2.0/src/soveren_agent_platform/decisions/__init__.py +39 -0
  45. soveren_agent_platform-0.2.0/src/soveren_agent_platform/decisions/dispatcher.py +242 -0
  46. soveren_agent_platform-0.2.0/src/soveren_agent_platform/decisions/effects.py +45 -0
  47. soveren_agent_platform-0.2.0/src/soveren_agent_platform/decisions/registry.py +91 -0
  48. soveren_agent_platform-0.2.0/src/soveren_agent_platform/decisions/sqlite.py +104 -0
  49. soveren_agent_platform-0.2.0/src/soveren_agent_platform/interfaces/__init__.py +6 -0
  50. soveren_agent_platform-0.2.0/src/soveren_agent_platform/interfaces/channels.py +25 -0
  51. soveren_agent_platform-0.2.0/src/soveren_agent_platform/llm/__init__.py +19 -0
  52. soveren_agent_platform-0.2.0/src/soveren_agent_platform/llm/backends/__init__.py +15 -0
  53. soveren_agent_platform-0.2.0/src/soveren_agent_platform/llm/backends/openai_compatible.py +72 -0
  54. soveren_agent_platform-0.2.0/src/soveren_agent_platform/llm/backends/session.py +96 -0
  55. soveren_agent_platform-0.2.0/src/soveren_agent_platform/llm/contracts.py +39 -0
  56. soveren_agent_platform-0.2.0/src/soveren_agent_platform/outbound/__init__.py +19 -0
  57. soveren_agent_platform-0.2.0/src/soveren_agent_platform/outbound/contracts.py +60 -0
  58. soveren_agent_platform-0.2.0/src/soveren_agent_platform/outbound/registry.py +21 -0
  59. soveren_agent_platform-0.2.0/src/soveren_agent_platform/outbound/sqlite.py +73 -0
  60. soveren_agent_platform-0.2.0/src/soveren_agent_platform/outbound/store.py +169 -0
  61. soveren_agent_platform-0.2.0/src/soveren_agent_platform/outbound/worker.py +101 -0
  62. soveren_agent_platform-0.2.0/src/soveren_agent_platform/queue/__init__.py +6 -0
  63. soveren_agent_platform-0.2.0/src/soveren_agent_platform/queue/contracts.py +50 -0
  64. soveren_agent_platform-0.2.0/src/soveren_agent_platform/queue/durable.py +166 -0
  65. soveren_agent_platform-0.2.0/src/soveren_agent_platform/queue/sqlite.py +90 -0
  66. soveren_agent_platform-0.2.0/src/soveren_agent_platform/runs/__init__.py +7 -0
  67. soveren_agent_platform-0.2.0/src/soveren_agent_platform/runs/contracts.py +26 -0
  68. soveren_agent_platform-0.2.0/src/soveren_agent_platform/runs/sqlite.py +47 -0
  69. soveren_agent_platform-0.2.0/src/soveren_agent_platform/runs/store.py +47 -0
  70. soveren_agent_platform-0.2.0/src/soveren_agent_platform/runtime/__init__.py +24 -0
  71. soveren_agent_platform-0.2.0/src/soveren_agent_platform/runtime/planner.py +294 -0
  72. soveren_agent_platform-0.2.0/src/soveren_agent_platform/runtime/worker_loop.py +57 -0
  73. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/__init__.py +120 -0
  74. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/backend.py +43 -0
  75. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/backends/__init__.py +27 -0
  76. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/backends/codex_app_server.py +462 -0
  77. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/backends/codex_inspector.py +30 -0
  78. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/backends/codex_tools.py +142 -0
  79. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/backends/stub.py +40 -0
  80. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/backends/tmux.py +171 -0
  81. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/contracts.py +162 -0
  82. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/events.py +28 -0
  83. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/indexer_worker.py +137 -0
  84. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/inspector_registry.py +45 -0
  85. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/lifecycle.py +370 -0
  86. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/mailbox.py +213 -0
  87. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/mailbox_worker.py +242 -0
  88. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/registry.py +52 -0
  89. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/routing.py +328 -0
  90. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/snapshots.py +162 -0
  91. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/sqlite.py +255 -0
  92. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/store.py +86 -0
  93. soveren_agent_platform-0.2.0/src/soveren_agent_platform/sessions/tools.py +327 -0
  94. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/__init__.py +6 -0
  95. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/bootstrap.py +22 -0
  96. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/migrations/__init__.py +33 -0
  97. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/migrations/platform/001_event_queue.sql +27 -0
  98. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/migrations/platform/002_agent_runs.sql +17 -0
  99. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/migrations/platform/003_cron_jobs.sql +25 -0
  100. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/migrations/platform/004_inbound_batches.sql +39 -0
  101. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/migrations/platform/005_runtime_sessions.sql +50 -0
  102. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/migrations/platform/006_actions_and_outbound.sql +55 -0
  103. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/migrations/platform/007_session_routing.sql +57 -0
  104. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/migrations/runner.py +274 -0
  105. soveren_agent_platform-0.2.0/src/soveren_agent_platform/storage/sqlite.py +19 -0
  106. soveren_agent_platform-0.2.0/src/soveren_agent_platform/telegram/__init__.py +25 -0
  107. soveren_agent_platform-0.2.0/src/soveren_agent_platform/telegram/contracts.py +17 -0
  108. soveren_agent_platform-0.2.0/src/soveren_agent_platform/telegram/ingress.py +38 -0
  109. soveren_agent_platform-0.2.0/src/soveren_agent_platform/telegram/ptb.py +223 -0
  110. soveren_agent_platform-0.2.0/tests/test_actions_runtime.py +420 -0
  111. soveren_agent_platform-0.2.0/tests/test_agent_worker.py +107 -0
  112. soveren_agent_platform-0.2.0/tests/test_batching.py +252 -0
  113. soveren_agent_platform-0.2.0/tests/test_codex_app_server_backend.py +341 -0
  114. soveren_agent_platform-0.2.0/tests/test_context_builder.py +201 -0
  115. soveren_agent_platform-0.2.0/tests/test_context_formatting.py +66 -0
  116. soveren_agent_platform-0.2.0/tests/test_cron.py +133 -0
  117. soveren_agent_platform-0.2.0/tests/test_decision_dispatcher.py +248 -0
  118. soveren_agent_platform-0.2.0/tests/test_decisions_registry.py +79 -0
  119. soveren_agent_platform-0.2.0/tests/test_llm_contracts.py +91 -0
  120. soveren_agent_platform-0.2.0/tests/test_outbound_runtime.py +145 -0
  121. soveren_agent_platform-0.2.0/tests/test_planner_dispatch_e2e.py +140 -0
  122. soveren_agent_platform-0.2.0/tests/test_planner_runtime.py +352 -0
  123. soveren_agent_platform-0.2.0/tests/test_runs.py +59 -0
  124. soveren_agent_platform-0.2.0/tests/test_runtime_supervisor.py +110 -0
  125. soveren_agent_platform-0.2.0/tests/test_session_backend_registry.py +82 -0
  126. soveren_agent_platform-0.2.0/tests/test_session_backends.py +99 -0
  127. soveren_agent_platform-0.2.0/tests/test_session_indexer.py +108 -0
  128. soveren_agent_platform-0.2.0/tests/test_session_lifecycle.py +589 -0
  129. soveren_agent_platform-0.2.0/tests/test_session_mailbox.py +332 -0
  130. soveren_agent_platform-0.2.0/tests/test_session_routing.py +193 -0
  131. soveren_agent_platform-0.2.0/tests/test_session_tools.py +111 -0
  132. soveren_agent_platform-0.2.0/tests/test_storage_and_queue.py +251 -0
  133. soveren_agent_platform-0.2.0/tests/test_telegram_ingress.py +33 -0
  134. soveren_agent_platform-0.2.0/tests/test_telegram_ptb_adapter.py +209 -0
  135. soveren_agent_platform-0.2.0/tests/test_worker_loop.py +28 -0
  136. soveren_agent_platform-0.2.0/uv.lock +525 -0
@@ -0,0 +1,53 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ checks:
14
+ name: Python ${{ matrix.python-version }}
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ python-version:
20
+ - "3.12"
21
+ - "3.13"
22
+
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@v6
26
+
27
+ - name: Set up Python
28
+ uses: actions/setup-python@v6
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+
32
+ - name: Set up uv
33
+ uses: astral-sh/setup-uv@v8
34
+ with:
35
+ enable-cache: true
36
+
37
+ - name: Install dependencies
38
+ run: uv sync --group dev --locked
39
+
40
+ - name: Check lockfile
41
+ run: uv lock --check
42
+
43
+ - name: Lint
44
+ run: uv run ruff check src tests
45
+
46
+ - name: Type check
47
+ run: uv run mypy
48
+
49
+ - name: Test
50
+ run: uv run pytest
51
+
52
+ - name: Build distributions
53
+ run: uv build
@@ -0,0 +1,40 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ pypi:
13
+ name: Publish to PyPI
14
+ runs-on: ubuntu-latest
15
+ environment:
16
+ name: pypi
17
+ url: https://pypi.org/p/soveren-agent-platform
18
+ permissions:
19
+ contents: read
20
+ id-token: write
21
+
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v6
25
+
26
+ - name: Set up Python
27
+ uses: actions/setup-python@v6
28
+ with:
29
+ python-version: "3.13"
30
+
31
+ - name: Set up uv
32
+ uses: astral-sh/setup-uv@v8.3.1
33
+ with:
34
+ enable-cache: true
35
+
36
+ - name: Build distributions
37
+ run: uv build
38
+
39
+ - name: Publish to PyPI
40
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ .pytest_cache/
3
+ __pycache__/
4
+ *.py[cod]
5
+ *.sqlite
6
+ *.sqlite3
7
+ *.db
8
+ *.db-shm
9
+ *.db-wal
10
+ .DS_Store
11
+
@@ -0,0 +1,83 @@
1
+ # AGENTS.md
2
+
3
+ Guidance for coding agents working in this repository.
4
+
5
+ ## Read First
6
+
7
+ Before changing architecture or module boundaries, read:
8
+
9
+ - `docs/ARCHITECTURE.md` — current runtime architecture, module ownership,
10
+ event/session flows, extension rules, and package naming notes.
11
+ - `docs/API.md` — consumer-facing integration API, bootstrap contract, runtime
12
+ composition, and packaging/deployment dependency guidance.
13
+ - `docs/PORTS.md` — queue/store ports, adapter semantics, and persistence
14
+ boundaries.
15
+ - `docs/EXTRACTION_PLAN.md` — extraction history and rollout context.
16
+
17
+ This repo is the reusable runtime core. Keep product prompts, business tools,
18
+ private schema, product copy, and app-specific workflows in application repos.
19
+
20
+ ## Commands
21
+
22
+ Run from the repo root:
23
+
24
+ ```bash
25
+ uv sync --group dev
26
+ uv run ruff check src tests
27
+ uv run mypy
28
+ uv run pytest
29
+ ```
30
+
31
+ For a focused test:
32
+
33
+ ```bash
34
+ uv run pytest tests/test_session_mailbox.py
35
+ uv run pytest tests/test_session_mailbox.py::test_mailbox_drain_uses_session_and_mailbox_ports
36
+ ```
37
+
38
+ Before considering a code change done, run:
39
+
40
+ ```bash
41
+ uv run ruff check src tests && uv run mypy && uv run pytest
42
+ ```
43
+
44
+ ## Python Style
45
+
46
+ - Target Python is `>=3.12`.
47
+ - Use type annotations on public functions, protocols, dataclasses, worker
48
+ entrypoints, and adapter methods.
49
+ - Prefer `dataclass(slots=True)` or `dataclass(frozen=True, slots=True)` for
50
+ typed value objects.
51
+ - Use `Protocol` for runtime ports.
52
+ - Avoid untyped dictionaries at module boundaries. If payloads must be dynamic,
53
+ keep them at the edge and convert to typed objects quickly.
54
+ - Do not silence mypy unless there is a precise reason and a narrow comment.
55
+ - Keep imports sorted by `ruff`.
56
+
57
+ ## Engineering Rules
58
+
59
+ - Preserve the architecture documented in `docs/ARCHITECTURE.md`.
60
+ - Preserve port semantics documented in `docs/PORTS.md`.
61
+ - Do not introduce generic CRUD repositories.
62
+ - Do not split atomic runtime boundaries such as batch routing, action dispatch,
63
+ queue lease/retry, or session mailbox delivery.
64
+ - Do not make routers depend directly on Codex, Claude, tmux, or app-server
65
+ native APIs; route through generalized session snapshots and platform ports.
66
+ - Do not add app-owned tables or product seed data to platform migrations.
67
+ - If a new architectural boundary appears, update `docs/ARCHITECTURE.md` and
68
+ `docs/PORTS.md` in the same change.
69
+
70
+ ## Testing Expectations
71
+
72
+ Add or update tests when changing:
73
+
74
+ - queue lease/retry/idempotency behavior
75
+ - batching decisions or `route_batch`
76
+ - action dispatch and approval transitions
77
+ - mailbox/session status transitions
78
+ - snapshot/routing/indexing behavior
79
+ - migration/schema compatibility
80
+ - public composition APIs in `AgentPlatformApp`
81
+
82
+ Prefer focused unit tests around ports and fake adapters. Add integration-style
83
+ SQLite tests for transaction boundaries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Soveren
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,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: soveren-agent-platform
3
+ Version: 0.2.0
4
+ Summary: Reusable runtime core for durable agent applications.
5
+ Project-URL: Homepage, https://github.com/neureca/soveren-agent-platform
6
+ Project-URL: Repository, https://github.com/neureca/soveren-agent-platform
7
+ Project-URL: Issues, https://github.com/neureca/soveren-agent-platform/issues
8
+ Author: Soveren
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.12
12
+ Requires-Dist: pydantic>=2
13
+ Requires-Dist: python-dateutil>=2.8
14
+ Provides-Extra: telegram
15
+ Requires-Dist: python-telegram-bot>=21; extra == 'telegram'
16
+ Description-Content-Type: text/markdown
17
+
18
+ <p align="center">
19
+ <img src="docs/assets/soveren-logo.svg" width="96" height="96" alt="Soveren logo" />
20
+ </p>
21
+
22
+ <h1 align="center">Soveren Agent Platform</h1>
23
+
24
+ <p align="center">
25
+ Reusable runtime core for durable agent applications.
26
+ </p>
27
+
28
+ This repository is the extraction target for the shared runtime currently
29
+ implemented inside `poruchen`. It is intentionally separate from both
30
+ application repositories:
31
+
32
+ - `soveren-agent-platform` owns reusable mechanics: durable queueing, run tracking,
33
+ decision/action framework, batching, scheduler, sessions, integration
34
+ contracts, and bundled SQLite adapters for the default embedded runtime.
35
+ - `poruchen` owns private product behavior: prompts, ClickUp tools, approval
36
+ copy, policies, and app-specific schema.
37
+ - `pulsell-agent` owns Pulsell-specific media, transcription, vision, task, and
38
+ workflow behavior.
39
+
40
+ The first usable slice in this repo contains:
41
+
42
+ - SQLite connection setup
43
+ - durable queue port with a SQLite adapter
44
+ - layered migration runner with platform/app migration providers
45
+ - platform migrations for `event_queue` and `agent_runs`
46
+ - durable queue API
47
+ - inbound batching module with SQLite state and flush wakeups
48
+ - agent worker module that consumes queue events and calls app-provided agents
49
+ - cron module with due-job leasing and app-provided handlers
50
+ - Telegram interface module that normalizes Telegram ingress into queue events
51
+ - optional python-telegram-bot adapter for inbound normalization and outbound sending
52
+ - optional python-telegram-bot runtime builder with message and callback hooks
53
+ - LLM backend contracts and reusable OpenAI-compatible/session-backed backends
54
+ - agent run persistence helpers
55
+ - rich planner context builder for batches, sessions, mailbox, actions,
56
+ outbound, cron, and routing metadata
57
+ - optional app-neutral prompt formatter for rich planner context
58
+ - planner envelope that injects session routing and rich context into LLM
59
+ requests
60
+ - execution session mailbox for prompts queued behind busy sessions
61
+ - persistent execution-session events, snapshots, and deterministic routing
62
+ - reusable stub and tmux execution session backends
63
+ - reusable Codex app-server execution session backend
64
+ - Codex app-server dynamic tool contracts, registry, and fail-closed JSON-RPC
65
+ tool-call handling
66
+ - session backend registry for wiring reusable and custom backends
67
+ - platform SQLite migration and schema compatibility checks
68
+ - generic actions/approvals lifecycle with app-registered executors
69
+ - generic outbound channel queue with app-registered senders
70
+ - decision dispatcher that maps typed decisions to outbound, actions, session
71
+ mailbox, or cron side effects
72
+ - planner-dispatch helper for fake-tested context to side-effect pipelines
73
+ - runtime supervisor and `AgentPlatformApp` composition helper for standard
74
+ platform workers
75
+
76
+ See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the current architecture.
77
+ See [docs/API.md](docs/API.md) for the consumer integration API and quick start.
78
+ See [docs/EXTRACTION_PLAN.md](docs/EXTRACTION_PLAN.md) for the rollout plan.
79
+ See [docs/PORTS.md](docs/PORTS.md) for the queue/store abstraction strategy.
80
+
81
+ ## Consumer Quick Start
82
+
83
+ ```python
84
+ from pathlib import Path
85
+
86
+ from soveren_agent_platform.agent import AgentEvent, AgentHandler
87
+ from soveren_agent_platform.app_api import AgentPlatformApp
88
+
89
+
90
+ class AppAgentHandler(AgentHandler):
91
+ async def handle(self, event: AgentEvent) -> None:
92
+ ...
93
+
94
+
95
+ app = (
96
+ AgentPlatformApp(db_path=Path("data/app.db"))
97
+ .use_batching()
98
+ .use_agent(handler=AppAgentHandler())
99
+ )
100
+ ```
101
+
102
+ `AgentPlatformApp` applies and validates platform migrations before workers
103
+ start. Apps with a separate migration pipeline can call
104
+ `soveren_agent_platform.storage.bootstrap_platform_storage(db_path)` themselves and pass
105
+ `bootstrap_storage=False`.
106
+
107
+ ## Local Development
108
+
109
+ ```bash
110
+ uv sync --group dev
111
+ uv run ruff check src tests
112
+ uv run mypy
113
+ uv run pytest
114
+ ```
@@ -0,0 +1,97 @@
1
+ <p align="center">
2
+ <img src="docs/assets/soveren-logo.svg" width="96" height="96" alt="Soveren logo" />
3
+ </p>
4
+
5
+ <h1 align="center">Soveren Agent Platform</h1>
6
+
7
+ <p align="center">
8
+ Reusable runtime core for durable agent applications.
9
+ </p>
10
+
11
+ This repository is the extraction target for the shared runtime currently
12
+ implemented inside `poruchen`. It is intentionally separate from both
13
+ application repositories:
14
+
15
+ - `soveren-agent-platform` owns reusable mechanics: durable queueing, run tracking,
16
+ decision/action framework, batching, scheduler, sessions, integration
17
+ contracts, and bundled SQLite adapters for the default embedded runtime.
18
+ - `poruchen` owns private product behavior: prompts, ClickUp tools, approval
19
+ copy, policies, and app-specific schema.
20
+ - `pulsell-agent` owns Pulsell-specific media, transcription, vision, task, and
21
+ workflow behavior.
22
+
23
+ The first usable slice in this repo contains:
24
+
25
+ - SQLite connection setup
26
+ - durable queue port with a SQLite adapter
27
+ - layered migration runner with platform/app migration providers
28
+ - platform migrations for `event_queue` and `agent_runs`
29
+ - durable queue API
30
+ - inbound batching module with SQLite state and flush wakeups
31
+ - agent worker module that consumes queue events and calls app-provided agents
32
+ - cron module with due-job leasing and app-provided handlers
33
+ - Telegram interface module that normalizes Telegram ingress into queue events
34
+ - optional python-telegram-bot adapter for inbound normalization and outbound sending
35
+ - optional python-telegram-bot runtime builder with message and callback hooks
36
+ - LLM backend contracts and reusable OpenAI-compatible/session-backed backends
37
+ - agent run persistence helpers
38
+ - rich planner context builder for batches, sessions, mailbox, actions,
39
+ outbound, cron, and routing metadata
40
+ - optional app-neutral prompt formatter for rich planner context
41
+ - planner envelope that injects session routing and rich context into LLM
42
+ requests
43
+ - execution session mailbox for prompts queued behind busy sessions
44
+ - persistent execution-session events, snapshots, and deterministic routing
45
+ - reusable stub and tmux execution session backends
46
+ - reusable Codex app-server execution session backend
47
+ - Codex app-server dynamic tool contracts, registry, and fail-closed JSON-RPC
48
+ tool-call handling
49
+ - session backend registry for wiring reusable and custom backends
50
+ - platform SQLite migration and schema compatibility checks
51
+ - generic actions/approvals lifecycle with app-registered executors
52
+ - generic outbound channel queue with app-registered senders
53
+ - decision dispatcher that maps typed decisions to outbound, actions, session
54
+ mailbox, or cron side effects
55
+ - planner-dispatch helper for fake-tested context to side-effect pipelines
56
+ - runtime supervisor and `AgentPlatformApp` composition helper for standard
57
+ platform workers
58
+
59
+ See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the current architecture.
60
+ See [docs/API.md](docs/API.md) for the consumer integration API and quick start.
61
+ See [docs/EXTRACTION_PLAN.md](docs/EXTRACTION_PLAN.md) for the rollout plan.
62
+ See [docs/PORTS.md](docs/PORTS.md) for the queue/store abstraction strategy.
63
+
64
+ ## Consumer Quick Start
65
+
66
+ ```python
67
+ from pathlib import Path
68
+
69
+ from soveren_agent_platform.agent import AgentEvent, AgentHandler
70
+ from soveren_agent_platform.app_api import AgentPlatformApp
71
+
72
+
73
+ class AppAgentHandler(AgentHandler):
74
+ async def handle(self, event: AgentEvent) -> None:
75
+ ...
76
+
77
+
78
+ app = (
79
+ AgentPlatformApp(db_path=Path("data/app.db"))
80
+ .use_batching()
81
+ .use_agent(handler=AppAgentHandler())
82
+ )
83
+ ```
84
+
85
+ `AgentPlatformApp` applies and validates platform migrations before workers
86
+ start. Apps with a separate migration pipeline can call
87
+ `soveren_agent_platform.storage.bootstrap_platform_storage(db_path)` themselves and pass
88
+ `bootstrap_storage=False`.
89
+
90
+ ## Local Development
91
+
92
+ ```bash
93
+ uv sync --group dev
94
+ uv run ruff check src tests
95
+ uv run mypy
96
+ uv run pytest
97
+ ```