openagent-control 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. openagent_control-0.1.0/LICENSE +201 -0
  2. openagent_control-0.1.0/PKG-INFO +241 -0
  3. openagent_control-0.1.0/README.md +196 -0
  4. openagent_control-0.1.0/pyproject.toml +135 -0
  5. openagent_control-0.1.0/src/openagent_control/__init__.py +0 -0
  6. openagent_control-0.1.0/src/openagent_control/adapters/__init__.py +0 -0
  7. openagent_control-0.1.0/src/openagent_control/adapters/audit_export/__init__.py +0 -0
  8. openagent_control-0.1.0/src/openagent_control/adapters/audit_export/stdout.py +36 -0
  9. openagent_control-0.1.0/src/openagent_control/adapters/db/__init__.py +0 -0
  10. openagent_control-0.1.0/src/openagent_control/adapters/db/session.py +26 -0
  11. openagent_control-0.1.0/src/openagent_control/adapters/db/tables.py +68 -0
  12. openagent_control-0.1.0/src/openagent_control/adapters/identity/__init__.py +0 -0
  13. openagent_control-0.1.0/src/openagent_control/adapters/identity/header.py +24 -0
  14. openagent_control-0.1.0/src/openagent_control/adapters/identity/jwt_svid.py +74 -0
  15. openagent_control-0.1.0/src/openagent_control/adapters/identity/oidc_jwks.py +121 -0
  16. openagent_control-0.1.0/src/openagent_control/adapters/ledger/__init__.py +0 -0
  17. openagent_control-0.1.0/src/openagent_control/adapters/ledger/ed25519_chain.py +57 -0
  18. openagent_control-0.1.0/src/openagent_control/adapters/ledger/postgres.py +77 -0
  19. openagent_control-0.1.0/src/openagent_control/adapters/ledger/signing.py +30 -0
  20. openagent_control-0.1.0/src/openagent_control/adapters/mcp_upstream/__init__.py +0 -0
  21. openagent_control-0.1.0/src/openagent_control/adapters/mcp_upstream/http.py +40 -0
  22. openagent_control-0.1.0/src/openagent_control/adapters/mcp_upstream/streamable_http.py +93 -0
  23. openagent_control-0.1.0/src/openagent_control/adapters/policy/__init__.py +0 -0
  24. openagent_control-0.1.0/src/openagent_control/adapters/policy/opa.py +46 -0
  25. openagent_control-0.1.0/src/openagent_control/adapters/registry/__init__.py +0 -0
  26. openagent_control-0.1.0/src/openagent_control/adapters/registry/caching.py +34 -0
  27. openagent_control-0.1.0/src/openagent_control/adapters/registry/file.py +38 -0
  28. openagent_control-0.1.0/src/openagent_control/adapters/registry/postgres.py +42 -0
  29. openagent_control-0.1.0/src/openagent_control/adapters/token_exchange/__init__.py +0 -0
  30. openagent_control-0.1.0/src/openagent_control/adapters/token_exchange/caching.py +73 -0
  31. openagent_control-0.1.0/src/openagent_control/adapters/token_exchange/entra_obo.py +52 -0
  32. openagent_control-0.1.0/src/openagent_control/adapters/token_exchange/rfc8693.py +50 -0
  33. openagent_control-0.1.0/src/openagent_control/adapters/token_exchange/stub.py +12 -0
  34. openagent_control-0.1.0/src/openagent_control/alembic.ini +36 -0
  35. openagent_control-0.1.0/src/openagent_control/application/__init__.py +0 -0
  36. openagent_control-0.1.0/src/openagent_control/application/governed_execution.py +177 -0
  37. openagent_control-0.1.0/src/openagent_control/cli.py +162 -0
  38. openagent_control-0.1.0/src/openagent_control/config.py +67 -0
  39. openagent_control-0.1.0/src/openagent_control/diagnostics.py +120 -0
  40. openagent_control-0.1.0/src/openagent_control/domain/__init__.py +0 -0
  41. openagent_control-0.1.0/src/openagent_control/domain/errors.py +31 -0
  42. openagent_control-0.1.0/src/openagent_control/domain/models.py +93 -0
  43. openagent_control-0.1.0/src/openagent_control/domain/ports.py +103 -0
  44. openagent_control-0.1.0/src/openagent_control/gateway/__init__.py +0 -0
  45. openagent_control-0.1.0/src/openagent_control/gateway/app.py +51 -0
  46. openagent_control-0.1.0/src/openagent_control/gateway/dependencies.py +212 -0
  47. openagent_control-0.1.0/src/openagent_control/gateway/routes/__init__.py +0 -0
  48. openagent_control-0.1.0/src/openagent_control/gateway/routes/mcp.py +51 -0
  49. openagent_control-0.1.0/src/openagent_control/migrations/env.py +52 -0
  50. openagent_control-0.1.0/src/openagent_control/migrations/script.py.mako +27 -0
  51. openagent_control-0.1.0/src/openagent_control/migrations/versions/0001_initial_schema.py +82 -0
  52. openagent_control-0.1.0/src/openagent_control/py.typed +0 -0
  53. openagent_control-0.1.0/src/openagent_control/resources/__init__.py +72 -0
  54. openagent_control-0.1.0/src/openagent_control/resources/agents.example.yaml +32 -0
  55. openagent_control-0.1.0/src/openagent_control/resources/policies/mcp_authz.rego +47 -0
