harness-composer 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.
- harness_composer-0.1.0/.gitattributes +2 -0
- harness_composer-0.1.0/.github/workflows/ci.yml +37 -0
- harness_composer-0.1.0/.github/workflows/publish.yml +45 -0
- harness_composer-0.1.0/.gitignore +46 -0
- harness_composer-0.1.0/CONTRIBUTING.md +58 -0
- harness_composer-0.1.0/LICENSE +130 -0
- harness_composer-0.1.0/PKG-INFO +379 -0
- harness_composer-0.1.0/README.md +338 -0
- harness_composer-0.1.0/examples/document_summary.py +58 -0
- harness_composer-0.1.0/examples/flight_booking.py +104 -0
- harness_composer-0.1.0/harness_composer/__init__.py +24 -0
- harness_composer-0.1.0/harness_composer/adapters/__init__.py +3 -0
- harness_composer-0.1.0/harness_composer/adapters/base.py +42 -0
- harness_composer-0.1.0/harness_composer/adapters/langchain/__init__.py +4 -0
- harness_composer-0.1.0/harness_composer/adapters/langchain/adapter.py +147 -0
- harness_composer-0.1.0/harness_composer/adapters/langchain/callbacks.py +151 -0
- harness_composer-0.1.0/harness_composer/classifier/__init__.py +11 -0
- harness_composer-0.1.0/harness_composer/classifier/base.py +45 -0
- harness_composer-0.1.0/harness_composer/classifier/rules_based.py +263 -0
- harness_composer-0.1.0/harness_composer/classifier/task_profile.py +108 -0
- harness_composer-0.1.0/harness_composer/composer.py +141 -0
- harness_composer-0.1.0/harness_composer/composition/__init__.py +4 -0
- harness_composer-0.1.0/harness_composer/composition/engine.py +149 -0
- harness_composer-0.1.0/harness_composer/composition/harness_config.py +59 -0
- harness_composer-0.1.0/harness_composer/library/__init__.py +23 -0
- harness_composer-0.1.0/harness_composer/library/base.py +46 -0
- harness_composer-0.1.0/harness_composer/library/context_strategies/__init__.py +10 -0
- harness_composer-0.1.0/harness_composer/library/context_strategies/base.py +51 -0
- harness_composer-0.1.0/harness_composer/library/context_strategies/compression.py +109 -0
- harness_composer-0.1.0/harness_composer/library/context_strategies/minimal.py +66 -0
- harness_composer-0.1.0/harness_composer/library/guardrails/__init__.py +19 -0
- harness_composer-0.1.0/harness_composer/library/guardrails/base.py +49 -0
- harness_composer-0.1.0/harness_composer/library/guardrails/financial_threshold.py +116 -0
- harness_composer-0.1.0/harness_composer/library/guardrails/irreversibility_confirmation.py +85 -0
- harness_composer-0.1.0/harness_composer/library/guardrails/pii_redaction.py +120 -0
- harness_composer-0.1.0/harness_composer/library/tool_wrappers/__init__.py +10 -0
- harness_composer-0.1.0/harness_composer/library/tool_wrappers/base.py +54 -0
- harness_composer-0.1.0/harness_composer/library/tool_wrappers/http_request.py +106 -0
- harness_composer-0.1.0/harness_composer/library/tool_wrappers/web_search.py +64 -0
- harness_composer-0.1.0/harness_composer/library/verification/__init__.py +15 -0
- harness_composer-0.1.0/harness_composer/library/verification/base.py +58 -0
- harness_composer-0.1.0/harness_composer/library/verification/database_write.py +119 -0
- harness_composer-0.1.0/harness_composer/library/verification/external_confirmation.py +116 -0
- harness_composer-0.1.0/harness_composer/registry.py +139 -0
- harness_composer-0.1.0/pyproject.toml +69 -0
- harness_composer-0.1.0/tests/__init__.py +0 -0
- harness_composer-0.1.0/tests/test_classifier.py +117 -0
- harness_composer-0.1.0/tests/test_components.py +218 -0
- harness_composer-0.1.0/tests/test_composition.py +101 -0
- harness_composer-0.1.0/tests/test_registry.py +48 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.11", "3.12"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
cache: pip
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: pip install -e ".[dev]"
|
|
29
|
+
|
|
30
|
+
- name: Lint (ruff)
|
|
31
|
+
run: ruff check harness_composer/
|
|
32
|
+
|
|
33
|
+
- name: Type check (mypy)
|
|
34
|
+
run: mypy harness_composer/ --strict
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: pytest tests/ -v --tb=short
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
name: Build distribution
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.11"
|
|
18
|
+
|
|
19
|
+
- name: Install build
|
|
20
|
+
run: pip install build
|
|
21
|
+
|
|
22
|
+
- name: Build sdist and wheel
|
|
23
|
+
run: python -m build
|
|
24
|
+
|
|
25
|
+
- uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: dist
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
publish:
|
|
31
|
+
name: Publish to PyPI
|
|
32
|
+
needs: build
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
environment: pypi
|
|
35
|
+
permissions:
|
|
36
|
+
id-token: write # required for OIDC trusted publishing
|
|
37
|
+
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/download-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: dist
|
|
42
|
+
path: dist/
|
|
43
|
+
|
|
44
|
+
- name: Publish to PyPI
|
|
45
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.eggs/
|
|
11
|
+
*.whl
|
|
12
|
+
MANIFEST
|
|
13
|
+
|
|
14
|
+
# Virtual environments
|
|
15
|
+
.venv/
|
|
16
|
+
venv/
|
|
17
|
+
env/
|
|
18
|
+
.env
|
|
19
|
+
|
|
20
|
+
# Testing & coverage
|
|
21
|
+
.pytest_cache/
|
|
22
|
+
.coverage
|
|
23
|
+
.coverage.*
|
|
24
|
+
htmlcov/
|
|
25
|
+
coverage.xml
|
|
26
|
+
*.xml
|
|
27
|
+
|
|
28
|
+
# Type checking
|
|
29
|
+
.mypy_cache/
|
|
30
|
+
.dmypy.json
|
|
31
|
+
|
|
32
|
+
# IDE
|
|
33
|
+
.vscode/
|
|
34
|
+
.idea/
|
|
35
|
+
*.swp
|
|
36
|
+
*.swo
|
|
37
|
+
.DS_Store
|
|
38
|
+
|
|
39
|
+
# Jupyter
|
|
40
|
+
.ipynb_checkpoints/
|
|
41
|
+
|
|
42
|
+
# Hatch / build
|
|
43
|
+
.hatch/
|
|
44
|
+
|
|
45
|
+
# Claude Code
|
|
46
|
+
.claude/
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Contributing to Harness Composer
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/your-org/harness-composer
|
|
9
|
+
cd harness-composer
|
|
10
|
+
pip install -e ".[dev]"
|
|
11
|
+
pytest # should show 70 passed
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What we're looking for
|
|
15
|
+
|
|
16
|
+
### High value
|
|
17
|
+
- **New components** — tool wrappers, context strategies, guardrails, and verification checks for real-world use cases (Stripe, Twilio, Salesforce, Bedrock, etc.)
|
|
18
|
+
- **New framework adapters** — Bedrock AgentCore and Google ADK are next on the roadmap
|
|
19
|
+
- **Classifier improvements** — better signal patterns, edge cases, language coverage
|
|
20
|
+
- **Real-world examples** — the more specific and realistic, the better
|
|
21
|
+
|
|
22
|
+
### Also welcome
|
|
23
|
+
- Bug fixes with failing test cases
|
|
24
|
+
- Documentation improvements
|
|
25
|
+
- Performance improvements with benchmarks
|
|
26
|
+
|
|
27
|
+
## The one rule for component contributions
|
|
28
|
+
|
|
29
|
+
**Every component that enters the registry is a commitment.**
|
|
30
|
+
|
|
31
|
+
It will be used by agents making real decisions — financial transactions, outbound messages, data mutations. The governance model is intentional: the PR review is the safety check, not the runtime.
|
|
32
|
+
|
|
33
|
+
To add a component:
|
|
34
|
+
|
|
35
|
+
1. Create it in the appropriate `library/` sub-package, subclassing the right base class.
|
|
36
|
+
2. Tag it accurately — tags drive composition selection.
|
|
37
|
+
3. Write unit tests that cover the full outcome space (`ALLOW`, `BLOCK`, `ESCALATE`, `REDACT` for guardrails; `VERIFIED`, `FAILED`, `UNCERTAIN` for verification checks).
|
|
38
|
+
4. Register it in `default_registry()` in `registry.py`.
|
|
39
|
+
5. Add it to the component table in `README.md`.
|
|
40
|
+
|
|
41
|
+
No component will be merged without tests that can run offline (no live API calls in the test suite).
|
|
42
|
+
|
|
43
|
+
## Code style
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
ruff check . # linting
|
|
47
|
+
mypy harness_composer # type checking
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Pull request expectations
|
|
51
|
+
|
|
52
|
+
- Keep PRs focused — one component or one fix per PR.
|
|
53
|
+
- Include a plain-English description of what the component does and when the composition engine will select it.
|
|
54
|
+
- If your component is for a paid external service, the stub/test path must work without credentials.
|
|
55
|
+
|
|
56
|
+
## Reporting issues
|
|
57
|
+
|
|
58
|
+
Open a GitHub issue. For security-sensitive issues (e.g. a guardrail that can be bypassed), please use GitHub's private vulnerability reporting instead of a public issue.
|
|
@@ -0,0 +1,130 @@
|
|
|
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 made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other transformations
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner, any Derivative
|
|
50
|
+
Works of the Work.
|
|
51
|
+
|
|
52
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
53
|
+
whom a Contribution has been received by the Licensor and included
|
|
54
|
+
within the Work.
|
|
55
|
+
|
|
56
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
57
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
58
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
59
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
60
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
61
|
+
Work and such Derivative Works in Source or Object form.
|
|
62
|
+
|
|
63
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
64
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
65
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
66
|
+
(except as stated in this section) patent license to make, have made,
|
|
67
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
68
|
+
where such license applies only to those patent claims licensable
|
|
69
|
+
by such Contributor that are necessarily infringed by their
|
|
70
|
+
Contribution(s) alone or by the combined work.
|
|
71
|
+
|
|
72
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
73
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
74
|
+
modifications, and in Source or Object form, provided that You
|
|
75
|
+
meet the following conditions:
|
|
76
|
+
|
|
77
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
78
|
+
Works a copy of this License; and
|
|
79
|
+
|
|
80
|
+
(b) You must cause any modified files to carry prominent notices
|
|
81
|
+
stating that You changed the files; and
|
|
82
|
+
|
|
83
|
+
(c) You must retain, in all Source or Object form, all copyright,
|
|
84
|
+
patent, trademark, and attribution notices from the Source form
|
|
85
|
+
of the Work, excluding those notices that do not pertain to
|
|
86
|
+
any part of the Derivative Works; and
|
|
87
|
+
|
|
88
|
+
(d) If the Work includes a "NOTICE" text file, include a readable
|
|
89
|
+
copy of the attribution notices contained within such NOTICE file.
|
|
90
|
+
|
|
91
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
92
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
93
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
94
|
+
this License, without any additional terms or conditions.
|
|
95
|
+
|
|
96
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
97
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
98
|
+
|
|
99
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed
|
|
100
|
+
to in writing, Licensor provides the Work on an "AS IS" BASIS,
|
|
101
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
102
|
+
implied. See the License for the specific language governing
|
|
103
|
+
permissions and limitations under the License.
|
|
104
|
+
|
|
105
|
+
8. Limitation of Liability. In no event and under no legal theory shall
|
|
106
|
+
any Contributor be liable for damages, including any direct, indirect,
|
|
107
|
+
special, incidental, or exemplary damages arising out of this License
|
|
108
|
+
or out of the use or inability to use the Work.
|
|
109
|
+
|
|
110
|
+
9. Accepting Warranty or Liability. While redistributing the Work or
|
|
111
|
+
Derivative Works thereof, You may accept responsibility for additional
|
|
112
|
+
terms of warranty, liability, or other terms consistent with this
|
|
113
|
+
License. However, in accepting such additional terms, You alone are
|
|
114
|
+
responsible for those obligations.
|
|
115
|
+
|
|
116
|
+
END OF TERMS AND CONDITIONS
|
|
117
|
+
|
|
118
|
+
Copyright 2024 Harness Composer Contributors
|
|
119
|
+
|
|
120
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
121
|
+
you may not use this file except in compliance with the License.
|
|
122
|
+
You may obtain a copy of the License at
|
|
123
|
+
|
|
124
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
125
|
+
|
|
126
|
+
Unless required by applicable law or agreed to in writing, software
|
|
127
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
128
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
129
|
+
See the License for the specific language governing permissions and
|
|
130
|
+
limitations under the License.
|