maof 1.0.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 (218) hide show
  1. maof-1.0.0/.dockerignore +8 -0
  2. maof-1.0.0/.github/workflows/ci.yml +105 -0
  3. maof-1.0.0/.github/workflows/codeql.yml +31 -0
  4. maof-1.0.0/.github/workflows/release.yml +71 -0
  5. maof-1.0.0/.gitignore +75 -0
  6. maof-1.0.0/CHANGELOG.md +48 -0
  7. maof-1.0.0/CONTRIBUTING.md +85 -0
  8. maof-1.0.0/LICENSE +201 -0
  9. maof-1.0.0/NOTICE +8 -0
  10. maof-1.0.0/PKG-INFO +214 -0
  11. maof-1.0.0/README.md +102 -0
  12. maof-1.0.0/SECURITY.md +45 -0
  13. maof-1.0.0/docker/approval.Dockerfile +19 -0
  14. maof-1.0.0/docker/orchestrator.Dockerfile +22 -0
  15. maof-1.0.0/docker/worker.Dockerfile +20 -0
  16. maof-1.0.0/docker-compose.test.yml +57 -0
  17. maof-1.0.0/docker-compose.yml +113 -0
  18. maof-1.0.0/docs/ARCHITECTURE.md +487 -0
  19. maof-1.0.0/docs/QA.md +213 -0
  20. maof-1.0.0/docs/coordination-modes.md +53 -0
  21. maof-1.0.0/docs/deployment.md +161 -0
  22. maof-1.0.0/docs/publishing.md +92 -0
  23. maof-1.0.0/examples/__init__.py +1 -0
  24. maof-1.0.0/examples/po_demo/__init__.py +2 -0
  25. maof-1.0.0/examples/po_demo/agents.py +136 -0
  26. maof-1.0.0/examples/po_demo/consumers.yaml +34 -0
  27. maof-1.0.0/examples/po_demo/demo.py +204 -0
  28. maof-1.0.0/examples/po_demo/main.py +82 -0
  29. maof-1.0.0/examples/po_demo/main_distributed.py +383 -0
  30. maof-1.0.0/examples/po_demo/qa/eval_spendcap.json +55 -0
  31. maof-1.0.0/examples/po_demo/qa/shady-broker.manifest.json +11 -0
  32. maof-1.0.0/examples/po_demo/qa_interactive.py +294 -0
  33. maof-1.0.0/examples/po_demo/qa_llm.py +282 -0
  34. maof-1.0.0/examples/po_demo/register.py +20 -0
  35. maof-1.0.0/examples/po_demo/rules/spend-cap.yaml +48 -0
  36. maof-1.0.0/examples/po_demo/scenario.py +524 -0
  37. maof-1.0.0/examples/po_demo/schemas/delivery_metrics.v1.json +11 -0
  38. maof-1.0.0/examples/po_demo/schemas/funds_commit.v1.json +11 -0
  39. maof-1.0.0/examples/po_demo/schemas/order_placement.v1.json +11 -0
  40. maof-1.0.0/examples/po_demo/schemas/purchase_plan.v1.json +11 -0
  41. maof-1.0.0/examples/po_demo/schemas/shipment_prep.v1.json +11 -0
  42. maof-1.0.0/examples/po_demo/truth.py +127 -0
  43. maof-1.0.0/examples/po_demo/workflows/po-cycle.yaml +60 -0
  44. maof-1.0.0/examples/quickstart/README.md +30 -0
  45. maof-1.0.0/examples/quickstart/__init__.py +4 -0
  46. maof-1.0.0/examples/quickstart/agent.py +25 -0
  47. maof-1.0.0/examples/quickstart/main.py +91 -0
  48. maof-1.0.0/pyproject.toml +178 -0
  49. maof-1.0.0/src/maof/__init__.py +73 -0
  50. maof-1.0.0/src/maof/agents/__init__.py +0 -0
  51. maof-1.0.0/src/maof/agents/base.py +74 -0
  52. maof-1.0.0/src/maof/agents/client.py +199 -0
  53. maof-1.0.0/src/maof/agents/mcp_adapter.py +138 -0
  54. maof-1.0.0/src/maof/agents/registry_runtime.py +92 -0
  55. maof-1.0.0/src/maof/approval/__init__.py +0 -0
  56. maof-1.0.0/src/maof/approval/service.py +265 -0
  57. maof-1.0.0/src/maof/approval/tokens.py +28 -0
  58. maof-1.0.0/src/maof/authz.py +118 -0
  59. maof-1.0.0/src/maof/cli.py +515 -0
  60. maof-1.0.0/src/maof/config.py +186 -0
  61. maof-1.0.0/src/maof/context/__init__.py +0 -0
  62. maof-1.0.0/src/maof/context/budget.py +86 -0
  63. maof-1.0.0/src/maof/context/builder.py +81 -0
  64. maof-1.0.0/src/maof/context/compaction.py +98 -0
  65. maof-1.0.0/src/maof/context/jit.py +56 -0
  66. maof-1.0.0/src/maof/context/notes.py +79 -0
  67. maof-1.0.0/src/maof/context/redactor.py +69 -0
  68. maof-1.0.0/src/maof/context/sources/__init__.py +0 -0
  69. maof-1.0.0/src/maof/context/sources/builtins.py +87 -0
  70. maof-1.0.0/src/maof/cost/__init__.py +0 -0
  71. maof-1.0.0/src/maof/cost/accounting.py +106 -0
  72. maof-1.0.0/src/maof/errors.py +71 -0
  73. maof-1.0.0/src/maof/eval/__init__.py +0 -0
  74. maof-1.0.0/src/maof/eval/judge.py +80 -0
  75. maof-1.0.0/src/maof/eval/rubrics.py +49 -0
  76. maof-1.0.0/src/maof/eval/runner.py +89 -0
  77. maof-1.0.0/src/maof/identity.py +192 -0
  78. maof-1.0.0/src/maof/memory/__init__.py +0 -0
  79. maof-1.0.0/src/maof/memory/base.py +48 -0
  80. maof-1.0.0/src/maof/memory/pgvector.py +71 -0
  81. maof-1.0.0/src/maof/memory/service.py +53 -0
  82. maof-1.0.0/src/maof/models/__init__.py +0 -0
  83. maof-1.0.0/src/maof/models/anthropic.py +59 -0
  84. maof-1.0.0/src/maof/models/azure_openai.py +53 -0
  85. maof-1.0.0/src/maof/models/base.py +205 -0
  86. maof-1.0.0/src/maof/models/bedrock.py +61 -0
  87. maof-1.0.0/src/maof/models/cohere.py +53 -0
  88. maof-1.0.0/src/maof/models/gateway.py +78 -0
  89. maof-1.0.0/src/maof/models/mistral.py +53 -0
  90. maof-1.0.0/src/maof/models/ollama.py +89 -0
  91. maof-1.0.0/src/maof/models/openai.py +91 -0
  92. maof-1.0.0/src/maof/models/vertex_gemini.py +60 -0
  93. maof-1.0.0/src/maof/observability/__init__.py +0 -0
  94. maof-1.0.0/src/maof/observability/events.py +51 -0
  95. maof-1.0.0/src/maof/observability/otel.py +92 -0
  96. maof-1.0.0/src/maof/observability/sinks/__init__.py +0 -0
  97. maof-1.0.0/src/maof/observability/sinks/postgres_sink.py +39 -0
  98. maof-1.0.0/src/maof/observability/sinks/stdout_sink.py +29 -0
  99. maof-1.0.0/src/maof/observability/sinks/webhook_sink.py +172 -0
  100. maof-1.0.0/src/maof/observability/trajectory.py +58 -0
  101. maof-1.0.0/src/maof/orchestrator/__init__.py +0 -0
  102. maof-1.0.0/src/maof/orchestrator/context_delegation.py +84 -0
  103. maof-1.0.0/src/maof/orchestrator/coordinator.py +252 -0
  104. maof-1.0.0/src/maof/orchestrator/delegation.py +44 -0
  105. maof-1.0.0/src/maof/orchestrator/l1.py +172 -0
  106. maof-1.0.0/src/maof/orchestrator/lifecycle.py +444 -0
  107. maof-1.0.0/src/maof/orchestrator/loop.py +123 -0
  108. maof-1.0.0/src/maof/orchestrator/messages.py +130 -0
  109. maof-1.0.0/src/maof/orchestrator/pipeline.py +71 -0
  110. maof-1.0.0/src/maof/orchestrator/stages/__init__.py +18 -0
  111. maof-1.0.0/src/maof/orchestrator/stages/action_plan.py +81 -0
  112. maof-1.0.0/src/maof/orchestrator/stages/approval.py +53 -0
  113. maof-1.0.0/src/maof/orchestrator/stages/chat.py +27 -0
  114. maof-1.0.0/src/maof/orchestrator/stages/intent.py +31 -0
  115. maof-1.0.0/src/maof/orchestrator/stages/publish.py +79 -0
  116. maof-1.0.0/src/maof/persistence/__init__.py +0 -0
  117. maof-1.0.0/src/maof/persistence/base.py +116 -0
  118. maof-1.0.0/src/maof/persistence/migrations/0001_init.sql +229 -0
  119. maof-1.0.0/src/maof/persistence/postgres.py +433 -0
  120. maof-1.0.0/src/maof/policy/__init__.py +0 -0
  121. maof-1.0.0/src/maof/policy/actions.py +86 -0
  122. maof-1.0.0/src/maof/policy/dsl.py +97 -0
  123. maof-1.0.0/src/maof/policy/engine.py +228 -0
  124. maof-1.0.0/src/maof/policy/rulesets.py +35 -0
  125. maof-1.0.0/src/maof/py.typed +0 -0
  126. maof-1.0.0/src/maof/registry/__init__.py +0 -0
  127. maof-1.0.0/src/maof/registry/a2a.py +113 -0
  128. maof-1.0.0/src/maof/registry/admin_api.py +71 -0
  129. maof-1.0.0/src/maof/registry/loader.py +106 -0
  130. maof-1.0.0/src/maof/registry/models.py +71 -0
  131. maof-1.0.0/src/maof/registry/search.py +88 -0
  132. maof-1.0.0/src/maof/registry/signing.py +73 -0
  133. maof-1.0.0/src/maof/registry/store.py +121 -0
  134. maof-1.0.0/src/maof/runs/__init__.py +0 -0
  135. maof-1.0.0/src/maof/runs/artifacts.py +92 -0
  136. maof-1.0.0/src/maof/runs/checkpoint.py +102 -0
  137. maof-1.0.0/src/maof/runs/idempotency.py +95 -0
  138. maof-1.0.0/src/maof/runs/ops.py +198 -0
  139. maof-1.0.0/src/maof/runs/retention.py +61 -0
  140. maof-1.0.0/src/maof/runs/store.py +179 -0
  141. maof-1.0.0/src/maof/schemas/__init__.py +0 -0
  142. maof-1.0.0/src/maof/schemas/registry.py +64 -0
  143. maof-1.0.0/src/maof/tenancy.py +30 -0
  144. maof-1.0.0/src/maof/transport/__init__.py +0 -0
  145. maof-1.0.0/src/maof/transport/base.py +43 -0
  146. maof-1.0.0/src/maof/transport/consumers.py +134 -0
  147. maof-1.0.0/src/maof/transport/factory.py +50 -0
  148. maof-1.0.0/src/maof/transport/fake.py +114 -0
  149. maof-1.0.0/src/maof/transport/kafka.py +134 -0
  150. maof-1.0.0/src/maof/transport/rabbitmq.py +208 -0
  151. maof-1.0.0/src/maof/transport/redis.py +126 -0
  152. maof-1.0.0/src/maof/transport/retry.py +50 -0
  153. maof-1.0.0/src/maof/transport/signing.py +327 -0
  154. maof-1.0.0/src/maof/transport/sqs.py +136 -0
  155. maof-1.0.0/src/maof/transport/wire.py +34 -0
  156. maof-1.0.0/src/maof/types.py +518 -0
  157. maof-1.0.0/src/maof/workers/__init__.py +0 -0
  158. maof-1.0.0/src/maof/workers/pool.py +172 -0
  159. maof-1.0.0/src/maof/workflows/__init__.py +1 -0
  160. maof-1.0.0/src/maof/workflows/definition.py +117 -0
  161. maof-1.0.0/src/maof/workflows/executor.py +184 -0
  162. maof-1.0.0/src/maof/workflows/promote.py +124 -0
  163. maof-1.0.0/src/maof/workflows/store.py +244 -0
  164. maof-1.0.0/tests/conftest.py +35 -0
  165. maof-1.0.0/tests/fixtures/mcp_echo_server.py +38 -0
  166. maof-1.0.0/tests/test_a2a_real.py +93 -0
  167. maof-1.0.0/tests/test_admin_api.py +52 -0
  168. maof-1.0.0/tests/test_authz.py +107 -0
  169. maof-1.0.0/tests/test_authz_coverage.py +149 -0
  170. maof-1.0.0/tests/test_broker_fake.py +80 -0
  171. maof-1.0.0/tests/test_consumers.py +86 -0
  172. maof-1.0.0/tests/test_context.py +183 -0
  173. maof-1.0.0/tests/test_contracts.py +265 -0
  174. maof-1.0.0/tests/test_cost.py +71 -0
  175. maof-1.0.0/tests/test_durable.py +166 -0
  176. maof-1.0.0/tests/test_eval.py +117 -0
  177. maof-1.0.0/tests/test_governance.py +254 -0
  178. maof-1.0.0/tests/test_hosting.py +420 -0
  179. maof-1.0.0/tests/test_identity.py +235 -0
  180. maof-1.0.0/tests/test_identity_oidc.py +153 -0
  181. maof-1.0.0/tests/test_kafka.py +111 -0
  182. maof-1.0.0/tests/test_kafka_unit.py +131 -0
  183. maof-1.0.0/tests/test_key_providers.py +113 -0
  184. maof-1.0.0/tests/test_lifecycle.py +383 -0
  185. maof-1.0.0/tests/test_mcp_real.py +72 -0
  186. maof-1.0.0/tests/test_memory.py +142 -0
  187. maof-1.0.0/tests/test_models.py +329 -0
  188. maof-1.0.0/tests/test_observability.py +69 -0
  189. maof-1.0.0/tests/test_ops_completion.py +188 -0
  190. maof-1.0.0/tests/test_orchestration.py +290 -0
  191. maof-1.0.0/tests/test_otel_unit.py +56 -0
  192. maof-1.0.0/tests/test_persistence.py +249 -0
  193. maof-1.0.0/tests/test_pipeline_hooks.py +48 -0
  194. maof-1.0.0/tests/test_po_demo.py +75 -0
  195. maof-1.0.0/tests/test_policy.py +308 -0
  196. maof-1.0.0/tests/test_promote.py +309 -0
  197. maof-1.0.0/tests/test_quickstart.py +10 -0
  198. maof-1.0.0/tests/test_rabbitmq.py +43 -0
  199. maof-1.0.0/tests/test_rabbitmq_unit.py +248 -0
  200. maof-1.0.0/tests/test_redis.py +113 -0
  201. maof-1.0.0/tests/test_redis_unit.py +125 -0
  202. maof-1.0.0/tests/test_registry.py +227 -0
  203. maof-1.0.0/tests/test_registry_intel.py +208 -0
  204. maof-1.0.0/tests/test_registry_runtime.py +72 -0
  205. maof-1.0.0/tests/test_retry.py +35 -0
  206. maof-1.0.0/tests/test_runs_ops.py +118 -0
  207. maof-1.0.0/tests/test_s3_artifacts_unit.py +72 -0
  208. maof-1.0.0/tests/test_scenario.py +233 -0
  209. maof-1.0.0/tests/test_schemas.py +80 -0
  210. maof-1.0.0/tests/test_security_hardening.py +54 -0
  211. maof-1.0.0/tests/test_signing.py +74 -0
  212. maof-1.0.0/tests/test_sqs.py +109 -0
  213. maof-1.0.0/tests/test_sqs_unit.py +144 -0
  214. maof-1.0.0/tests/test_tier2.py +253 -0
  215. maof-1.0.0/tests/test_transport_factory.py +68 -0
  216. maof-1.0.0/tests/test_vector.py +44 -0
  217. maof-1.0.0/tests/test_webhook_sink.py +105 -0
  218. maof-1.0.0/tests/test_workflows.py +478 -0
