sigrix-runtime 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 (58) hide show
  1. sigrix_runtime-0.1.0/.gitignore +9 -0
  2. sigrix_runtime-0.1.0/CHANGELOG.md +26 -0
  3. sigrix_runtime-0.1.0/LICENSE +201 -0
  4. sigrix_runtime-0.1.0/NOTICE +10 -0
  5. sigrix_runtime-0.1.0/PKG-INFO +173 -0
  6. sigrix_runtime-0.1.0/README.md +133 -0
  7. sigrix_runtime-0.1.0/pyproject.toml +142 -0
  8. sigrix_runtime-0.1.0/src/sigrix_runtime/__init__.py +18 -0
  9. sigrix_runtime-0.1.0/src/sigrix_runtime/configuration.py +110 -0
  10. sigrix_runtime-0.1.0/src/sigrix_runtime/execution.py +465 -0
  11. sigrix_runtime-0.1.0/src/sigrix_runtime/loader.py +336 -0
  12. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/__init__.py +61 -0
  13. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/__main__.py +460 -0
  14. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/_worker.py +116 -0
  15. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/describe.py +559 -0
  16. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/engine.py +468 -0
  17. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/entitlement.py +898 -0
  18. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/errors.py +226 -0
  19. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/mcp.py +561 -0
  20. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/pull.py +624 -0
  21. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/server.py +1154 -0
  22. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/transport.py +209 -0
  23. sigrix_runtime-0.1.0/src/sigrix_runtime/postern/version_check.py +126 -0
  24. sigrix_runtime-0.1.0/src/sigrix_runtime/py.typed +0 -0
  25. sigrix_runtime-0.1.0/src/sigrix_runtime/quiet.py +52 -0
  26. sigrix_runtime-0.1.0/src/sigrix_runtime/runner_env.py +36 -0
  27. sigrix_runtime-0.1.0/src/sigrix_runtime/sandbox.py +95 -0
  28. sigrix_runtime-0.1.0/src/sigrix_runtime/workforce.py +442 -0
  29. sigrix_runtime-0.1.0/tests/__init__.py +0 -0
  30. sigrix_runtime-0.1.0/tests/fixtures/crews/contract-review/config/agents.yaml +44 -0
  31. sigrix_runtime-0.1.0/tests/fixtures/crews/contract-review/config/tasks.yaml +62 -0
  32. sigrix_runtime-0.1.0/tests/fixtures/crews/marketing-strategist/config/agents.yaml +21 -0
  33. sigrix_runtime-0.1.0/tests/fixtures/crews/marketing-strategist/config/tasks.yaml +16 -0
  34. sigrix_runtime-0.1.0/tests/fixtures/crews/product-launch/config/agents.yaml +72 -0
  35. sigrix_runtime-0.1.0/tests/fixtures/crews/product-launch/config/tasks.yaml +98 -0
  36. sigrix_runtime-0.1.0/tests/fixtures/crews/software-team/config/agents.yaml +54 -0
  37. sigrix_runtime-0.1.0/tests/fixtures/crews/software-team/config/tasks.yaml +22 -0
  38. sigrix_runtime-0.1.0/tests/fixtures/env.example +13 -0
  39. sigrix_runtime-0.1.0/tests/fixtures/mcp_server.py +241 -0
  40. sigrix_runtime-0.1.0/tests/postern_distributor.py +173 -0
  41. sigrix_runtime-0.1.0/tests/postern_schema.py +34 -0
  42. sigrix_runtime-0.1.0/tests/support.py +44 -0
  43. sigrix_runtime-0.1.0/tests/test_entitlement.py +1093 -0
  44. sigrix_runtime-0.1.0/tests/test_env_isolation.py +463 -0
  45. sigrix_runtime-0.1.0/tests/test_execution.py +209 -0
  46. sigrix_runtime-0.1.0/tests/test_home_fallback.py +127 -0
  47. sigrix_runtime-0.1.0/tests/test_host_gate.py +402 -0
  48. sigrix_runtime-0.1.0/tests/test_http_edge.py +407 -0
  49. sigrix_runtime-0.1.0/tests/test_inbound_auth.py +525 -0
  50. sigrix_runtime-0.1.0/tests/test_loader.py +663 -0
  51. sigrix_runtime-0.1.0/tests/test_mcp_mode.py +706 -0
  52. sigrix_runtime-0.1.0/tests/test_pull.py +840 -0
  53. sigrix_runtime-0.1.0/tests/test_quiet.py +86 -0
  54. sigrix_runtime-0.1.0/tests/test_run_lifecycle.py +389 -0
  55. sigrix_runtime-0.1.0/tests/test_sandbox.py +98 -0
  56. sigrix_runtime-0.1.0/tests/test_server.py +963 -0
  57. sigrix_runtime-0.1.0/tests/test_stdlib_only.py +156 -0
  58. sigrix_runtime-0.1.0/tests/test_version_check.py +352 -0
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .mypy_cache/
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are recorded here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); the versioning is
5
+ described in `VERSIONING.md`.
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-09-26
10
+
11
+ First release as a package of its own. The same code has shipped inside every
12
+ Sigrix bundle before this; nothing it answers has changed.
13
+
14
+ ### Added
15
+
16
+ - `sigrix_runtime.postern`: a Postern 0.1 runner at Level 3. `describe`,
17
+ `status`, `run` and `stream` on loopback; the entitlement check of the
18
+ specification's §5 with its cache and grace period; the verified bundle
19
+ pull; the version check of §8.
20
+ - `--mcp`: an MCP server's tools served as one agent, `describe` from
21
+ `tools/list` and each run a `tools/call`.
22
+ - The execution layer a bundle's `main.py` and the server share, and the
23
+ `crewai` extra it needs to run a CrewAI crew.
24
+ - `sigrix-runtime`, a console script for the same entry point as
25
+ `python -m sigrix_runtime.postern`.
26
+ - Type information (`py.typed`), checked under `mypy --strict`.
@@ -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 Sigrix
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,10 @@
1
+ sigrix-runtime
2
+ Copyright 2026 Sigrix
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ Trademarks. "Sigrix" and the Sigrix logo are trademarks of Sigrix. The Apache
7
+ License does not grant permission to use them. The name of this repository and
8
+ package identifies the marketplace whose bundles this runner serves; it does
9
+ not imply endorsement of a derivative work. A fork or a derived runner must not
10
+ present itself as Sigrix or as published by Sigrix.
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.5
2
+ Name: sigrix-runtime
3
+ Version: 0.1.0
4
+ Summary: The Postern runner inside every Sigrix bundle: serves one agent's describe, run, stream and status on loopback, checks the buyer's entitlement, and serves an MCP server's tools over the same four verbs.
5
+ Project-URL: Homepage, https://github.com/sigrix-io/sigrix-runtime
6
+ Project-URL: Source, https://github.com/sigrix-io/sigrix-runtime
7
+ Project-URL: Issues, https://github.com/sigrix-io/sigrix-runtime/issues
8
+ Project-URL: Changelog, https://github.com/sigrix-io/sigrix-runtime/blob/main/CHANGELOG.md
9
+ Project-URL: Specification, https://github.com/sigrix-io/postern
10
+ Author: Sigrix
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ License-File: NOTICE
14
+ Keywords: agents,crewai,entitlement,mcp,postern,runner
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Environment :: Console
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: Apache Software License
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.11
27
+ Provides-Extra: crewai
28
+ Requires-Dist: crewai-tools<2,>=1.15.20; extra == 'crewai'
29
+ Requires-Dist: crewai<2,>=1.15.20; extra == 'crewai'
30
+ Requires-Dist: python-dotenv<2,>=1.2.2; extra == 'crewai'
31
+ Requires-Dist: pyyaml>=6.0; extra == 'crewai'
32
+ Provides-Extra: dev
33
+ Requires-Dist: mypy==2.3.1; extra == 'dev'
34
+ Requires-Dist: postern-conformance==0.1.2; extra == 'dev'
35
+ Requires-Dist: pytest>=8.0; extra == 'dev'
36
+ Requires-Dist: pyyaml>=6.0; extra == 'dev'
37
+ Requires-Dist: ruff==0.16.8; extra == 'dev'
38
+ Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
39
+ Description-Content-Type: text/markdown
40
+
41
+ # sigrix-runtime
42
+
43
+ The [Postern](https://github.com/sigrix-io/postern) runner inside every bundle
44
+ [Sigrix](https://sigrix.io) delivers. It serves one agent on your own machine
45
+ over Postern's four verbs, checks that you are entitled to run it, and runs it
46
+ with the keys in your own environment.
47
+
48
+ This is the code that already ships in every Sigrix bundle, published here so it
49
+ can be read, tested and depended on. A bundle carries its own copy, so running
50
+ one needs nothing installed from here:
51
+
52
+ ```console
53
+ $ cd my-bundle
54
+ $ python -m sigrix_runtime.postern
55
+ ```
56
+
57
+ then point a client at `http://127.0.0.1:8787/postern/v0/describe`. Install it
58
+ to serve an MCP server's tools (below), or to build on it:
59
+
60
+ ```console
61
+ $ pip install sigrix-runtime
62
+ ```
63
+
64
+ Python 3.11 or newer. The server is standard library only.
65
+
66
+ ## What it serves
67
+
68
+ | Verb | Route | Answers |
69
+ |---|---|---|
70
+ | `describe` | `GET /postern/v0/describe` | what the agent takes and returns, which credentials it needs, which tools cost money |
71
+ | `status` | `GET /postern/v0/status` | whether it is ready, and whether you may still run it |
72
+ | `run` | `POST /postern/v0/run` | the result |
73
+ | `stream` | `POST /postern/v0/stream` | the run as it goes, as server-sent events |
74
+
75
+ It meets [Level 3](https://github.com/sigrix-io/postern/blob/main/SPEC.md#3-conformance)
76
+ of the specification: all four verbs, the entitlement check of §5 and the version
77
+ check of §8. CI holds it to that with
78
+ [`postern-conformance`](https://pypi.org/project/postern-conformance/), run against
79
+ the runner itself rather than a stand-in.
80
+
81
+ One case falls short, and is said rather than hidden. An MCP server with
82
+ several tools is served as one agent whose `tool` input picks among them, and
83
+ `describe` has no way to declare a tool's own inputs required only when that
84
+ tool is chosen, so a request that satisfies `describe` can still be refused with
85
+ `bad_request` naming the missing input. Served with one tool, which is what CI
86
+ checks, the runner is conformant.
87
+
88
+ ## What it does at start
89
+
90
+ resolve the token → check the entitlement → pull the bundle → verify its digest → serve
91
+
92
+ A bundle already unzipped skips the middle two steps, because there is nothing
93
+ to fetch. The container image, `sigrix/runner`, runs this same module as its
94
+ entrypoint, so the two cannot drift.
95
+
96
+ The entitlement is checked with the distributor at start and again once the
97
+ answer is older than the bound the distributor declared. A distributor that
98
+ cannot be reached is not a refusal: a held answer lasts through the grace period
99
+ the distributor declared, a restart does not start a new one, and past it the
100
+ runner answers `unavailable`, which invites a retry. A refusal it has been given
101
+ keeps refusing, reachable or not.
102
+
103
+ ## Configuration
104
+
105
+ Read from the process environment first and from the bundle's `.env` second, so
106
+ a container can export them and a buyer can fill in the `.env` their bundle came
107
+ with. An exported value always wins.
108
+
109
+ | Variable | Meaning |
110
+ |---|---|
111
+ | `SIGRIX_TOKEN` | a runner token for this listing |
112
+ | `POSTERN_AGENT_ID` | which listing the bundle is, as `{seller}/{listing-id}` |
113
+ | `POSTERN_DISTRIBUTOR` | the distributor's base URL; `https://sigrix.io` if unset |
114
+ | `POSTERN_INBOUND_TOKEN` | when set, every request must carry it as a bearer token |
115
+
116
+ The listing can also be named as the one positional argument, which beats both:
117
+ `python -m sigrix_runtime.postern acme/my-crew`.
118
+
119
+ | Option | Default |
120
+ |---|---|
121
+ | `--bundle PATH` | the current directory |
122
+ | `--host HOST`, `--port PORT` | `127.0.0.1`, `8787` |
123
+ | `--allow-origin ORIGIN` | none: a browser page may not call the runner until you allow its origin |
124
+ | `--max-run-seconds N` | no limit (`POSTERN_MAX_RUN_SECONDS`) |
125
+ | `--max-concurrent-runs N` | 1 (`POSTERN_MAX_CONCURRENT_RUNS`) |
126
+ | `--no-pull` | pulling on; an empty folder is then an error rather than a download (`POSTERN_PULL=0`) |
127
+ | `--max-bundle-bytes N` | 64 MiB (`POSTERN_MAX_BUNDLE_BYTES`) |
128
+ | `--mcp` | serve an MCP server's tools instead of a bundle (below) |
129
+ | `--quiet` | log warnings and errors only |
130
+
131
+ Provider keys are none of the runner's business. The run reads them from the
132
+ bundle's `.env`, the runner reads only the names above out of that file, and
133
+ there is nowhere in the protocol for a key to travel. The runner's own settings
134
+ are removed from the environment of everything it runs.
135
+
136
+ **Exit codes**, because a container's is the only thing an operator sees when it
137
+ does not stay up: `0` interrupted after serving; `2` not configured; `3` refused,
138
+ by the distributor or by the checks on the bundle it served; `4` no usable
139
+ answer, or the bundle could not be written, which is worth a retry.
140
+
141
+ ## Serving an MCP server's tools
142
+
143
+ ```console
144
+ $ sigrix-runtime --mcp -- python my_server.py
145
+ ```
146
+
147
+ `--mcp` starts an MCP server over stdio and serves its tools as one agent:
148
+ `describe` comes from the server's `tools/list`, and a `run` is a `tools/call`,
149
+ with the same bounds and cancellation as a crew's run. Nothing is pulled.
150
+
151
+ ## Running a CrewAI bundle
152
+
153
+ A crew bundle runs through the execution layer, which needs CrewAI. A bundle's
154
+ own `requirements.txt` pins the exact versions it ships with; outside one, the
155
+ `crewai` extra installs a supported range:
156
+
157
+ ```console
158
+ $ pip install "sigrix-runtime[crewai]"
159
+ ```
160
+
161
+ ## Layout
162
+
163
+ - `sigrix_runtime.postern`: the server, the entitlement check, the verified
164
+ pull, the version check and the MCP mode. Standard library only.
165
+ - `sigrix_runtime.execution`, `loader`, `workforce`, `sandbox`, `configuration`,
166
+ `quiet`, `runner_env`: the one run path a bundle's `main.py` and the server
167
+ share, and what it needs to build and run a crew.
168
+
169
+ ## Versioning and licence
170
+
171
+ Semantic versioning, pre-1.0; `VERSIONING.md` says what may change and how a
172
+ release is made. Licensed under Apache-2.0; `NOTICE` covers the Sigrix name and
173
+ logo, which the licence does not grant.
@@ -0,0 +1,133 @@
1
+ # sigrix-runtime
2
+
3
+ The [Postern](https://github.com/sigrix-io/postern) runner inside every bundle
4
+ [Sigrix](https://sigrix.io) delivers. It serves one agent on your own machine
5
+ over Postern's four verbs, checks that you are entitled to run it, and runs it
6
+ with the keys in your own environment.
7
+
8
+ This is the code that already ships in every Sigrix bundle, published here so it
9
+ can be read, tested and depended on. A bundle carries its own copy, so running
10
+ one needs nothing installed from here:
11
+
12
+ ```console
13
+ $ cd my-bundle
14
+ $ python -m sigrix_runtime.postern
15
+ ```
16
+
17
+ then point a client at `http://127.0.0.1:8787/postern/v0/describe`. Install it
18
+ to serve an MCP server's tools (below), or to build on it:
19
+
20
+ ```console
21
+ $ pip install sigrix-runtime
22
+ ```
23
+
24
+ Python 3.11 or newer. The server is standard library only.
25
+
26
+ ## What it serves
27
+
28
+ | Verb | Route | Answers |
29
+ |---|---|---|
30
+ | `describe` | `GET /postern/v0/describe` | what the agent takes and returns, which credentials it needs, which tools cost money |
31
+ | `status` | `GET /postern/v0/status` | whether it is ready, and whether you may still run it |
32
+ | `run` | `POST /postern/v0/run` | the result |
33
+ | `stream` | `POST /postern/v0/stream` | the run as it goes, as server-sent events |
34
+
35
+ It meets [Level 3](https://github.com/sigrix-io/postern/blob/main/SPEC.md#3-conformance)
36
+ of the specification: all four verbs, the entitlement check of §5 and the version
37
+ check of §8. CI holds it to that with
38
+ [`postern-conformance`](https://pypi.org/project/postern-conformance/), run against
39
+ the runner itself rather than a stand-in.
40
+
41
+ One case falls short, and is said rather than hidden. An MCP server with
42
+ several tools is served as one agent whose `tool` input picks among them, and
43
+ `describe` has no way to declare a tool's own inputs required only when that
44
+ tool is chosen, so a request that satisfies `describe` can still be refused with
45
+ `bad_request` naming the missing input. Served with one tool, which is what CI
46
+ checks, the runner is conformant.
47
+
48
+ ## What it does at start
49
+
50
+ resolve the token → check the entitlement → pull the bundle → verify its digest → serve
51
+
52
+ A bundle already unzipped skips the middle two steps, because there is nothing
53
+ to fetch. The container image, `sigrix/runner`, runs this same module as its
54
+ entrypoint, so the two cannot drift.
55
+
56
+ The entitlement is checked with the distributor at start and again once the
57
+ answer is older than the bound the distributor declared. A distributor that
58
+ cannot be reached is not a refusal: a held answer lasts through the grace period
59
+ the distributor declared, a restart does not start a new one, and past it the
60
+ runner answers `unavailable`, which invites a retry. A refusal it has been given
61
+ keeps refusing, reachable or not.
62
+
63
+ ## Configuration
64
+
65
+ Read from the process environment first and from the bundle's `.env` second, so
66
+ a container can export them and a buyer can fill in the `.env` their bundle came
67
+ with. An exported value always wins.
68
+
69
+ | Variable | Meaning |
70
+ |---|---|
71
+ | `SIGRIX_TOKEN` | a runner token for this listing |
72
+ | `POSTERN_AGENT_ID` | which listing the bundle is, as `{seller}/{listing-id}` |
73
+ | `POSTERN_DISTRIBUTOR` | the distributor's base URL; `https://sigrix.io` if unset |
74
+ | `POSTERN_INBOUND_TOKEN` | when set, every request must carry it as a bearer token |
75
+
76
+ The listing can also be named as the one positional argument, which beats both:
77
+ `python -m sigrix_runtime.postern acme/my-crew`.
78
+
79
+ | Option | Default |
80
+ |---|---|
81
+ | `--bundle PATH` | the current directory |
82
+ | `--host HOST`, `--port PORT` | `127.0.0.1`, `8787` |
83
+ | `--allow-origin ORIGIN` | none: a browser page may not call the runner until you allow its origin |
84
+ | `--max-run-seconds N` | no limit (`POSTERN_MAX_RUN_SECONDS`) |
85
+ | `--max-concurrent-runs N` | 1 (`POSTERN_MAX_CONCURRENT_RUNS`) |
86
+ | `--no-pull` | pulling on; an empty folder is then an error rather than a download (`POSTERN_PULL=0`) |
87
+ | `--max-bundle-bytes N` | 64 MiB (`POSTERN_MAX_BUNDLE_BYTES`) |
88
+ | `--mcp` | serve an MCP server's tools instead of a bundle (below) |
89
+ | `--quiet` | log warnings and errors only |
90
+
91
+ Provider keys are none of the runner's business. The run reads them from the
92
+ bundle's `.env`, the runner reads only the names above out of that file, and
93
+ there is nowhere in the protocol for a key to travel. The runner's own settings
94
+ are removed from the environment of everything it runs.
95
+
96
+ **Exit codes**, because a container's is the only thing an operator sees when it
97
+ does not stay up: `0` interrupted after serving; `2` not configured; `3` refused,
98
+ by the distributor or by the checks on the bundle it served; `4` no usable
99
+ answer, or the bundle could not be written, which is worth a retry.
100
+
101
+ ## Serving an MCP server's tools
102
+
103
+ ```console
104
+ $ sigrix-runtime --mcp -- python my_server.py
105
+ ```
106
+
107
+ `--mcp` starts an MCP server over stdio and serves its tools as one agent:
108
+ `describe` comes from the server's `tools/list`, and a `run` is a `tools/call`,
109
+ with the same bounds and cancellation as a crew's run. Nothing is pulled.
110
+
111
+ ## Running a CrewAI bundle
112
+
113
+ A crew bundle runs through the execution layer, which needs CrewAI. A bundle's
114
+ own `requirements.txt` pins the exact versions it ships with; outside one, the
115
+ `crewai` extra installs a supported range:
116
+
117
+ ```console
118
+ $ pip install "sigrix-runtime[crewai]"
119
+ ```
120
+
121
+ ## Layout
122
+
123
+ - `sigrix_runtime.postern`: the server, the entitlement check, the verified
124
+ pull, the version check and the MCP mode. Standard library only.
125
+ - `sigrix_runtime.execution`, `loader`, `workforce`, `sandbox`, `configuration`,
126
+ `quiet`, `runner_env`: the one run path a bundle's `main.py` and the server
127
+ share, and what it needs to build and run a crew.
128
+
129
+ ## Versioning and licence
130
+
131
+ Semantic versioning, pre-1.0; `VERSIONING.md` says what may change and how a
132
+ release is made. Licensed under Apache-2.0; `NOTICE` covers the Sigrix name and
133
+ logo, which the licence does not grant.