@@ -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 [yyyy] [name of copyright owner]
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.
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: openagent-control
3
+ Version: 0.1.0
4
+ Summary: Agent identity & governance control plane: policy-gated, credential-brokered, cryptographically audited tool execution for autonomous agents.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: mcp,model-context-protocol,ai-agents,agent-governance,opa,rego,oauth2,spiffe,audit,zero-trust
8
+ Author: Shail Shah
9
+ Author-email: shailvshah@gmail.com
10
+ Requires-Python: >=3.11,<3.13
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Security
18
+ Classifier: Topic :: System :: Systems Administration :: Authentication/Directory
19
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
20
+ Classifier: Typing :: Typed
21
+ Provides-Extra: persistence
22
+ Requires-Dist: alembic (>=1.13.0,<2.0.0) ; extra == "persistence"
23
+ Requires-Dist: asyncpg (>=0.29.0,<0.30.0) ; extra == "persistence"
24
+ Requires-Dist: cryptography (>=43.0.0,<44.0.0)
25
+ Requires-Dist: fastapi (>=0.115.0,<0.116.0)
26
+ Requires-Dist: greenlet (>=3.0.0,<4.0.0) ; extra == "persistence"
27
+ Requires-Dist: httpx (>=0.27.0,<0.28.0)
28
+ Requires-Dist: mcp (>=1.28.1,<2.0.0)
29
+ Requires-Dist: opentelemetry-api (>=1.26.0,<2.0.0)
30
+ Requires-Dist: opentelemetry-sdk (>=1.26.0,<2.0.0)
31
+ Requires-Dist: pydantic (>=2.8.0,<3.0.0)
32
+ Requires-Dist: pydantic-settings (>=2.4.0,<3.0.0)
33
+ Requires-Dist: pyjwt (>=2.9.0,<3.0.0)
34
+ Requires-Dist: pyyaml (>=6.0.0,<7.0.0)
35
+ Requires-Dist: redis (>=5.0.0,<6.0.0) ; extra == "persistence"
36
+ Requires-Dist: sqlalchemy[asyncio] (>=2.0.0,<3.0.0) ; extra == "persistence"
37
+ Requires-Dist: uvicorn[standard] (>=0.31.1,<1.0.0)
38
+ Project-URL: Changelog, https://github.com/shailvshah/openagent-control/releases
39
+ Project-URL: Documentation, https://github.com/shailvshah/openagent-control/blob/main/docs/deployment.md
40
+ Project-URL: Homepage, https://github.com/shailvshah/openagent-control
41
+ Project-URL: Issues, https://github.com/shailvshah/openagent-control/issues
42
+ Project-URL: Repository, https://github.com/shailvshah/openagent-control
43
+ Description-Content-Type: text/markdown
44
+
45
+ # openagent-control
46
+ The zero-config security, governance, and telemetry proxy for the autonomous AI workforce.
47
+
48
+ ## What it is
49
+
50
+ Autonomous agents typically run on static service accounts and hardcoded API keys.
51
+ That forces a choice between over-privileged agents and brittle workflows, and leaves
52
+ no cryptographically trustworthy record of what an agent actually did.
53
+
54
+ `openagent-control` sits between an agent and the tools it calls — today, MCP
55
+ (`tools/list` / `tools/call`) — and enforces three things on every call:
56
+
57
+ 1. **Identity** — the agent is a workload with its own identity, not a shared secret.
58
+ 2. **Policy** — every tool call is evaluated against explicit policy (Open Policy
59
+ Agent / Rego) before it reaches the target system; a scoped, short-lived
60
+ credential is issued only on allow.
61
+ 3. **Audit** — every decision produces an Ed25519-signed, hash-chained receipt, so a
62
+ compliance reviewer can prove after the fact what was authorized and executed.
63
+
64
+ See [docs/design.md](https://github.com/shailvshah/openagent-control/blob/main/docs/design.md) for the full design,
65
+ [docs/adr/](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/README.md) for the reasoning behind each decision — including
66
+ what's a real implementation today versus a deliberate v1 stub —
67
+ [docs/roadmap.md](https://github.com/shailvshah/openagent-control/blob/main/docs/roadmap.md) for where the codebase stands against the
68
+ phased enterprise rollout plan, and [docs/user-journeys.md](https://github.com/shailvshah/openagent-control/blob/main/docs/user-journeys.md)
69
+ for how an agent developer, platform engineer, registry operator, or compliance
70
+ reviewer actually uses it, and [docs/deployment.md](https://github.com/shailvshah/openagent-control/blob/main/docs/deployment.md) for
71
+ installing and running it.
72
+
73
+ ## Status
74
+
75
+ Early foundation, not production-ready. In particular:
76
+
77
+ - **Identity defaults to a stub.** `OAC_IDENTITY_MODE=header` (the default) trusts an
78
+ `X-Spiffe-ID` header rather than performing real SPIFFE/SPIRE attestation — only
79
+ safe behind a network boundary that has already authenticated the caller.
80
+ `OAC_IDENTITY_MODE=jwt-svid` cryptographically validates a SPIFFE JWT-SVID bearer
81
+ token (the shape SPIRE issues) but still needs an actual SPIRE deployment to be a
82
+ full production path — see [ADR-0005](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0005-workload-identity-via-spiffe-stubbed-in-v1.md).
83
+ `OAC_IDENTITY_MODE=oidc-jwks` validates a real access token from Okta or Microsoft
84
+ Entra ID against its published JWKS — see
85
+ [ADR-0010](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0010-oidc-jwks-identity-for-okta-and-entra.md).
86
+ - **Token exchange defaults to a stub**, with real Okta-compatible (RFC 8693) and
87
+ Microsoft Entra (OBO) adapters available via `OAC_TOKEN_EXCHANGE_MODE` — see
88
+ [ADR-0004](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0004-mcp-as-the-v1-protocol-surface.md).
89
+ - **The ledger's signing key defaults to in-process** (regenerated on restart) unless
90
+ you inject your own `ReceiptSigner`; there's no KMS/HSM adapter yet. Chain state
91
+ itself, however, is durable and replica-safe once `OAC_DATABASE_URL` is set — see
92
+ [ADR-0003](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0003-ed25519-hash-chained-audit-ledger.md) and
93
+ [ADR-0009](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0009-postgres-persistence-and-redis-caching.md).
94
+ - No Human-in-the-Loop approval flow, no sidecar/native-SDK deployment pattern, no
95
+ cross-organization (DID/VC) identity yet — tracked in
96
+ [ADR-0001](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0001-hybrid-interception-pattern.md) and
97
+ [ADR-0007](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0007-decentralized-identity-is-a-future-extension-not-v1-scope.md).
98
+
99
+ ## Architecture
100
+
101
+ Hexagonal (ports & adapters) — see
102
+ [ADR-0006](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0006-hexagonal-architecture-for-the-control-plane.md).
103
+
104
+ ```
105
+ src/openagent_control/
106
+ ├── domain/ # pure models + Protocol ports — no I/O, no framework imports
107
+ ├── application/ # GovernedExecutionService — the transport-agnostic use case
108
+ ├── adapters/ # concrete implementations of each port (OPA, ledger, identity, db, ...)
109
+ └── gateway/ # FastAPI app: routes + dependency wiring, no policy/crypto logic
110
+ ```
111
+
112
+ | Port | Default adapter | Also available (settings-selected) |
113
+ |---|---|---|
114
+ | `PolicyEngine` | Open Policy Agent (Rego), `policies/mcp_authz.rego` | — |
115
+ | `IdentityProvider` | header-trusting stub | JWT-SVID validation, OIDC/JWKS (Okta, Entra ID) |
116
+ | `AgentRegistry` | file (`registry/agents.yaml`, git-reviewed) | Postgres (`oac.agents`), optionally Redis-cached |
117
+ | `Ledger` | in-process Ed25519 hash-chained receipts | Postgres-backed, replica-safe chain (`oac.execution_receipts`) |
118
+ | `TokenExchange` | stub | RFC 8693 (Okta-compatible), Microsoft Entra OBO — optionally Redis-cached to each token's own expiry |
119
+ | `MCPUpstream` | MCP Streamable HTTP via the official MCP SDK (ADR-0011) | plain JSON-RPC over HTTP, for non-MCP internal endpoints |
120
+ | `AuditExporter` | stdout/log | — |
121
+
122
+ ## Install
123
+
124
+ ```bash
125
+ pip install openagent-control # gateway + OPA
126
+ pip install 'openagent-control[persistence]' # + Postgres / Redis support
127
+
128
+ openagent-control init ./oac # starter registry + policy
129
+ export OAC_REGISTRY_PATH=./oac/agents.yaml
130
+ openagent-control doctor # checks every dependency
131
+ openagent-control serve
132
+ ```
133
+
134
+ Or with containers — `docker compose up` (gateway + OPA),
135
+ `--profile persistence` for Postgres/Redis, `--profile demo` for the
136
+ walkthrough stack. Full guide: **[docs/deployment.md](https://github.com/shailvshah/openagent-control/blob/main/docs/deployment.md)**.
137
+
138
+ With no registry configured the gateway starts and **denies every agent** — a
139
+ fresh install trusts nothing until you register something.
140
+
141
+ ## Development
142
+
143
+ ```bash
144
+ make install # poetry install --all-extras
145
+ make quality # black --check, ruff, mypy
146
+ make test # pytest with coverage (95% gate)
147
+ make check # quality + test
148
+ make up # docker compose: gateway + OPA
149
+ make up-demo # + demo IdP and governed MCP server
150
+ make doctor # verify config and dependencies
151
+ make test-packaging # build a wheel, install it clean, run it from elsewhere
152
+ ```
153
+
154
+ Requires Python 3.11+ and [Poetry](https://python-poetry.org/). The integration
155
+ tests additionally need the `opa` binary (`brew install opa`); without it they
156
+ skip rather than substitute a fake policy engine.
157
+
158
+ Once running (`make up`), obtain an access token the way a real workload does —
159
+ an OAuth 2.0 client-credentials grant — then send a governed tool call:
160
+
161
+ ```bash
162
+ TOKEN=$(curl -s -X POST http://localhost:8090/oauth2/v1/token \
163
+ -u finance-invoice-svc:scenario-only-not-a-real-secret \
164
+ -d grant_type=client_credentials | jq -r .access_token)
165
+
166
+ curl -X POST http://localhost:8000/mcp/v1 \
167
+ -H "Content-Type: application/json" \
168
+ -H "Authorization: Bearer $TOKEN" \
169
+ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"read_query","arguments":{"quarter":"Q3"}}}'
170
+ ```
171
+
172
+ The upstream MCP server validates the short-lived credential the gateway brokers
173
+ for it, so the same request sent directly to `localhost:8080` is refused. See
174
+ [examples/enterprise_scenario/](https://github.com/shailvshah/openagent-control/blob/main/examples/enterprise_scenario/README.md).
175
+
176
+ ## Persistence & caching (optional)
177
+
178
+ Unset by default — the gateway runs with the in-process ledger and file registry,
179
+ zero extra infrastructure. The Postgres/Redis stack is an **optional extra**
180
+ (`pip install 'openagent-control[persistence]'` / `poetry install --extras persistence`)
181
+ and is lazy-imported, so the default deployment doesn't pay its ~20MB of resident
182
+ memory or its install footprint. Set `OAC_DATABASE_URL` to switch the registry and
183
+ ledger to Postgres (own `oac` schema, migrated via Alembic), and `OAC_REDIS_URL` to
184
+ cache registry lookups (30s TTL) and brokered tokens (capped at each token's own
185
+ expiry). See [ADR-0009](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0009-postgres-persistence-and-redis-caching.md).
186
+
187
+ ```bash
188
+ make up-persistent # docker compose --profile persistence: + postgres, redis
189
+ make db-upgrade # alembic upgrade head against OAC_DATABASE_URL
190
+ ```
191
+
192
+ To point at your own Postgres instance instead: `export OAC_DATABASE_URL=postgresql+asyncpg://user:pass@host/db`
193
+ then `make db-upgrade`.
194
+
195
+ ## Examples
196
+
197
+ - **[examples/enterprise_scenario/](https://github.com/shailvshah/openagent-control/blob/main/examples/enterprise_scenario/README.md) — the
198
+ full stack with nothing stubbed.** A LangGraph agent, real OIDC/JWKS identity,
199
+ real OPA, real RFC 8693 credential brokering, and a real MCP server over real
200
+ SQLite that validates the brokered credential's signature, audience, and scope.
201
+ It also demonstrates the property that distinguishes a control plane from a
202
+ logging proxy: an agent that **bypasses the gateway is refused by the upstream**,
203
+ because the token it holds is scoped to the gateway, not to the API. The same
204
+ assertions run in CI (`tests/integration/`), so the demo cannot rot.
205
+
206
+ ```bash
207
+ brew install opa && poetry install --with examples
208
+ poetry run python -m examples.enterprise_scenario.scenario
209
+ ```
210
+
211
+ Its [`keycloak/`](https://github.com/shailvshah/openagent-control/blob/main/examples/enterprise_scenario/keycloak/README.md) suite runs
212
+ the same identity and RFC 8693 adapters against **real Keycloak 26.4** — an
213
+ IdP this repo didn't write, so it can't share our bugs. That check earned its
214
+ keep on the first run: it caught the identity adapter misreading Keycloak's
215
+ service-account `sub` as a human sponsor, which would have 401'd every
216
+ autonomous agent.
217
+
218
+ The same is done for the MCP protocol itself against **GitHub's production
219
+ MCP server** (`tests/integration/test_github_mcp_conformance.py`), which is
220
+ how we found that the original upstream adapter did not speak MCP at all —
221
+ see [ADR-0011](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0011-mcp-streamable-http-via-the-official-sdk.md).
222
+
223
+ - [examples/langgraph_governed_agent/](https://github.com/shailvshah/openagent-control/blob/main/examples/langgraph_governed_agent/README.md) —
224
+ a deterministic, zero-API-key demo of a LangGraph agent whose tool calls are
225
+ allowed, denied, and cryptographically receipted by the gateway:
226
+
227
+ ```bash
228
+ poetry install --with examples
229
+ make up
230
+ poetry run python -m examples.langgraph_governed_agent.demo
231
+ ```
232
+
233
+ - [examples/oidc_identity_demo/](https://github.com/shailvshah/openagent-control/blob/main/examples/oidc_identity_demo/README.md) — the
234
+ gateway authenticating agents with real Okta/Entra-shaped OIDC access tokens
235
+ (signature, audience, and orphan-agent checks), fully offline against a mock
236
+ IdP:
237
+
238
+ ```bash
239
+ poetry run python -m examples.oidc_identity_demo.demo
240
+ ```
241
+
@@ -0,0 +1,196 @@
1
+ # openagent-control
2
+ The zero-config security, governance, and telemetry proxy for the autonomous AI workforce.
3
+
4
+ ## What it is
5
+
6
+ Autonomous agents typically run on static service accounts and hardcoded API keys.
7
+ That forces a choice between over-privileged agents and brittle workflows, and leaves
8
+ no cryptographically trustworthy record of what an agent actually did.
9
+
10
+ `openagent-control` sits between an agent and the tools it calls — today, MCP
11
+ (`tools/list` / `tools/call`) — and enforces three things on every call:
12
+
13
+ 1. **Identity** — the agent is a workload with its own identity, not a shared secret.
14
+ 2. **Policy** — every tool call is evaluated against explicit policy (Open Policy
15
+ Agent / Rego) before it reaches the target system; a scoped, short-lived
16
+ credential is issued only on allow.
17
+ 3. **Audit** — every decision produces an Ed25519-signed, hash-chained receipt, so a
18
+ compliance reviewer can prove after the fact what was authorized and executed.
19
+
20
+ See [docs/design.md](https://github.com/shailvshah/openagent-control/blob/main/docs/design.md) for the full design,
21
+ [docs/adr/](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/README.md) for the reasoning behind each decision — including
22
+ what's a real implementation today versus a deliberate v1 stub —
23
+ [docs/roadmap.md](https://github.com/shailvshah/openagent-control/blob/main/docs/roadmap.md) for where the codebase stands against the
24
+ phased enterprise rollout plan, and [docs/user-journeys.md](https://github.com/shailvshah/openagent-control/blob/main/docs/user-journeys.md)
25
+ for how an agent developer, platform engineer, registry operator, or compliance
26
+ reviewer actually uses it, and [docs/deployment.md](https://github.com/shailvshah/openagent-control/blob/main/docs/deployment.md) for
27
+ installing and running it.
28
+
29
+ ## Status
30
+
31
+ Early foundation, not production-ready. In particular:
32
+
33
+ - **Identity defaults to a stub.** `OAC_IDENTITY_MODE=header` (the default) trusts an
34
+ `X-Spiffe-ID` header rather than performing real SPIFFE/SPIRE attestation — only
35
+ safe behind a network boundary that has already authenticated the caller.
36
+ `OAC_IDENTITY_MODE=jwt-svid` cryptographically validates a SPIFFE JWT-SVID bearer
37
+ token (the shape SPIRE issues) but still needs an actual SPIRE deployment to be a
38
+ full production path — see [ADR-0005](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0005-workload-identity-via-spiffe-stubbed-in-v1.md).
39
+ `OAC_IDENTITY_MODE=oidc-jwks` validates a real access token from Okta or Microsoft
40
+ Entra ID against its published JWKS — see
41
+ [ADR-0010](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0010-oidc-jwks-identity-for-okta-and-entra.md).
42
+ - **Token exchange defaults to a stub**, with real Okta-compatible (RFC 8693) and
43
+ Microsoft Entra (OBO) adapters available via `OAC_TOKEN_EXCHANGE_MODE` — see
44
+ [ADR-0004](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0004-mcp-as-the-v1-protocol-surface.md).
45
+ - **The ledger's signing key defaults to in-process** (regenerated on restart) unless
46
+ you inject your own `ReceiptSigner`; there's no KMS/HSM adapter yet. Chain state
47
+ itself, however, is durable and replica-safe once `OAC_DATABASE_URL` is set — see
48
+ [ADR-0003](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0003-ed25519-hash-chained-audit-ledger.md) and
49
+ [ADR-0009](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0009-postgres-persistence-and-redis-caching.md).
50
+ - No Human-in-the-Loop approval flow, no sidecar/native-SDK deployment pattern, no
51
+ cross-organization (DID/VC) identity yet — tracked in
52
+ [ADR-0001](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0001-hybrid-interception-pattern.md) and
53
+ [ADR-0007](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0007-decentralized-identity-is-a-future-extension-not-v1-scope.md).
54
+
55
+ ## Architecture
56
+
57
+ Hexagonal (ports & adapters) — see
58
+ [ADR-0006](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0006-hexagonal-architecture-for-the-control-plane.md).
59
+
60
+ ```
61
+ src/openagent_control/
62
+ ├── domain/ # pure models + Protocol ports — no I/O, no framework imports
63
+ ├── application/ # GovernedExecutionService — the transport-agnostic use case
64
+ ├── adapters/ # concrete implementations of each port (OPA, ledger, identity, db, ...)
65
+ └── gateway/ # FastAPI app: routes + dependency wiring, no policy/crypto logic
66
+ ```
67
+
68
+ | Port | Default adapter | Also available (settings-selected) |
69
+ |---|---|---|
70
+ | `PolicyEngine` | Open Policy Agent (Rego), `policies/mcp_authz.rego` | — |
71
+ | `IdentityProvider` | header-trusting stub | JWT-SVID validation, OIDC/JWKS (Okta, Entra ID) |
72
+ | `AgentRegistry` | file (`registry/agents.yaml`, git-reviewed) | Postgres (`oac.agents`), optionally Redis-cached |
73
+ | `Ledger` | in-process Ed25519 hash-chained receipts | Postgres-backed, replica-safe chain (`oac.execution_receipts`) |
74
+ | `TokenExchange` | stub | RFC 8693 (Okta-compatible), Microsoft Entra OBO — optionally Redis-cached to each token's own expiry |
75
+ | `MCPUpstream` | MCP Streamable HTTP via the official MCP SDK (ADR-0011) | plain JSON-RPC over HTTP, for non-MCP internal endpoints |
76
+ | `AuditExporter` | stdout/log | — |
77
+
78
+ ## Install
79
+
80
+ ```bash
81
+ pip install openagent-control # gateway + OPA
82
+ pip install 'openagent-control[persistence]' # + Postgres / Redis support
83
+
84
+ openagent-control init ./oac # starter registry + policy
85
+ export OAC_REGISTRY_PATH=./oac/agents.yaml
86
+ openagent-control doctor # checks every dependency
87
+ openagent-control serve
88
+ ```
89
+
90
+ Or with containers — `docker compose up` (gateway + OPA),
91
+ `--profile persistence` for Postgres/Redis, `--profile demo` for the
92
+ walkthrough stack. Full guide: **[docs/deployment.md](https://github.com/shailvshah/openagent-control/blob/main/docs/deployment.md)**.
93
+
94
+ With no registry configured the gateway starts and **denies every agent** — a
95
+ fresh install trusts nothing until you register something.
96
+
97
+ ## Development
98
+
99
+ ```bash
100
+ make install # poetry install --all-extras
101
+ make quality # black --check, ruff, mypy
102
+ make test # pytest with coverage (95% gate)
103
+ make check # quality + test
104
+ make up # docker compose: gateway + OPA
105
+ make up-demo # + demo IdP and governed MCP server
106
+ make doctor # verify config and dependencies
107
+ make test-packaging # build a wheel, install it clean, run it from elsewhere
108
+ ```
109
+
110
+ Requires Python 3.11+ and [Poetry](https://python-poetry.org/). The integration
111
+ tests additionally need the `opa` binary (`brew install opa`); without it they
112
+ skip rather than substitute a fake policy engine.
113
+
114
+ Once running (`make up`), obtain an access token the way a real workload does —
115
+ an OAuth 2.0 client-credentials grant — then send a governed tool call:
116
+
117
+ ```bash
118
+ TOKEN=$(curl -s -X POST http://localhost:8090/oauth2/v1/token \
119
+ -u finance-invoice-svc:scenario-only-not-a-real-secret \
120
+ -d grant_type=client_credentials | jq -r .access_token)
121
+
122
+ curl -X POST http://localhost:8000/mcp/v1 \
123
+ -H "Content-Type: application/json" \
124
+ -H "Authorization: Bearer $TOKEN" \
125
+ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"read_query","arguments":{"quarter":"Q3"}}}'
126
+ ```
127
+
128
+ The upstream MCP server validates the short-lived credential the gateway brokers
129
+ for it, so the same request sent directly to `localhost:8080` is refused. See
130
+ [examples/enterprise_scenario/](https://github.com/shailvshah/openagent-control/blob/main/examples/enterprise_scenario/README.md).
131
+
132
+ ## Persistence & caching (optional)
133
+
134
+ Unset by default — the gateway runs with the in-process ledger and file registry,
135
+ zero extra infrastructure. The Postgres/Redis stack is an **optional extra**
136
+ (`pip install 'openagent-control[persistence]'` / `poetry install --extras persistence`)
137
+ and is lazy-imported, so the default deployment doesn't pay its ~20MB of resident
138
+ memory or its install footprint. Set `OAC_DATABASE_URL` to switch the registry and
139
+ ledger to Postgres (own `oac` schema, migrated via Alembic), and `OAC_REDIS_URL` to
140
+ cache registry lookups (30s TTL) and brokered tokens (capped at each token's own
141
+ expiry). See [ADR-0009](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0009-postgres-persistence-and-redis-caching.md).
142
+
143
+ ```bash
144
+ make up-persistent # docker compose --profile persistence: + postgres, redis
145
+ make db-upgrade # alembic upgrade head against OAC_DATABASE_URL
146
+ ```
147
+
148
+ To point at your own Postgres instance instead: `export OAC_DATABASE_URL=postgresql+asyncpg://user:pass@host/db`
149
+ then `make db-upgrade`.
150
+
151
+ ## Examples
152
+
153
+ - **[examples/enterprise_scenario/](https://github.com/shailvshah/openagent-control/blob/main/examples/enterprise_scenario/README.md) — the
154
+ full stack with nothing stubbed.** A LangGraph agent, real OIDC/JWKS identity,
155
+ real OPA, real RFC 8693 credential brokering, and a real MCP server over real
156
+ SQLite that validates the brokered credential's signature, audience, and scope.
157
+ It also demonstrates the property that distinguishes a control plane from a
158
+ logging proxy: an agent that **bypasses the gateway is refused by the upstream**,
159
+ because the token it holds is scoped to the gateway, not to the API. The same
160
+ assertions run in CI (`tests/integration/`), so the demo cannot rot.
161
+
162
+ ```bash
163
+ brew install opa && poetry install --with examples
164
+ poetry run python -m examples.enterprise_scenario.scenario
165
+ ```
166
+
167
+ Its [`keycloak/`](https://github.com/shailvshah/openagent-control/blob/main/examples/enterprise_scenario/keycloak/README.md) suite runs
168
+ the same identity and RFC 8693 adapters against **real Keycloak 26.4** — an
169
+ IdP this repo didn't write, so it can't share our bugs. That check earned its
170
+ keep on the first run: it caught the identity adapter misreading Keycloak's
171
+ service-account `sub` as a human sponsor, which would have 401'd every
172
+ autonomous agent.
173
+
174
+ The same is done for the MCP protocol itself against **GitHub's production
175
+ MCP server** (`tests/integration/test_github_mcp_conformance.py`), which is
176
+ how we found that the original upstream adapter did not speak MCP at all —
177
+ see [ADR-0011](https://github.com/shailvshah/openagent-control/blob/main/docs/adr/0011-mcp-streamable-http-via-the-official-sdk.md).
178
+
179
+ - [examples/langgraph_governed_agent/](https://github.com/shailvshah/openagent-control/blob/main/examples/langgraph_governed_agent/README.md) —
180
+ a deterministic, zero-API-key demo of a LangGraph agent whose tool calls are
181
+ allowed, denied, and cryptographically receipted by the gateway:
182
+
183
+ ```bash
184
+ poetry install --with examples
185
+ make up
186
+ poetry run python -m examples.langgraph_governed_agent.demo
187
+ ```
188
+
189
+ - [examples/oidc_identity_demo/](https://github.com/shailvshah/openagent-control/blob/main/examples/oidc_identity_demo/README.md) — the
190
+ gateway authenticating agents with real Okta/Entra-shaped OIDC access tokens
191
+ (signature, audience, and orphan-agent checks), fully offline against a mock
192
+ IdP:
193
+
194
+ ```bash
195
+ poetry run python -m examples.oidc_identity_demo.demo
196
+ ```