@@ -0,0 +1,8 @@
1
+ .git
2
+ .venv
3
+ __pycache__
4
+ # only the tracked reference example is baked into images
5
+ examples/*
6
+ !examples/__init__.py
7
+ !examples/po_demo/
8
+ tests/
@@ -0,0 +1,105 @@
1
+ # MAOF CI: lint, format, strict types, tests (with live
2
+ # Postgres+pgvector), the eval gate on the sample dataset, and a supply-chain
3
+ # job (dependency vulnerability audit + CycloneDX SBOM artifact).
4
+ name: ci
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ pull_request:
10
+
11
+ jobs:
12
+ checks:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version: ["3.11", "3.12"]
18
+ services:
19
+ postgres:
20
+ image: pgvector/pgvector:pg16
21
+ env:
22
+ POSTGRES_USER: maof
23
+ POSTGRES_PASSWORD: maof
24
+ POSTGRES_DB: maof
25
+ ports: ["5432:5432"]
26
+ options: >-
27
+ --health-cmd "pg_isready -U maof -d maof"
28
+ --health-interval 5s
29
+ --health-timeout 5s
30
+ --health-retries 20
31
+ env:
32
+ MAOF_TEST_DATABASE_URL: postgresql://maof:maof@localhost:5432/maof
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ - uses: actions/setup-python@v5
36
+ with:
37
+ python-version: ${{ matrix.python-version }}
38
+ - name: Install
39
+ run: pip install -e ".[dev,postgres]"
40
+ - name: Lint (ruff)
41
+ run: ruff check src tests examples
42
+ - name: Format (black)
43
+ run: black --check src tests examples
44
+ - name: Types (mypy --strict)
45
+ run: mypy src/maof
46
+ - name: Tests (coverage floor 85%)
47
+ run: pytest --cov=maof --cov-report=term --cov-fail-under=85
48
+ - name: Eval gate (sample dataset)
49
+ run: pytest -q tests/test_eval.py tests/test_po_demo.py::test_eval_gate
50
+
51
+ supply-chain:
52
+ runs-on: ubuntu-latest
53
+ steps:
54
+ - uses: actions/checkout@v4
55
+ - uses: actions/setup-python@v5
56
+ with:
57
+ python-version: "3.12"
58
+ - name: Install (full dependency surface)
59
+ run: |
60
+ pip install --upgrade pip
61
+ pip install ".[all,dev]"
62
+ pip install pip-audit cyclonedx-bom
63
+ - name: Vulnerability audit (pip-audit)
64
+ run: pip-audit --skip-editable
65
+ - name: SBOM (CycloneDX)
66
+ run: cyclonedx-py environment --output-format JSON -o sbom.cdx.json
67
+ - name: Upload SBOM artifact
68
+ uses: actions/upload-artifact@v4
69
+ with:
70
+ name: sbom
71
+ path: sbom.cdx.json
72
+
73
+ # Exercises the broker adapters against real brokers (the `live`-marked suite,
74
+ # deselected by the default offline run). Brokers come from docker-compose.test.yml.
75
+ integration:
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - uses: actions/checkout@v4
79
+ - uses: actions/setup-python@v5
80
+ with:
81
+ python-version: "3.12"
82
+ - name: Start brokers
83
+ run: docker compose -f docker-compose.test.yml up -d --wait
84
+ - name: Install (all adapters)
85
+ run: |
86
+ pip install --upgrade pip
87
+ pip install -e ".[all,dev]"
88
+ - name: Wait for SQS (ElasticMQ has no compose healthcheck)
89
+ run: |
90
+ for _ in $(seq 1 30); do
91
+ curl -sf "http://127.0.0.1:14566/?Action=ListQueues" >/dev/null 2>&1 && break
92
+ sleep 2
93
+ done
94
+ - name: Live broker integration tests
95
+ env:
96
+ MAOF_TEST_RABBITMQ_URL: amqp://guest:guest@127.0.0.1:5672/
97
+ MAOF_TEST_REDIS_URL: redis://127.0.0.1:16379/0
98
+ MAOF_TEST_KAFKA_URL: 127.0.0.1:19092
99
+ MAOF_TEST_SQS_URL: http://127.0.0.1:14566
100
+ AWS_ACCESS_KEY_ID: test
101
+ AWS_SECRET_ACCESS_KEY: test
102
+ run: pytest -m live tests/test_rabbitmq.py tests/test_kafka.py tests/test_redis.py tests/test_sqs.py -q
103
+ - name: Broker logs (on failure)
104
+ if: failure()
105
+ run: docker compose -f docker-compose.test.yml logs --tail=200
@@ -0,0 +1,31 @@
1
+ # CodeQL static analysis (SAST) for the Python sources.
2
+ name: codeql
3
+
4
+ on:
5
+ push:
6
+ branches: [main]
7
+ pull_request:
8
+ branches: [main]
9
+ schedule:
10
+ - cron: "0 3 * * 1" # weekly, Monday 03:00 UTC
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ analyze:
17
+ runs-on: ubuntu-latest
18
+ # Code scanning upload needs a public repo (or GitHub Advanced Security). Skip
19
+ # while user-owned + private; auto-runs once the repo is public.
20
+ if: ${{ github.event.repository.visibility == 'public' }}
21
+ permissions:
22
+ security-events: write
23
+ actions: read
24
+ contents: read
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - uses: github/codeql-action/init@v3
28
+ with:
29
+ languages: python
30
+ queries: security-and-quality
31
+ - uses: github/codeql-action/analyze@v3
@@ -0,0 +1,71 @@
1
+ # MAOF release (docs/publishing.md): on a version tag, build + validate +
2
+ # checksum + attest, then publish to PyPI via Trusted Publishing (OIDC) — no
3
+ # stored credentials. Provenance comes from GitHub artifact attestation (verify
4
+ # with `gh attestation verify`) plus PEP 740 attestations shown on the PyPI page.
5
+ name: release
6
+
7
+ on:
8
+ push:
9
+ tags: ["v*"]
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ build:
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ contents: read
19
+ id-token: write # sigstore-backed build provenance attestation
20
+ attestations: write
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: "3.12"
26
+ - name: Build
27
+ run: |
28
+ pip install build twine
29
+ python -m build
30
+ - name: Validate metadata (twine check)
31
+ run: twine check dist/*
32
+ - name: Checksums
33
+ # Written outside dist/ so the publish job uploads only the wheel + sdist.
34
+ run: shasum -a 256 dist/* | tee SHA256SUMS
35
+ - name: Attest build provenance
36
+ # GitHub artifact attestation is unavailable for user-owned private repos;
37
+ # skip while private (the build still ships validated, checksummed dists).
38
+ if: ${{ github.event.repository.visibility == 'public' }}
39
+ uses: actions/attest-build-provenance@v2
40
+ with:
41
+ subject-path: "dist/*.whl,dist/*.tar.gz"
42
+ - name: Upload distributions
43
+ uses: actions/upload-artifact@v4
44
+ with:
45
+ name: dist
46
+ path: dist/
47
+ - name: Upload checksums
48
+ uses: actions/upload-artifact@v4
49
+ with:
50
+ name: checksums
51
+ path: SHA256SUMS
52
+
53
+ publish:
54
+ needs: build
55
+ runs-on: ubuntu-latest
56
+ environment:
57
+ name: pypi
58
+ url: https://pypi.org/p/maof
59
+ permissions:
60
+ id-token: write # OIDC token PyPI exchanges for a one-time upload token
61
+ steps:
62
+ - name: Download distributions
63
+ uses: actions/download-artifact@v4
64
+ with:
65
+ name: dist
66
+ path: dist/
67
+ - name: Publish to PyPI
68
+ uses: pypa/gh-action-pypi-publish@release/v1
69
+ with:
70
+ # PEP 740 attestations need a public repo; enable them once public.
71
+ attestations: ${{ github.event.repository.visibility == 'public' }}
maof-1.0.0/.gitignore ADDED
@@ -0,0 +1,75 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ downloads/
10
+ eggs/
11
+ .eggs/
12
+ *.egg-info/
13
+ *.egg
14
+ wheels/
15
+ share/python-wheels/
16
+ MANIFEST
17
+
18
+ # Virtual environments
19
+ .venv/
20
+ venv/
21
+ env/
22
+ ENV/
23
+ .python-version
24
+
25
+ # Packaging / build backends
26
+ .hatch/
27
+
28
+ # Test / coverage / type / lint caches
29
+ .pytest_cache/
30
+ .mypy_cache/
31
+ .ruff_cache/
32
+ .coverage
33
+ .coverage.*
34
+ htmlcov/
35
+ coverage.xml
36
+ .tox/
37
+ .nox/
38
+
39
+ # Type checking
40
+ .dmypy.json
41
+ dmypy.json
42
+
43
+ # Environments / secrets
44
+ .env
45
+ .env.*
46
+ *.local
47
+
48
+ # pip / private index credentials (never commit)
49
+ pip.conf
50
+ .pypirc
51
+
52
+ # IDE / OS
53
+ .idea/
54
+ .vscode/
55
+ *.swp
56
+ .DS_Store
57
+
58
+ # Local data / artifacts (durable run store, artifact store, etc. when run locally)
59
+ *.db
60
+ *.sqlite3
61
+ /data/
62
+ /artifacts/
63
+
64
+ # Only the tracked examples ship; any other example dir is local-only.
65
+ examples/*
66
+ !examples/__init__.py
67
+ !examples/po_demo/
68
+ !examples/quickstart/
69
+
70
+ # Local-only live/integration evaluation tests (need running services; see tests/local/README.md).
71
+ tests/local/
72
+
73
+ # Local-only build/agent context — not for end users (kept on disk, out of git and sdists).
74
+ /CLAUDE.md
75
+ /docs/DESIGN.md
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ All notable changes to MAOF are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-06-24
9
+
10
+ Initial public release of MAOF: the reusable orchestration and governance layer of a hierarchical
11
+ (L1 → L2) multi-agent system, shipping zero domain content.
12
+
13
+ ### Added
14
+
15
+ - Two coordination modes: governed async queue dispatch and in-process context-shared subagents.
16
+ - Workflow-as-data: a pluggable workflow pipeline, an autonomous orchestrator loop, and signed YAML
17
+ workflow definitions; plus `maof runs promote` to derive a reusable workflow from a successful run
18
+ (resolved agent versions captured as per-step pins).
19
+ - Full execution lifecycle: signed result envelopes, wait/resume from checkpoint, cooperative
20
+ cancellation, and a runs API/CLI (`list|show|trace|cancel|wake|promote`).
21
+ - Governance: policy-as-code (pre/post-result hooks, versioned + canary rulesets), N-of-M role-bound
22
+ multi-party HITL approvals, multi-tenancy, a `Principal` identity threaded through runs, audit, and
23
+ approvals, and scope-based bring-your-own RBAC (`require_scopes`, `PRINCIPAL_*`, an injectable
24
+ `principal_resolver`) gating every admin mutation across runs, workflows, and the registry.
25
+ - Source-of-truth agent hosting, context-engineering layer (budgeting, compaction, JIT retrieval),
26
+ durable execution (checkpoint/resume, idempotency keys, artifact store).
27
+ - Admin-gated signed discovery registry (MCP + A2A) with semantic capability search and per-version
28
+ canary cohorts.
29
+ - Provider-agnostic LLM/embedding support (all major SDKs + gateway + BYO), OpenTelemetry-based
30
+ observability, cost/token ledger, and an evaluation harness with a CI gate.
31
+ - `examples/po_demo` reference scenario running end-to-end with zero edits to `src/maof`, and
32
+ `examples/quickstart/` — a minimal, offline, in-process governed run (one agent).
33
+ - Startup security warnings for insecure dev defaults; graceful worker shutdown on `SIGTERM`/`SIGINT`.
34
+ - CI: CodeQL (SAST), a Python 3.11/3.12 test matrix, and live broker integration tests (RabbitMQ,
35
+ Kafka, Redis, SQS) via `docker-compose.test.yml`.
36
+ - Open-source release under the Apache License 2.0, published to PyPI via Trusted Publishing.
37
+
38
+ ### Security
39
+
40
+ - Message signing is safe-by-default: `Settings.require_signature` defaults to `true`, and
41
+ `maof run-worker` refuses to start when signing is required but no key is configured.
42
+
43
+ ### Changed
44
+
45
+ - Core dependencies carry upper-version caps (`pydantic<3`, `httpx<1`, `jsonschema<5`, …) for
46
+ reproducible installs.
47
+
48
+ [1.0.0]: https://github.com/jthompson18/maof/releases/tag/v1.0.0
@@ -0,0 +1,85 @@
1
+ # Contributing to MAOF
2
+
3
+ ## Development setup
4
+
5
+ ```bash
6
+ python -m venv .venv && source .venv/bin/activate
7
+ pip install -e ".[dev]" # add ,postgres etc. for adapter work
8
+ ```
9
+
10
+ Optional live infra for integration tests (skipped if absent):
11
+
12
+ ```bash
13
+ docker run -d --name maof-pg -e POSTGRES_USER=maof -e POSTGRES_PASSWORD=maof \
14
+ -e POSTGRES_DB=maof -p 5432:5432 pgvector/pgvector:pg16
15
+ export MAOF_TEST_DATABASE_URL=postgresql://maof:maof@127.0.0.1:5432/maof
16
+ ```
17
+
18
+ ## Quality bar (must stay green)
19
+
20
+ ```bash
21
+ mypy src/maof # --strict, clean
22
+ ruff check src tests examples
23
+ black --check src tests examples
24
+ pytest -q # DB/broker integration tests skip when infra is absent
25
+ ```
26
+
27
+ ## Integration tests (live brokers)
28
+
29
+ The broker adapters have live integration tests (`tests/test_{rabbitmq,kafka,redis,sqs}.py`),
30
+ marked `live` and deselected by the default offline run. To run them against real brokers:
31
+
32
+ ```bash
33
+ docker compose -f docker-compose.test.yml up -d --wait
34
+ export MAOF_TEST_RABBITMQ_URL=amqp://guest:guest@127.0.0.1:5672/
35
+ export MAOF_TEST_REDIS_URL=redis://127.0.0.1:16379/0
36
+ export MAOF_TEST_KAFKA_URL=127.0.0.1:19092
37
+ export MAOF_TEST_SQS_URL=http://127.0.0.1:14566
38
+ export AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test
39
+ pytest -m live tests/test_rabbitmq.py tests/test_kafka.py tests/test_redis.py tests/test_sqs.py
40
+ docker compose -f docker-compose.test.yml down -v
41
+ ```
42
+
43
+ CI runs the same suite in the `integration` job.
44
+
45
+ ## Methodology
46
+
47
+ - **TDD.** Write the failing test first (from the acceptance criteria), then implement to green.
48
+ - **Lock contracts first.** `types.py` and the core service/adapter interface signatures are the
49
+ contract; keep them stable.
50
+ - **Zero domain content in `src/maof`.** Agents, schemas, rules, and prompts are always injected
51
+ by the adopter. The only in-repo domain example is `examples/po_demo`.
52
+
53
+ ## Extending MAOF
54
+
55
+ New adapters implement the relevant Protocol and are wired behind config/extras so the boundary
56
+ stays swappable:
57
+
58
+ - **Broker** (`transport.base.Broker`): publish/consume/ensure_topology with uniform retry/DLQ
59
+ (`transport.retry.RetryPolicy`, per-attempt headers). Add an optional extra; register in
60
+ `transport.factory.build_broker`. See `transport/rabbitmq.py` (default) and the Kafka/Redis/SQS
61
+ adapters for the pattern.
62
+ - **LLM / Embedding provider** (`models.base`): subclass `BaseLLMProvider` (it records every call
63
+ to the cost ledger) / `BaseEmbeddingProvider`; register via `register_llm_provider`. Guard the
64
+ SDK import and accept an injected client so the module imports without the extra.
65
+ - **Persistence** (`persistence.base` Repos, `memory.base.VectorStore`): a new backend implements
66
+ the repo Protocols; Postgres+pgvector is the default.
67
+ - **Event sink / tracer** (`observability`): implement `EventSink.emit`; OTel is no-op until a
68
+ collector is configured.
69
+ - **L2 agent / skill** (`agents.base`): subclass `BaseL2Agent`; declare any side-loaded context via
70
+ `context_delegation`. Register with `@register_l2_agent` or the `maof.l2_agents` entry point.
71
+
72
+ Every adapter that mutates external state must wrap side effects in `IdempotencyGuard.once` so
73
+ replay/redelivery is safe, and (for transport) carry the deterministic `idempotency_key`.
74
+
75
+ ## Never weaken governance
76
+
77
+ Durable resume, subagent dispatch, and registry/A2A imports all remain subject to policy, signing,
78
+ RBAC, and audit. Layer new features underneath governance, not around it.
79
+
80
+ ## Known limitations
81
+
82
+ See "Known limitations" in `docs/deployment.md` before extending the transport or
83
+ registry layers; several behaviors there (at-least-once delivery, revocation replay,
84
+ Redis reclaim) are deliberate trade-offs that extensions must preserve or improve, not
85
+ accidentally regress.
maof-1.0.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 John Thompson
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
maof-1.0.0/NOTICE ADDED
@@ -0,0 +1,8 @@
1
+ MAOF — Multi-Agent Orchestration Framework
2
+ Copyright 2026 John Thompson
3
+
4
+ This product includes software developed by John Thompson and contributors.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
7
+ use this software except in compliance with the License. You may obtain a
8
+ copy of the License at http://www.apache.org/licenses/LICENSE-2.0.