bolyra-agents 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.
@@ -0,0 +1,79 @@
1
+ node_modules/
2
+ dist/
3
+ build/
4
+ .worktrees/
5
+ cache/
6
+ artifacts/
7
+ typechain-types/
8
+
9
+ # Circuit build artifacts
10
+ *.r1cs
11
+ *.wasm
12
+ *.zkey
13
+ *.wtns
14
+ *.sym
15
+ *.json.gz
16
+
17
+ # Environment
18
+ .env
19
+ .env.local
20
+
21
+ # OS
22
+ .DS_Store
23
+ Thumbs.db
24
+
25
+ # IDE
26
+ .vscode/
27
+ .idea/
28
+
29
+ # Hardhat
30
+ cache/
31
+ artifacts/
32
+
33
+ # Coverage
34
+ coverage/
35
+ coverage.json
36
+
37
+ # Python
38
+ __pycache__/
39
+ *.pyc
40
+ venv/
41
+ .venv/
42
+
43
+ # Tooling session state
44
+ .context/
45
+
46
+ # Circuit C-witness build dir
47
+ circuits/build_c/
48
+ .gstack/
49
+
50
+ # Circuit input-signal debug logs
51
+ circuits/log_input_signals*.txt
52
+
53
+ # MCP config (contains user-absolute paths; use .mcp.json.example as template)
54
+ .mcp.json
55
+
56
+ # Patent drafts — pre-filing artifacts. Public commit before USPTO filing
57
+ # triggers §102 disclosure and destroys the priority date. Filed specs/drawings
58
+ # may be added per-file post-filing (see drafts/IDENTITYOS-PROV-001-* precedent).
59
+ drafts/BOLYRA-PROV-002-spec.pdf
60
+ drafts/BOLYRA-PROV-002-drawings.pdf
61
+ drafts/BOLYRA-PROV-002-filing-ready.md
62
+ drafts/BOLYRA-PROV-002-filing-ready.html
63
+ drafts/BOLYRA-PROV-002-figures/
64
+
65
+ # Patent workflow — internal, never publish
66
+ drafts/BOLYRA-PROV-002-FILING-CHECKLIST.md
67
+ drafts/BOLYRA-PROV-002-PRE-FILING-REVIEW.md
68
+ drafts/BOLYRA-PROV-002-claim-experiments/
69
+
70
+ # Invention disclosures — same §102 reasoning as patent drafts above. Stay
71
+ # local until the corresponding provisional has filed; only then consider
72
+ # per-file move to a committed location.
73
+ patents/disclosures/
74
+
75
+ # Personal drafts — outreach + research-paper iterations live in drafts/
76
+ # but stay out of git history until they're shipped.
77
+ drafts/ietf-outreach-email.md
78
+ drafts/x-observation-thread.md
79
+ drafts/RESEARCH-PAPER-2026-04-22.md
@@ -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 describing the origin of the Work and
141
+ 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 accept and charge a
167
+ fee for the acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ 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 Viswanadha Pratap Kondoju
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,121 @@
1
+ Bolyra
2
+ Copyright 2026 ZKProva Inc. and the Bolyra contributors.
3
+
4
+ This product includes software developed by ZKProva Inc.
5
+ (https://bolyra.ai).
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License").
8
+ See the LICENSE file at the repository root, or
9
+ https://www.apache.org/licenses/LICENSE-2.0, for the full license text.
10
+
11
+ ================================================================================
12
+ THIRD-PARTY ATTRIBUTIONS
13
+ ================================================================================
14
+
15
+ This product includes, depends on, or is derived from the following third-party
16
+ works. Each is distributed under its own license; the corresponding LICENSE
17
+ files are reproduced or referenced in the dependency tree (node_modules,
18
+ site-packages) at install time.
19
+
20
+ ----------------------------------------
21
+ Cryptography and Zero-Knowledge Proofs
22
+ ----------------------------------------
23
+
24
+ circom (https://github.com/iden3/circom)
25
+ Copyright (c) iden3. Licensed under GPL-3.0.
26
+ NOTE: circom is the compiler. The compiled circuits in this repository
27
+ (circuits/build/*.r1cs, *.wasm, *.zkey) are project artifacts of Bolyra
28
+ and are not encumbered by circom's GPL-3.0 — Section 7 of GPL-3.0 and
29
+ iden3's published clarification confirm that circuits compiled by circom
30
+ are not derivative works of circom itself.
31
+
32
+ circomlib (https://github.com/iden3/circomlib)
33
+ circomlibjs (https://github.com/iden3/circomlibjs)
34
+ Copyright (c) iden3. Licensed under GPL-3.0.
35
+ Used as Circom-language template libraries (Poseidon, EdDSA, Baby Jubjub,
36
+ SMT). Same Section 7 reasoning as circom.
37
+
38
+ snarkjs (https://github.com/iden3/snarkjs)
39
+ Copyright (c) iden3. Licensed under GPL-3.0.
40
+ Used as a development/testing prover only. Production proving uses the
41
+ rapidsnark binary (see below). Distribution paths that ship snarkjs
42
+ reproduce its license verbatim.
43
+
44
+ rapidsnark (https://github.com/iden3/rapidsnark)
45
+ Copyright (c) iden3. Licensed under GPL-3.0.
46
+ Native prover binary; redistributed at circuits/build/rapidsnark_prover
47
+ on supported platforms. Not statically linked into Bolyra source.
48
+
49
+ Semaphore Protocol (https://github.com/semaphoreprotocol/semaphore)
50
+ Copyright (c) PSE / Ethereum Foundation. Licensed under MIT.
51
+ @semaphore-protocol/circuits, @semaphore-protocol/contracts,
52
+ @semaphore-protocol/core. The HumanUniqueness circuit reuses the
53
+ Semaphore v4 trusted-setup ceremony at depth 20 (per its public terms).
54
+
55
+ poseidon-solidity (https://github.com/chancehudson/poseidon-solidity)
56
+ Copyright (c) Chance Hudson. Licensed under MIT.
57
+ Solidity implementation of the Poseidon hash family.
58
+
59
+ ----------------------------------------
60
+ Smart Contracts
61
+ ----------------------------------------
62
+
63
+ OpenZeppelin Contracts (https://github.com/OpenZeppelin/openzeppelin-contracts)
64
+ Copyright (c) OpenZeppelin. Licensed under MIT.
65
+
66
+ Hardhat (https://hardhat.org)
67
+ Copyright (c) Nomic Foundation. Licensed under MIT.
68
+
69
+ ----------------------------------------
70
+ JavaScript / TypeScript
71
+ ----------------------------------------
72
+
73
+ ethers.js (https://github.com/ethers-io/ethers.js)
74
+ Copyright (c) Richard Moore and contributors. Licensed under MIT.
75
+
76
+ jose (https://github.com/panva/jose)
77
+ Copyright (c) Filip Skokan. Licensed under MIT.
78
+
79
+ TypeScript (https://github.com/microsoft/TypeScript)
80
+ Copyright (c) Microsoft Corporation. Licensed under Apache-2.0.
81
+
82
+ mocha, chai, jest, ts-jest, circom_tester (test tooling)
83
+ Copyright (c) respective authors. Licensed under MIT.
84
+
85
+ dotenv
86
+ Copyright (c) Scott Motte. Licensed under BSD-2-Clause.
87
+
88
+ ----------------------------------------
89
+ Python
90
+ ----------------------------------------
91
+
92
+ pytest, ruff (development tooling)
93
+ Copyright (c) respective authors. Licensed under MIT.
94
+
95
+ ================================================================================
96
+ TRADEMARK NOTICE
97
+ ================================================================================
98
+
99
+ "Bolyra" and the Bolyra wordmark are trademarks of ZKProva Inc.
100
+
101
+ References to "Anthropic", "OpenAI", "GPT", and other model-provider names
102
+ within examples (e.g., examples/provider-mock/) are included for illustrative
103
+ purposes only and do not imply endorsement, partnership, or licensing
104
+ relationship with the named entity. Mock provider keys in the test fixtures
105
+ are explicitly labeled "MOCK ONLY — NOT A REAL <PROVIDER> KEY".
106
+
107
+ ================================================================================
108
+ PATENT NOTICE
109
+ ================================================================================
110
+
111
+ Apache License 2.0 includes an express patent grant from contributors (§3).
112
+ By contributing to this repository under the Developer Certificate of Origin
113
+ sign-off, contributors grant the patent license described in §3 of the
114
+ Apache License 2.0 to all downstream users of the contribution.
115
+
116
+ ZKProva Inc. has filed United States provisional patent applications covering
117
+ inventions implemented in this repository. The patent grant in Apache-2.0 §3
118
+ applies to ZKProva Inc.'s contributions; downstream users of this software
119
+ under the Apache-2.0 license receive that patent license. ZKProva Inc.'s
120
+ own patent rights against parties who do NOT comply with the Apache-2.0
121
+ license terms are unaffected by that grant.
@@ -0,0 +1,209 @@
1
+ Metadata-Version: 2.4
2
+ Name: bolyra-agents
3
+ Version: 0.1.0
4
+ Summary: OpenAI Agents SDK adapter for Bolyra -- guardrails, tool wrappers, and MCP auth
5
+ Project-URL: Homepage, https://bolyra.ai
6
+ Project-URL: Repository, https://github.com/bolyra/bolyra
7
+ Project-URL: Issues, https://github.com/bolyra/bolyra/issues
8
+ Project-URL: Documentation, https://github.com/bolyra/bolyra#readme
9
+ Author-email: Bolyra <sdk@bolyra.ai>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: ai-agents,bolyra,delegation,identity,openai-agents,sd-jwt,zkp
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Security :: Cryptography
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: bolyra>=0.4.0
25
+ Requires-Dist: openai-agents>=0.1.0
26
+ Requires-Dist: pyjwt[crypto]>=2.8.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
29
+ Requires-Dist: pytest>=7.0; extra == 'dev'
30
+ Requires-Dist: ruff>=0.4; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # bolyra-agents -- Bolyra Auth for OpenAI Agents SDK
34
+
35
+ Python package that adds Bolyra authentication to [OpenAI Agents SDK](https://github.com/openai/openai-agents-python) agents via three integration points:
36
+
37
+ 1. **BolyraAuthGuardrail** -- coarse-grained InputGuardrail that verifies credentials before an agent run starts
38
+ 2. **BolyraToolWrapper** / **bolyra_tool** -- fine-grained per-tool auth that checks permissions before each tool invocation
39
+ 3. **bolyra_mcp_auth** -- wraps MCP server connections to inject Bolyra auth headers
40
+
41
+ Supports two auth paths:
42
+ - **SD-JWT mode** -- pure Python credential verification via `bolyra.sd_jwt` (no infrastructure needed)
43
+ - **Gateway mode** -- HTTP header injection with a pre-obtained token
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ pip install bolyra-agents
49
+ ```
50
+
51
+ Dependencies: `openai-agents>=0.1.0`, `bolyra>=0.4.0`, `PyJWT[crypto]>=2.8.0`
52
+
53
+ ## Quick Start
54
+
55
+ ### 1. Guardrail (coarse-grained: entire agent run)
56
+
57
+ ```python
58
+ from agents import Agent, Runner
59
+ from bolyra_agents import BolyraAuthGuardrail, BolyraAuthContext, AuthMode
60
+
61
+ ctx = BolyraAuthContext(
62
+ mode=AuthMode.SD_JWT,
63
+ receipt=receipt,
64
+ holder_private_key=agent_key,
65
+ issuer_public_key=operator_pub,
66
+ )
67
+ guardrail = BolyraAuthGuardrail(auth_context=ctx)
68
+ agent = Agent(
69
+ name="my-agent",
70
+ instructions="You are a helpful assistant.",
71
+ input_guardrails=[guardrail.as_input_guardrail()],
72
+ )
73
+ result = await Runner.run(agent, "Hello")
74
+ ```
75
+
76
+ If verification fails, the SDK raises `InputGuardrailTripwireTriggered` and halts the agent.
77
+
78
+ ### 2. Per-tool auth (fine-grained: per tool call)
79
+
80
+ ```python
81
+ from agents import Agent, function_tool
82
+ from bolyra_agents import BolyraToolWrapper, BolyraAuthContext, AuthMode
83
+
84
+ ctx = BolyraAuthContext(
85
+ mode=AuthMode.SD_JWT,
86
+ receipt=receipt,
87
+ holder_private_key=agent_key,
88
+ issuer_public_key=operator_pub,
89
+ )
90
+
91
+ # Class-based wrapping
92
+ wrapper = BolyraToolWrapper(
93
+ auth_context=ctx,
94
+ required_permissions=["FINANCIAL_SMALL"],
95
+ required_action="purchase",
96
+ )
97
+
98
+ @function_tool
99
+ def purchase_item(sku: str, amount: float) -> str:
100
+ return f"Purchased {sku} for ${amount}"
101
+
102
+ agent = Agent(
103
+ name="shopping-agent",
104
+ tools=[wrapper.wrap(purchase_item), search_tool], # only purchase needs auth
105
+ )
106
+ ```
107
+
108
+ Or use the decorator:
109
+
110
+ ```python
111
+ from bolyra_agents import bolyra_tool
112
+
113
+ @bolyra_tool(ctx, required_permissions=["WRITE_DATA"])
114
+ @function_tool
115
+ def write_data(content: str) -> str:
116
+ return f"Wrote: {content}"
117
+ ```
118
+
119
+ ### 3. MCP gateway auth
120
+
121
+ ```python
122
+ from agents.mcp import MCPServerSse
123
+ from bolyra_agents import bolyra_mcp_auth, BolyraAuthContext, AuthMode
124
+
125
+ server = MCPServerSse(params={"url": "https://my-server.com/sse"})
126
+ authed = bolyra_mcp_auth(server, BolyraAuthContext(
127
+ mode=AuthMode.GATEWAY,
128
+ gateway_token="eyJ...",
129
+ ))
130
+ agent = Agent(name="mcp-agent", mcp_servers=[authed])
131
+ ```
132
+
133
+ ## Auth Modes
134
+
135
+ ### SD-JWT Mode
136
+
137
+ The agent holds an SD-JWT delegation receipt issued by a human/operator. On each operation, the adapter presents the receipt with a fresh KB-JWT (holder binding) and verifies it locally. Pure Python, no infrastructure needed.
138
+
139
+ ```python
140
+ ctx = BolyraAuthContext(
141
+ mode=AuthMode.SD_JWT,
142
+ receipt=receipt, # Issuer-form SD-JWT (from bolyra.sd_jwt.allow())
143
+ holder_private_key=agent_key, # Agent's Ed25519 private key
144
+ issuer_public_key=issuer_pub, # Issuer's Ed25519 public key
145
+ )
146
+ ```
147
+
148
+ ### Gateway Mode
149
+
150
+ The agent has a pre-obtained auth token. The adapter injects `Authorization: Bearer <token>` headers and does a local JWT expiry check.
151
+
152
+ ```python
153
+ ctx = BolyraAuthContext(
154
+ mode=AuthMode.GATEWAY,
155
+ gateway_token="eyJ...", # Pre-obtained JWT
156
+ )
157
+ ```
158
+
159
+ ## Permissions
160
+
161
+ The adapter supports Bolyra's 8-bit cumulative permission model:
162
+
163
+ | Permission | Implies |
164
+ |-----------|---------|
165
+ | READ_DATA | -- |
166
+ | WRITE_DATA | -- |
167
+ | FINANCIAL_SMALL | -- |
168
+ | FINANCIAL_MEDIUM | FINANCIAL_SMALL |
169
+ | FINANCIAL_UNLIMITED | FINANCIAL_SMALL, FINANCIAL_MEDIUM |
170
+ | SIGN_ON_BEHALF | -- |
171
+ | SUB_DELEGATE | -- |
172
+ | ACCESS_PII | -- |
173
+
174
+ ## Dev Mode
175
+
176
+ For development and testing, set `dev_mode=True` to bypass credential verification:
177
+
178
+ ```python
179
+ ctx = BolyraAuthContext(
180
+ mode=AuthMode.SD_JWT,
181
+ dev_mode=True,
182
+ agent_id="dev-agent",
183
+ )
184
+ ```
185
+
186
+ ## Tracing
187
+
188
+ Auth operations emit custom spans in the OpenAI Agents SDK tracing system:
189
+ - `bolyra.verify` -- credential verification
190
+ - `bolyra.guardrail` -- guardrail check
191
+ - `bolyra.tool_auth` -- per-tool auth check
192
+ - `bolyra.mcp_auth` -- MCP auth injection
193
+
194
+ Spans include operation status but never include key material, receipts, or nonces.
195
+
196
+ ## Testing
197
+
198
+ ```bash
199
+ cd integrations/openai-agents
200
+ python3 -m pytest tests/ -v
201
+ ```
202
+
203
+ ## TypeScript Example
204
+
205
+ The existing `delegation-example.ts` shows the TypeScript delegation pattern. This Python package is the full-featured adapter.
206
+
207
+ ## License
208
+
209
+ Apache-2.0