haikeilabs-agentware 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.
- haikeilabs_agentware-0.1.0/CHANGELOG.md +58 -0
- haikeilabs_agentware-0.1.0/LICENSE +146 -0
- haikeilabs_agentware-0.1.0/MANIFEST.in +5 -0
- haikeilabs_agentware-0.1.0/PKG-INFO +132 -0
- haikeilabs_agentware-0.1.0/README.md +89 -0
- haikeilabs_agentware-0.1.0/pyproject.toml +103 -0
- haikeilabs_agentware-0.1.0/setup.cfg +4 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/__init__.py +38 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/executor/__init__.py +5 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/executor/executor.py +126 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/jobs/__init__.py +6 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/jobs/job.py +40 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/jobs/manager.py +116 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/__init__.py +261 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/auth.py +345 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/authorize_client.py +304 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/config.py +210 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/contract.py +175 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/evaluator.py +428 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/policy_bundle.py +702 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/proxy.py +302 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/runtime_link.py +1480 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/runtime_socket.py +574 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/kei/tool_sync.py +239 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/lint_tools.py +119 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/llm/__init__.py +7 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/llm/backend.py +28 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/llm/request.py +50 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/llm/response.py +33 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/llmcontext/__init__.py +6 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/llmcontext/context_window.py +169 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/llmcontext/manager.py +82 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/llmcontext/strategies.py +244 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/memory/__init__.py +25 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/memory/client.py +236 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/memory/confidence.py +88 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/memory/infer.py +211 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/memory/langgraph.py +73 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/__init__.py +26 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/audit.py +102 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/guardrails/__init__.py +20 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/guardrails/error_tracker.py +104 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/guardrails/nudge.py +104 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/guardrails/response_validator.py +172 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/guardrails/step_enforcer.py +57 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/inference.py +269 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/middleware.py +101 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/policy.py +180 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/tool_client.py +131 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/middleware/types.py +118 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/prompts/__init__.py +5 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/prompts/generator.py +49 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/py.typed +0 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/reasoning/__init__.py +62 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/reasoning/adapter.py +430 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/reasoning/types.py +102 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/toolformat/__init__.py +25 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/toolformat/formatter.py +352 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/tools/__init__.py +15 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/tools/registry.py +450 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs/agentware/tools/tool.py +117 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs_agentware.egg-info/PKG-INFO +132 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs_agentware.egg-info/SOURCES.txt +114 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs_agentware.egg-info/dependency_links.txt +1 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs_agentware.egg-info/requires.txt +17 -0
- haikeilabs_agentware-0.1.0/src/haikeilabs_agentware.egg-info/top_level.txt +2 -0
- haikeilabs_agentware-0.1.0/src/pedro_agentware/__init__.py +86 -0
- haikeilabs_agentware-0.1.0/tests/action_tool_boundary_test.py +265 -0
- haikeilabs_agentware-0.1.0/tests/adapters/__init__.py +3 -0
- haikeilabs_agentware-0.1.0/tests/adapters/integration/conftest.py +29 -0
- haikeilabs_agentware-0.1.0/tests/adapters/test_hermes.py +204 -0
- haikeilabs_agentware-0.1.0/tests/adapters/test_kitaru.py +102 -0
- haikeilabs_agentware-0.1.0/tests/adapters/test_pydantic.py +138 -0
- haikeilabs_agentware-0.1.0/tests/beta_tool_authorization_test.py +412 -0
- haikeilabs_agentware-0.1.0/tests/caller_context_test.py +260 -0
- haikeilabs_agentware-0.1.0/tests/conftest.py +10 -0
- haikeilabs_agentware-0.1.0/tests/context_window_test.py +296 -0
- haikeilabs_agentware-0.1.0/tests/delegation_boundary_test.py +404 -0
- haikeilabs_agentware-0.1.0/tests/dogfood_test.py +60 -0
- haikeilabs_agentware-0.1.0/tests/evals_runner_validation_test.py +233 -0
- haikeilabs_agentware-0.1.0/tests/evals_suite_test.py +1585 -0
- haikeilabs_agentware-0.1.0/tests/executor_test.py +97 -0
- haikeilabs_agentware-0.1.0/tests/fixtures/kei/delegation-envelope-v1.json +12 -0
- haikeilabs_agentware-0.1.0/tests/fixtures/kei/harness-invalid-bootstrap-token.json +20 -0
- haikeilabs_agentware-0.1.0/tests/fixtures/kei/harness-unsupported-version.json +12 -0
- haikeilabs_agentware-0.1.0/tests/fixtures/kei/harness-v1.json +40 -0
- haikeilabs_agentware-0.1.0/tests/guardrails_error_tracker_test.py +79 -0
- haikeilabs_agentware-0.1.0/tests/guardrails_nudge_test.py +87 -0
- haikeilabs_agentware-0.1.0/tests/guardrails_response_validator_test.py +153 -0
- haikeilabs_agentware-0.1.0/tests/guardrails_step_enforcer_test.py +93 -0
- haikeilabs_agentware-0.1.0/tests/infer_test.py +142 -0
- haikeilabs_agentware-0.1.0/tests/inference_test.py +580 -0
- haikeilabs_agentware-0.1.0/tests/kei/auth_test.py +171 -0
- haikeilabs_agentware-0.1.0/tests/kei/authorize_cases_test.py +288 -0
- haikeilabs_agentware-0.1.0/tests/kei/config_test.py +151 -0
- haikeilabs_agentware-0.1.0/tests/kei/conftest.py +35 -0
- haikeilabs_agentware-0.1.0/tests/kei/contract_test.py +147 -0
- haikeilabs_agentware-0.1.0/tests/kei/evaluator_test.py +335 -0
- haikeilabs_agentware-0.1.0/tests/kei/fake_kei_server.py +162 -0
- haikeilabs_agentware-0.1.0/tests/kei/policy_bundle_test.py +696 -0
- haikeilabs_agentware-0.1.0/tests/kei/proxy_test.py +166 -0
- haikeilabs_agentware-0.1.0/tests/kei/runtime_link_test.py +985 -0
- haikeilabs_agentware-0.1.0/tests/kei/runtime_socket_contract_test.py +295 -0
- haikeilabs_agentware-0.1.0/tests/kei/runtime_socket_test.py +533 -0
- haikeilabs_agentware-0.1.0/tests/kei/tool_sync_test.py +188 -0
- haikeilabs_agentware-0.1.0/tests/keimanifest_test.py +495 -0
- haikeilabs_agentware-0.1.0/tests/memory_client_test.py +117 -0
- haikeilabs_agentware-0.1.0/tests/message_types_test.py +91 -0
- haikeilabs_agentware-0.1.0/tests/middleware_test.py +80 -0
- haikeilabs_agentware-0.1.0/tests/pedro_agentware_compat_test.py +129 -0
- haikeilabs_agentware-0.1.0/tests/reasoning_test.py +264 -0
- haikeilabs_agentware-0.1.0/tests/strategies_test.py +335 -0
- haikeilabs_agentware-0.1.0/tests/third_party_harness_test.py +314 -0
- haikeilabs_agentware-0.1.0/tests/tool_linter_test.py +32 -0
- haikeilabs_agentware-0.1.0/tests/toolformat_test.py +738 -0
- haikeilabs_agentware-0.1.0/tests/tools_test.py +53 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the `haikeilabs-agentware` Python package (import
|
|
4
|
+
`haikeilabs.agentware`) are recorded here. The format follows
|
|
5
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the package uses
|
|
6
|
+
[semantic versioning](https://semver.org/) in its PEP 440 spelling. The Python
|
|
7
|
+
package is versioned independently of the TypeScript SDK; a Python release is
|
|
8
|
+
tagged `agentware-py-v<version>`.
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
## [0.1.0]
|
|
13
|
+
|
|
14
|
+
The first release on PyPI. Earlier versions were installed from the Git
|
|
15
|
+
repository only, as `pedro-agentware`.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- The distribution is named `haikeilabs-agentware`, matching the npm package
|
|
20
|
+
`@haikeilabs/agentware`.
|
|
21
|
+
- The import package is `haikeilabs.agentware`. `haikeilabs` is a PEP 420
|
|
22
|
+
implicit namespace package (no `haikeilabs/__init__.py`), so other
|
|
23
|
+
`haikeilabs.*` distributions can install beside this one.
|
|
24
|
+
- The package license metadata now matches the repository: `Apache-2.0`
|
|
25
|
+
(SPDX expression, PEP 639), with `LICENSE` included in the distributions.
|
|
26
|
+
It previously said MIT.
|
|
27
|
+
- `haikeilabs.agentware.__version__` comes from the installed package
|
|
28
|
+
metadata, so `pyproject.toml` is the only version source.
|
|
29
|
+
- The distributions no longer contain the repository's eval runner
|
|
30
|
+
(`python/src/evals`) as a top-level `evals` module.
|
|
31
|
+
|
|
32
|
+
### Deprecated
|
|
33
|
+
|
|
34
|
+
- `pedro_agentware`, the previous import name. It still works: it and every
|
|
35
|
+
`pedro_agentware.<submodule>` resolve to the same module objects as
|
|
36
|
+
`haikeilabs.agentware.<submodule>`, and importing it emits a
|
|
37
|
+
`DeprecationWarning`. Replace `pedro_agentware` with `haikeilabs.agentware`
|
|
38
|
+
in imports; the alias will be removed in a future release.
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- `haikeilabs.agentware.kei.runtime_socket`: an async client for the
|
|
43
|
+
kei-proxy daemon's Unix socket (named sessions, fail-closed `authorize`,
|
|
44
|
+
model routes, policy bundle status), and `KeiProxySocketAuthorizationClient`
|
|
45
|
+
so `KeiProxyEvaluator` can authorize over the socket.
|
|
46
|
+
`select_authorization_client` picks the socket client when one is
|
|
47
|
+
configured, else the `kei-proxy authorize` subprocess client.
|
|
48
|
+
- `haikeilabs.agentware.kei.tool_sync`: `sync_tool_manifest` replaces the
|
|
49
|
+
runtime's tool manifest (`PUT /api/v1/runtime/tools`), refuses an empty
|
|
50
|
+
manifest, and honours the egress proxy and `NO_PROXY`.
|
|
51
|
+
- PyPI release workflow (`.github/workflows/publish-python.yml`): trusted
|
|
52
|
+
publishing (OIDC, no stored token) with attestations. Pre-releases go to
|
|
53
|
+
TestPyPI.
|
|
54
|
+
- PyPI package page (`python/README.md`), project URLs, classifiers and a
|
|
55
|
+
`py.typed` marker.
|
|
56
|
+
|
|
57
|
+
[Unreleased]: https://github.com/HaikeiLabs/agentware/compare/agentware-py-v0.1.0...HEAD
|
|
58
|
+
[0.1.0]: https://github.com/HaikeiLabs/agentware/releases/tag/agentware-py-v0.1.0
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
================================================================================
|
|
20
|
+
|
|
21
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
22
|
+
|
|
23
|
+
1. Definitions.
|
|
24
|
+
|
|
25
|
+
2. Grant of Patent License.
|
|
26
|
+
|
|
27
|
+
Subject to the terms and conditions of this License, each Contributor
|
|
28
|
+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
|
|
29
|
+
royalty-free, irrevocable (except as stated in this section) patent
|
|
30
|
+
license to make, have made, use, offer to sell, sell, import, and
|
|
31
|
+
otherwise transfer the Work, where such license applies only to those
|
|
32
|
+
patent claims licensable by such Contributor that are necessarily
|
|
33
|
+
infringed by their Contribution(s) alone or by combination of their
|
|
34
|
+
Contribution(s) with the Work to which such Contribution(s) was
|
|
35
|
+
submitted. If You institute patent litigation against any entity
|
|
36
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
37
|
+
the Work or a Contribution incorporated within the Work constitutes
|
|
38
|
+
direct or contributory patent infringement, then any patent licenses
|
|
39
|
+
granted to You under this License for that Work shall terminate as
|
|
40
|
+
of the date such litigation is filed.
|
|
41
|
+
|
|
42
|
+
3. Grant of Copyright License.
|
|
43
|
+
|
|
44
|
+
Subject to the terms and conditions of this License, each Contributor
|
|
45
|
+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
|
|
46
|
+
royalty-free, irrevocable copyright license to reproduce, prepare
|
|
47
|
+
derivative works of, publicly display, publicly perform, sublicense,
|
|
48
|
+
and distribute the Work and such derivative works in source or object
|
|
49
|
+
form.
|
|
50
|
+
|
|
51
|
+
4. Grant of Patent License.
|
|
52
|
+
|
|
53
|
+
Subject to the terms and conditions of this License, each Contributor
|
|
54
|
+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
|
|
55
|
+
royalty-free, irrevocable (except as noted in this section) patent
|
|
56
|
+
license to make, have made, use, offer to sell, sell, import, and
|
|
57
|
+
otherwise transfer the Work, where such license applies only to those
|
|
58
|
+
patent claims licensable by such Contributor that are necessarily
|
|
59
|
+
infringed by their Contribution(s) alone or by combination of their
|
|
60
|
+
Contribution(s) with the Work to which such Contribution(s) was
|
|
61
|
+
submitted. If You institute patent litigation against any entity
|
|
62
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
63
|
+
the Work or a Contribution incorporated within the Work constitutes
|
|
64
|
+
direct or contributory patent infringement, then any patent licenses
|
|
65
|
+
granted to You under this License for that Work shall terminate as
|
|
66
|
+
of the date such litigation is filed.
|
|
67
|
+
|
|
68
|
+
5. Submission of Contributions.
|
|
69
|
+
|
|
70
|
+
Unless You explicitly state otherwise, any Contribution intentionally
|
|
71
|
+
submitted for inclusion in the Work by You to the Licensor shall be
|
|
72
|
+
under the terms and conditions of this License, without any additional
|
|
73
|
+
terms or conditions. Notwithstanding the above, nothing herein shall
|
|
74
|
+
supersede or modify the terms of any separate license agreement you
|
|
75
|
+
may have executed with Licensor regarding such Contributions.
|
|
76
|
+
|
|
77
|
+
6. Trademarks.
|
|
78
|
+
|
|
79
|
+
This License does not grant permission to use the trade names,
|
|
80
|
+
trademarks, service marks, or product names of the Licensor,
|
|
81
|
+
except as required for reasonable and customary use in describing
|
|
82
|
+
the origin of the Work and reproducing the content of the NOTICE file.
|
|
83
|
+
|
|
84
|
+
7. Disclaimer of Warranty.
|
|
85
|
+
|
|
86
|
+
Unless required by applicable law or agreed to in writing, Licensor
|
|
87
|
+
provides the Work (and each Contributor provides its Contributions)
|
|
88
|
+
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
89
|
+
either express or implied, including, without limitation, any
|
|
90
|
+
warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY,
|
|
91
|
+
or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible
|
|
92
|
+
for determining the appropriateness of using or redistributing the
|
|
93
|
+
Work and assume any risks associated with Your exercise of permissions
|
|
94
|
+
under this License.
|
|
95
|
+
|
|
96
|
+
8. Limitation of Liability.
|
|
97
|
+
|
|
98
|
+
In no event and under no legal theory, whether in tort (including
|
|
99
|
+
negligence), contract, or otherwise, unless required by applicable
|
|
100
|
+
law (such as deliberate and grossly negligent acts) or agreed to in
|
|
101
|
+
writing, shall any Contributor be liable to You for damages, including
|
|
102
|
+
any direct, indirect, special, incidental, or consequential damages
|
|
103
|
+
of any character arising as a result of this License or out of the
|
|
104
|
+
use or inability to use the Work (including but not limited to damages
|
|
105
|
+
for loss of goodwill, work stoppage, computer failure or malfunction,
|
|
106
|
+
or any and all other damages or losses), even if such Contributor
|
|
107
|
+
has been advised of the possibility of such damages.
|
|
108
|
+
|
|
109
|
+
9. Accepting Warranty or Additional Liability.
|
|
110
|
+
|
|
111
|
+
While redistributing the Work or Derivative Works thereof, You may
|
|
112
|
+
choose to offer, and charge a fee for, acceptance of support,
|
|
113
|
+
warranty, indemnity, or other liability obligations and/or rights
|
|
114
|
+
consistent with this License. However, in accepting such obligations,
|
|
115
|
+
You may act only on Your own behalf and on Your sole responsibility,
|
|
116
|
+
not on behalf of any other Contributor, and only if You agree to
|
|
117
|
+
indemnify, defend, and hold each Contributor harmless for any liability
|
|
118
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
119
|
+
of your accepting any such warranty or additional liability.
|
|
120
|
+
|
|
121
|
+
END OF TERMS AND CONDITIONS
|
|
122
|
+
|
|
123
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
124
|
+
|
|
125
|
+
To apply the Apache License to your work, attach the following
|
|
126
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
127
|
+
replaced with your own identifying information. (Don't include
|
|
128
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
129
|
+
comment syntax for the file format. We also recommend that a
|
|
130
|
+
file or class name and description of purpose be included on the
|
|
131
|
+
same "printed page" as the copyright notice for easier
|
|
132
|
+
identification within third-party archives.
|
|
133
|
+
|
|
134
|
+
Copyright [yyyy] [name of copyright owner]
|
|
135
|
+
|
|
136
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
137
|
+
you may not use this file except in compliance with the License.
|
|
138
|
+
You may obtain a copy of the License at
|
|
139
|
+
|
|
140
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
141
|
+
|
|
142
|
+
Unless required by applicable law or agreed to in writing, software
|
|
143
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
144
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
145
|
+
See the License for the specific language governing permissions and
|
|
146
|
+
limitations under the License.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: haikeilabs-agentware
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Policy enforcement and audit middleware for LLM agent tool calls
|
|
5
|
+
Author: HaikeiLabs
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/HaikeiLabs/agentware
|
|
8
|
+
Project-URL: Documentation, https://github.com/HaikeiLabs/agentware/tree/main/docs/python
|
|
9
|
+
Project-URL: Repository, https://github.com/HaikeiLabs/agentware
|
|
10
|
+
Project-URL: Issues, https://github.com/HaikeiLabs/agentware/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/HaikeiLabs/agentware/blob/main/python/CHANGELOG.md
|
|
12
|
+
Keywords: llm,agents,tool-calling,mcp,policy,audit,middleware
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
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
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: pydantic>=2.0
|
|
29
|
+
Requires-Dist: httpx>=0.27.0
|
|
30
|
+
Provides-Extra: inference
|
|
31
|
+
Requires-Dist: pgmpy>=0.1.26; extra == "inference"
|
|
32
|
+
Provides-Extra: evals
|
|
33
|
+
Requires-Dist: pyyaml>=6.0; extra == "evals"
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pyyaml>=6.0; extra == "dev"
|
|
36
|
+
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
40
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
41
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# haikeilabs-agentware
|
|
45
|
+
|
|
46
|
+
Policy enforcement and audit middleware for LLM agent tool calls.
|
|
47
|
+
|
|
48
|
+
`haikeilabs-agentware` sits between an agent (the LLM orchestrator) and tool
|
|
49
|
+
execution. Every tool call is checked against policy (allow, deny, or filter
|
|
50
|
+
with redacted arguments, rate limits, caller-context conditions) and every
|
|
51
|
+
decision is audited. It is the Python implementation of
|
|
52
|
+
[agentware](https://github.com/HaikeiLabs/agentware), which also ships Go and
|
|
53
|
+
TypeScript implementations with the same behaviour.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install haikeilabs-agentware
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from haikeilabs.agentware.middleware import AuditedToolClient
|
|
63
|
+
import haikeilabs.agentware.kei
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The distribution is `haikeilabs-agentware` (like the npm package
|
|
67
|
+
`@haikeilabs/agentware`); the import package is `haikeilabs.agentware`, under
|
|
68
|
+
the `haikeilabs` namespace. Python 3.10 or later.
|
|
69
|
+
|
|
70
|
+
## Quick start
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from haikeilabs.agentware.middleware import (
|
|
74
|
+
Action,
|
|
75
|
+
AuditedToolClient,
|
|
76
|
+
CallerContext,
|
|
77
|
+
Policy,
|
|
78
|
+
Rule,
|
|
79
|
+
SimplePolicyEvaluator,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
policy = Policy(rules=[
|
|
83
|
+
Rule(name="no-repo-deletes", tools=["github.delete_repo"], action=Action.DENY),
|
|
84
|
+
Rule(name="default", tools=["*"], action=Action.ALLOW),
|
|
85
|
+
])
|
|
86
|
+
evaluator = SimplePolicyEvaluator(policy)
|
|
87
|
+
|
|
88
|
+
# The human who started the request. Trusted defaults to False (fail closed).
|
|
89
|
+
caller = CallerContext(user_id="ada", invoking_subject="ada")
|
|
90
|
+
decision = evaluator.evaluate("github.delete_repo", {"repo": "pipeline"}, caller)
|
|
91
|
+
assert decision.action is Action.DENY
|
|
92
|
+
|
|
93
|
+
# AuditedToolClient enforces the decision and records it, allow or deny.
|
|
94
|
+
client = AuditedToolClient(evaluator=evaluator)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
When an agent delegates to a subagent, `CallerContext.delegate()` carries the
|
|
98
|
+
invoking subject unchanged and records the parent span and delegation depth,
|
|
99
|
+
so the audit trail always leads back to the human who authorized the request.
|
|
100
|
+
|
|
101
|
+
## What's in the package
|
|
102
|
+
|
|
103
|
+
- `haikeilabs.agentware.middleware`: the policy evaluator, rules and conditions,
|
|
104
|
+
rate limits, auditors, `AuditedToolClient`, and agent-loop guardrails.
|
|
105
|
+
- `haikeilabs.agentware.kei`: Kei integration. `KeiProxyEvaluator` is a policy
|
|
106
|
+
evaluator backed by `kei-proxy` that fails closed on everything except an
|
|
107
|
+
explicit allow. The harness contract and manifest loading also live here.
|
|
108
|
+
- `haikeilabs.agentware.toolformat`: tool-call formatting and parsing for open
|
|
109
|
+
models without native tool-call APIs (Llama, Mistral, Qwen, Nemotron and
|
|
110
|
+
others).
|
|
111
|
+
- `haikeilabs.agentware.llm`, `haikeilabs.agentware.llmcontext`: token counting,
|
|
112
|
+
context-window accounting and conversation compaction.
|
|
113
|
+
- `haikeilabs.agentware.tools`, `executor`, `jobs`, `prompts`: the tool registry,
|
|
114
|
+
dispatch, background jobs and system-prompt generation.
|
|
115
|
+
|
|
116
|
+
## Migrating from `pedro_agentware`
|
|
117
|
+
|
|
118
|
+
The import package used to be `pedro_agentware`. It still works as a
|
|
119
|
+
deprecated alias: `import pedro_agentware.kei.evaluator` gives you the same
|
|
120
|
+
module object as `haikeilabs.agentware.kei.evaluator`, and emits a
|
|
121
|
+
`DeprecationWarning`. Replace `pedro_agentware` with `haikeilabs.agentware` in
|
|
122
|
+
your imports; the alias will be removed in a future release.
|
|
123
|
+
|
|
124
|
+
## Documentation
|
|
125
|
+
|
|
126
|
+
- [Python usage guide](https://github.com/HaikeiLabs/agentware/tree/main/docs/python)
|
|
127
|
+
- [Harness contract](https://github.com/HaikeiLabs/agentware/blob/main/docs/harness-contract.md)
|
|
128
|
+
- [Changelog](https://github.com/HaikeiLabs/agentware/blob/main/python/CHANGELOG.md)
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
Apache-2.0. See [LICENSE](https://github.com/HaikeiLabs/agentware/blob/main/LICENSE).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# haikeilabs-agentware
|
|
2
|
+
|
|
3
|
+
Policy enforcement and audit middleware for LLM agent tool calls.
|
|
4
|
+
|
|
5
|
+
`haikeilabs-agentware` sits between an agent (the LLM orchestrator) and tool
|
|
6
|
+
execution. Every tool call is checked against policy (allow, deny, or filter
|
|
7
|
+
with redacted arguments, rate limits, caller-context conditions) and every
|
|
8
|
+
decision is audited. It is the Python implementation of
|
|
9
|
+
[agentware](https://github.com/HaikeiLabs/agentware), which also ships Go and
|
|
10
|
+
TypeScript implementations with the same behaviour.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install haikeilabs-agentware
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from haikeilabs.agentware.middleware import AuditedToolClient
|
|
20
|
+
import haikeilabs.agentware.kei
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The distribution is `haikeilabs-agentware` (like the npm package
|
|
24
|
+
`@haikeilabs/agentware`); the import package is `haikeilabs.agentware`, under
|
|
25
|
+
the `haikeilabs` namespace. Python 3.10 or later.
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from haikeilabs.agentware.middleware import (
|
|
31
|
+
Action,
|
|
32
|
+
AuditedToolClient,
|
|
33
|
+
CallerContext,
|
|
34
|
+
Policy,
|
|
35
|
+
Rule,
|
|
36
|
+
SimplePolicyEvaluator,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
policy = Policy(rules=[
|
|
40
|
+
Rule(name="no-repo-deletes", tools=["github.delete_repo"], action=Action.DENY),
|
|
41
|
+
Rule(name="default", tools=["*"], action=Action.ALLOW),
|
|
42
|
+
])
|
|
43
|
+
evaluator = SimplePolicyEvaluator(policy)
|
|
44
|
+
|
|
45
|
+
# The human who started the request. Trusted defaults to False (fail closed).
|
|
46
|
+
caller = CallerContext(user_id="ada", invoking_subject="ada")
|
|
47
|
+
decision = evaluator.evaluate("github.delete_repo", {"repo": "pipeline"}, caller)
|
|
48
|
+
assert decision.action is Action.DENY
|
|
49
|
+
|
|
50
|
+
# AuditedToolClient enforces the decision and records it, allow or deny.
|
|
51
|
+
client = AuditedToolClient(evaluator=evaluator)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
When an agent delegates to a subagent, `CallerContext.delegate()` carries the
|
|
55
|
+
invoking subject unchanged and records the parent span and delegation depth,
|
|
56
|
+
so the audit trail always leads back to the human who authorized the request.
|
|
57
|
+
|
|
58
|
+
## What's in the package
|
|
59
|
+
|
|
60
|
+
- `haikeilabs.agentware.middleware`: the policy evaluator, rules and conditions,
|
|
61
|
+
rate limits, auditors, `AuditedToolClient`, and agent-loop guardrails.
|
|
62
|
+
- `haikeilabs.agentware.kei`: Kei integration. `KeiProxyEvaluator` is a policy
|
|
63
|
+
evaluator backed by `kei-proxy` that fails closed on everything except an
|
|
64
|
+
explicit allow. The harness contract and manifest loading also live here.
|
|
65
|
+
- `haikeilabs.agentware.toolformat`: tool-call formatting and parsing for open
|
|
66
|
+
models without native tool-call APIs (Llama, Mistral, Qwen, Nemotron and
|
|
67
|
+
others).
|
|
68
|
+
- `haikeilabs.agentware.llm`, `haikeilabs.agentware.llmcontext`: token counting,
|
|
69
|
+
context-window accounting and conversation compaction.
|
|
70
|
+
- `haikeilabs.agentware.tools`, `executor`, `jobs`, `prompts`: the tool registry,
|
|
71
|
+
dispatch, background jobs and system-prompt generation.
|
|
72
|
+
|
|
73
|
+
## Migrating from `pedro_agentware`
|
|
74
|
+
|
|
75
|
+
The import package used to be `pedro_agentware`. It still works as a
|
|
76
|
+
deprecated alias: `import pedro_agentware.kei.evaluator` gives you the same
|
|
77
|
+
module object as `haikeilabs.agentware.kei.evaluator`, and emits a
|
|
78
|
+
`DeprecationWarning`. Replace `pedro_agentware` with `haikeilabs.agentware` in
|
|
79
|
+
your imports; the alias will be removed in a future release.
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
|
|
83
|
+
- [Python usage guide](https://github.com/HaikeiLabs/agentware/tree/main/docs/python)
|
|
84
|
+
- [Harness contract](https://github.com/HaikeiLabs/agentware/blob/main/docs/harness-contract.md)
|
|
85
|
+
- [Changelog](https://github.com/HaikeiLabs/agentware/blob/main/python/CHANGELOG.md)
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
Apache-2.0. See [LICENSE](https://github.com/HaikeiLabs/agentware/blob/main/LICENSE).
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
# setuptools 77 implements PEP 639 (SPDX `license` + `license-files`).
|
|
3
|
+
requires = ["setuptools>=77.0"]
|
|
4
|
+
build-backend = "setuptools.build_meta"
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "haikeilabs-agentware"
|
|
8
|
+
# The single version source: the wheel's metadata, and so
|
|
9
|
+
# haikeilabs.agentware.__version__, come from here. Versioned independently of
|
|
10
|
+
# the TypeScript SDK; a release tag is agentware-py-v<version>.
|
|
11
|
+
version = "0.1.0"
|
|
12
|
+
description = "Policy enforcement and audit middleware for LLM agent tool calls"
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
license = "Apache-2.0"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
16
|
+
authors = [
|
|
17
|
+
{name = "HaikeiLabs"},
|
|
18
|
+
]
|
|
19
|
+
requires-python = ">=3.10"
|
|
20
|
+
keywords = ["llm", "agents", "tool-calling", "mcp", "policy", "audit", "middleware"]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 4 - Beta",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"Operating System :: OS Independent",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Topic :: Security",
|
|
32
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
33
|
+
"Typing :: Typed",
|
|
34
|
+
]
|
|
35
|
+
dependencies = [
|
|
36
|
+
"pydantic>=2.0",
|
|
37
|
+
"httpx>=0.27.0",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
inference = [
|
|
42
|
+
"pgmpy>=0.1.26",
|
|
43
|
+
]
|
|
44
|
+
evals = [
|
|
45
|
+
"pyyaml>=6.0",
|
|
46
|
+
]
|
|
47
|
+
dev = [
|
|
48
|
+
"pyyaml>=6.0",
|
|
49
|
+
"types-PyYAML>=6.0",
|
|
50
|
+
"pytest>=7.0",
|
|
51
|
+
"pytest-cov>=4.0",
|
|
52
|
+
"pytest-asyncio>=0.21",
|
|
53
|
+
"ruff>=0.1",
|
|
54
|
+
"mypy>=1.0",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[project.urls]
|
|
58
|
+
Homepage = "https://github.com/HaikeiLabs/agentware"
|
|
59
|
+
Documentation = "https://github.com/HaikeiLabs/agentware/tree/main/docs/python"
|
|
60
|
+
Repository = "https://github.com/HaikeiLabs/agentware"
|
|
61
|
+
Issues = "https://github.com/HaikeiLabs/agentware/issues"
|
|
62
|
+
Changelog = "https://github.com/HaikeiLabs/agentware/blob/main/python/CHANGELOG.md"
|
|
63
|
+
|
|
64
|
+
[tool.setuptools.packages.find]
|
|
65
|
+
where = ["src"]
|
|
66
|
+
# haikeilabs/ is a PEP 420 implicit namespace package (no __init__.py), so other
|
|
67
|
+
# haikeilabs.* distributions can install beside this one.
|
|
68
|
+
namespaces = true
|
|
69
|
+
# The SDK and its deprecated pedro_agentware alias. src/evals is the repo's eval
|
|
70
|
+
# runner (run with PYTHONPATH=src) and must not land on PyPI as a top-level
|
|
71
|
+
# "evals" package.
|
|
72
|
+
include = ["haikeilabs.agentware*", "pedro_agentware*"]
|
|
73
|
+
exclude = ["*.__pycache__"]
|
|
74
|
+
|
|
75
|
+
[tool.setuptools.package-data]
|
|
76
|
+
"haikeilabs.agentware" = ["py.typed"]
|
|
77
|
+
|
|
78
|
+
[tool.pytest.ini_options]
|
|
79
|
+
testpaths = ["tests"]
|
|
80
|
+
pythonpath = ["src"]
|
|
81
|
+
python_files = ["*_test.py"]
|
|
82
|
+
python_classes = ["Test*"]
|
|
83
|
+
python_functions = ["test_*"]
|
|
84
|
+
addopts = "-v --tb=short"
|
|
85
|
+
asyncio_mode = "auto"
|
|
86
|
+
|
|
87
|
+
[tool.ruff]
|
|
88
|
+
line-length = 100
|
|
89
|
+
target-version = "py310"
|
|
90
|
+
|
|
91
|
+
[tool.ruff.lint]
|
|
92
|
+
select = ["E", "F", "I", "N", "W", "UP"]
|
|
93
|
+
ignore = ["E501"]
|
|
94
|
+
|
|
95
|
+
[tool.mypy]
|
|
96
|
+
python_version = "3.10"
|
|
97
|
+
# src/haikeilabs is a namespace package: module names are relative to src/.
|
|
98
|
+
mypy_path = "src"
|
|
99
|
+
explicit_package_bases = true
|
|
100
|
+
strict = true
|
|
101
|
+
ignore_missing_imports = true
|
|
102
|
+
warn_return_any = false
|
|
103
|
+
exclude = ["tests", "adapters"]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Pedro Agentware - Agent middleware and tooling for LLM tool calling."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError
|
|
4
|
+
from importlib.metadata import version as _version
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
# pyproject.toml is the single version source.
|
|
8
|
+
__version__ = _version("haikeilabs-agentware")
|
|
9
|
+
except PackageNotFoundError: # running from a source tree without an install
|
|
10
|
+
__version__ = "0+unknown"
|
|
11
|
+
|
|
12
|
+
from .executor import Executor
|
|
13
|
+
from .jobs import Job, JobManager
|
|
14
|
+
from .llm import Backend, Message
|
|
15
|
+
from .llmcontext import ContextManager
|
|
16
|
+
from .middleware import Auditor, Middleware, PolicyEvaluator
|
|
17
|
+
from .prompts import PromptGenerator
|
|
18
|
+
from .reasoning import ReasoningAdapter
|
|
19
|
+
from .toolformat import ToolFormatter
|
|
20
|
+
from .tools import Result, Tool, ToolRegistry
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"Tool",
|
|
24
|
+
"ToolRegistry",
|
|
25
|
+
"Result",
|
|
26
|
+
"Middleware",
|
|
27
|
+
"PolicyEvaluator",
|
|
28
|
+
"Auditor",
|
|
29
|
+
"Executor",
|
|
30
|
+
"Job",
|
|
31
|
+
"JobManager",
|
|
32
|
+
"Message",
|
|
33
|
+
"Backend",
|
|
34
|
+
"ContextManager",
|
|
35
|
+
"PromptGenerator",
|
|
36
|
+
"ToolFormatter",
|
|
37
|
+
"ReasoningAdapter",
|
|
38
|
+
]
|