treessera 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.
- treessera-0.1.0/.gitignore +9 -0
- treessera-0.1.0/CHANGELOG.md +33 -0
- treessera-0.1.0/LICENSE +201 -0
- treessera-0.1.0/NOTICE +10 -0
- treessera-0.1.0/PKG-INFO +180 -0
- treessera-0.1.0/README.md +146 -0
- treessera-0.1.0/examples/requester.py +32 -0
- treessera-0.1.0/examples/terraform_agent.py +49 -0
- treessera-0.1.0/pyproject.toml +62 -0
- treessera-0.1.0/tests/test_card_and_evidence.py +46 -0
- treessera-0.1.0/tests/test_end_to_end.py +88 -0
- treessera-0.1.0/tests/test_identity.py +52 -0
- treessera-0.1.0/tests/test_negotiation.py +45 -0
- treessera-0.1.0/tests/test_protocol.py +44 -0
- treessera-0.1.0/tests/test_provider.py +93 -0
- treessera-0.1.0/treessera/__init__.py +102 -0
- treessera-0.1.0/treessera/card.py +59 -0
- treessera-0.1.0/treessera/client.py +242 -0
- treessera-0.1.0/treessera/config.py +28 -0
- treessera-0.1.0/treessera/evidence.py +56 -0
- treessera-0.1.0/treessera/identity.py +120 -0
- treessera-0.1.0/treessera/negotiation.py +60 -0
- treessera-0.1.0/treessera/protocol.py +97 -0
- treessera-0.1.0/treessera/provider.py +218 -0
- treessera-0.1.0/treessera/py.typed +0 -0
- treessera-0.1.0/treessera/registry.py +81 -0
- treessera-0.1.0/treessera/server.py +85 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the Tessera SDK are documented here. This project
|
|
4
|
+
follows [Semantic Versioning](https://semver.org/) and
|
|
5
|
+
[Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-07-24
|
|
10
|
+
|
|
11
|
+
Initial release.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- `Agent` — the provider facade: persistent ed25519 identity, published A2A
|
|
15
|
+
card declaring the trust extension, full negotiation
|
|
16
|
+
(`task.request → offer → counter → accept → result`) with a private reserve,
|
|
17
|
+
the signature challenge (`trust.challenge → trust.proof`), evidence on
|
|
18
|
+
results, self-registration, and a stdlib HTTP server. `@agent.task` +
|
|
19
|
+
`agent.run(port)`.
|
|
20
|
+
- `Client` — the requester facade: registry discovery, direct card fetch,
|
|
21
|
+
cryptographic `verify()` (nonce challenge with binding + signature checks),
|
|
22
|
+
single-round negotiation, and `delegate()` that refuses unverified agents by
|
|
23
|
+
default.
|
|
24
|
+
- Building blocks exported for advanced/clean-room use: `Identity`, `Pricing`,
|
|
25
|
+
`Evidence`, `build_card`, `AgentServer`, and the `protocol` envelope helpers
|
|
26
|
+
and message-type constants.
|
|
27
|
+
- Configurable trust-extension URI via `treessera/config.py` or the
|
|
28
|
+
`TREESSERA_URI` environment variable.
|
|
29
|
+
- Runnable examples (`examples/terraform_agent.py`, `examples/requester.py`)
|
|
30
|
+
and a full test suite (40 tests, incl. an end-to-end run over real HTTP).
|
|
31
|
+
|
|
32
|
+
[Unreleased]: https://github.com/treessera/treessera-python/compare/v0.1.0...HEAD
|
|
33
|
+
[0.1.0]: https://github.com/treessera/treessera-python/releases/tag/v0.1.0
|
treessera-0.1.0/LICENSE
ADDED
|
@@ -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 Derivative
|
|
95
|
+
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 Tessera
|
|
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.
|
treessera-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Tessera SDK
|
|
2
|
+
Copyright 2026 Tessera
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Tessera.
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0. See the LICENSE file.
|
|
7
|
+
|
|
8
|
+
This software depends on PyNaCl (https://github.com/pyca/pynacl), a Python
|
|
9
|
+
binding to the libsodium cryptography library, distributed under the Apache
|
|
10
|
+
License 2.0.
|
treessera-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: treessera
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: SDK for building and consuming Verified, transactable A2A agents on the Tessera protocol.
|
|
5
|
+
Project-URL: Homepage, https://github.com/treessera/treessera-python
|
|
6
|
+
Project-URL: Repository, https://github.com/treessera/treessera-python
|
|
7
|
+
Project-URL: Changelog, https://github.com/treessera/treessera-python/blob/main/CHANGELOG.md
|
|
8
|
+
Project-URL: Issues, https://github.com/treessera/treessera-python/issues
|
|
9
|
+
Author: Tessera
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: a2a,agent-to-agent,agents,ed25519,marketplace,reputation,trust
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Security :: Cryptography
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Requires-Dist: pynacl>=1.5.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: twine>=5.0; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Tessera SDK (Python)
|
|
36
|
+
|
|
37
|
+
Build and consume **Verified, transactable** agents on the Tessera protocol —
|
|
38
|
+
signed identity, negotiated work, machine-checkable evidence, and provable
|
|
39
|
+
per-capability reputation, all riding on standard [A2A](https://a2a-protocol.org)
|
|
40
|
+
JSON-RPC.
|
|
41
|
+
|
|
42
|
+
The SDK is self-contained: one dependency (`pynacl`), no web framework, stdlib
|
|
43
|
+
HTTP. It works whether your agent runs on your laptop, in a container, or on
|
|
44
|
+
someone else's host in another country — Tessera is peer-to-peer, and the
|
|
45
|
+
registry is only a directory.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install -e sdk/python # from the repo root
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Why "Verified" is a proof, not a claim
|
|
52
|
+
|
|
53
|
+
Every agent has an ed25519 keypair. Its `principal_id` is **cryptographically
|
|
54
|
+
bound** to the public key:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
atp:principal:<label>:sha256(base64(pubkey))[:16]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Anyone can *copy* a principal_id off a card — so a copy proves nothing. What
|
|
61
|
+
proves possession is the **signature challenge**: a requester sends a random
|
|
62
|
+
nonce, the agent signs it with its private key, and the requester checks both
|
|
63
|
+
that the returned public key hashes to the declared principal_id (binding) **and**
|
|
64
|
+
that the signature validates. An impostor who copied the id can't sign for a key
|
|
65
|
+
it doesn't hold, so it fails. That is what the Verified tier means, and the SDK
|
|
66
|
+
does it on both sides for you.
|
|
67
|
+
|
|
68
|
+
## Provider — build an agent in ~30 lines
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from treessera import Agent
|
|
72
|
+
|
|
73
|
+
agent = Agent(
|
|
74
|
+
name="Terraform Bot",
|
|
75
|
+
description="Generates production-ready Terraform modules.",
|
|
76
|
+
capability="terraform.generate",
|
|
77
|
+
list_price=45,
|
|
78
|
+
min_price=30, # PRIVATE reserve — never crosses the wire
|
|
79
|
+
registry_url="https://registry.example", # self-registers on start
|
|
80
|
+
verification_url="https://verify.example",
|
|
81
|
+
keys_dir="./keys", # stable identity across restarts
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
@agent.task
|
|
85
|
+
def handle(task):
|
|
86
|
+
tf = generate(task.input)
|
|
87
|
+
task.add_artifact("main.tf", tf) # hashed into the result's evidence
|
|
88
|
+
return {"main.tf": tf}
|
|
89
|
+
|
|
90
|
+
agent.run(port=8100)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`agent.run()` binds the port, publishes the A2A card at
|
|
94
|
+
`/.well-known/agent-card.json` (declaring the trust extension with your
|
|
95
|
+
principal_id), self-registers with the registry, and then answers:
|
|
96
|
+
|
|
97
|
+
| Inbound payload | What the SDK does |
|
|
98
|
+
|-------------------|---------------------------------------------------------------|
|
|
99
|
+
| `task.request` | mints a task id, replies with a `task.offer` at the list price |
|
|
100
|
+
| `task.counter` | accepts at the countered price if ≥ your private reserve, else holds list |
|
|
101
|
+
| `task.accept` | runs your `@agent.task` function, returns `task.result` + evidence |
|
|
102
|
+
| `trust.challenge` | signs the nonce, returns `trust.proof` (identity proof) |
|
|
103
|
+
|
|
104
|
+
The reserve (`min_price`) never appears in any card, offer, or counter response.
|
|
105
|
+
|
|
106
|
+
## Requester — discover, verify, delegate
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from treessera import Client
|
|
110
|
+
|
|
111
|
+
client = Client(registry_url="https://registry.example")
|
|
112
|
+
|
|
113
|
+
agent = client.discover("terraform.generate")[0] # or client.fetch_card(url)
|
|
114
|
+
|
|
115
|
+
if client.verify(agent): # cryptographic proof
|
|
116
|
+
result = client.delegate(agent, {"provider": "aws"},
|
|
117
|
+
max_price=40, counter_price=35)
|
|
118
|
+
print(result["output"])
|
|
119
|
+
print(result["evidence"]["artifact_hashes"])
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`delegate()` is the whole happy path — verify (if not already), negotiate (one
|
|
123
|
+
counter round), accept — and by default **refuses to transact with an unverified
|
|
124
|
+
agent**. Requesters call agents directly at their card `url`; the registry never
|
|
125
|
+
proxies work.
|
|
126
|
+
|
|
127
|
+
## The protocol vocabulary
|
|
128
|
+
|
|
129
|
+
Negotiation: `task.request → task.offer → task.counter → task.accept → task.result`
|
|
130
|
+
Trust: `trust.challenge → trust.proof`
|
|
131
|
+
|
|
132
|
+
Each is a Tessera payload carried inside an A2A `message/send` as a `data`
|
|
133
|
+
part, discriminated by its `type`. The `treessera.protocol` module owns the
|
|
134
|
+
envelope so you never hand-roll it.
|
|
135
|
+
|
|
136
|
+
## What's in the box
|
|
137
|
+
|
|
138
|
+
| Module | Purpose |
|
|
139
|
+
|-----------------|----------------------------------------------------------------|
|
|
140
|
+
| `Agent` | the provider facade (identity + card + negotiation + server + registration) |
|
|
141
|
+
| `Client` | the requester facade (discover + verify + negotiate + delegate) |
|
|
142
|
+
| `Identity` | ed25519 keypair, stable via `keys_dir`, sign/verify |
|
|
143
|
+
| `Pricing` | offer/counter logic with a private reserve |
|
|
144
|
+
| `Evidence` | artifact hashing for machine-checkable results |
|
|
145
|
+
| `build_card` | A2A card with the trust extension declared |
|
|
146
|
+
| `AgentServer` | stdlib HTTP surface (card, health, `message/send`) |
|
|
147
|
+
| `protocol` | message types + JSON-RPC envelope helpers |
|
|
148
|
+
|
|
149
|
+
## Configuration
|
|
150
|
+
|
|
151
|
+
The trust-extension URI is the one namespace identifier to set when your domain
|
|
152
|
+
lands. Change it in `treessera/config.py`, or override per process without
|
|
153
|
+
touching code:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
export TREESSERA_URI="https://treessera.com/extensions/trust/v1"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Run it locally
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
cd sdk/python
|
|
163
|
+
python examples/terraform_agent.py # serves on :8100, self-identifies
|
|
164
|
+
python examples/requester.py # discovers/verifies/delegates
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Tests
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
cd sdk/python
|
|
171
|
+
PYTHONPATH=. python -m pytest -q
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
40 tests: identity + challenge crypto, the copy-attack rejection, negotiation
|
|
175
|
+
reserve logic, card/evidence shape, provider dispatch, and a full end-to-end run
|
|
176
|
+
over real HTTP.
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
Apache-2.0.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Tessera SDK (Python)
|
|
2
|
+
|
|
3
|
+
Build and consume **Verified, transactable** agents on the Tessera protocol —
|
|
4
|
+
signed identity, negotiated work, machine-checkable evidence, and provable
|
|
5
|
+
per-capability reputation, all riding on standard [A2A](https://a2a-protocol.org)
|
|
6
|
+
JSON-RPC.
|
|
7
|
+
|
|
8
|
+
The SDK is self-contained: one dependency (`pynacl`), no web framework, stdlib
|
|
9
|
+
HTTP. It works whether your agent runs on your laptop, in a container, or on
|
|
10
|
+
someone else's host in another country — Tessera is peer-to-peer, and the
|
|
11
|
+
registry is only a directory.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install -e sdk/python # from the repo root
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Why "Verified" is a proof, not a claim
|
|
18
|
+
|
|
19
|
+
Every agent has an ed25519 keypair. Its `principal_id` is **cryptographically
|
|
20
|
+
bound** to the public key:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
atp:principal:<label>:sha256(base64(pubkey))[:16]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Anyone can *copy* a principal_id off a card — so a copy proves nothing. What
|
|
27
|
+
proves possession is the **signature challenge**: a requester sends a random
|
|
28
|
+
nonce, the agent signs it with its private key, and the requester checks both
|
|
29
|
+
that the returned public key hashes to the declared principal_id (binding) **and**
|
|
30
|
+
that the signature validates. An impostor who copied the id can't sign for a key
|
|
31
|
+
it doesn't hold, so it fails. That is what the Verified tier means, and the SDK
|
|
32
|
+
does it on both sides for you.
|
|
33
|
+
|
|
34
|
+
## Provider — build an agent in ~30 lines
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from treessera import Agent
|
|
38
|
+
|
|
39
|
+
agent = Agent(
|
|
40
|
+
name="Terraform Bot",
|
|
41
|
+
description="Generates production-ready Terraform modules.",
|
|
42
|
+
capability="terraform.generate",
|
|
43
|
+
list_price=45,
|
|
44
|
+
min_price=30, # PRIVATE reserve — never crosses the wire
|
|
45
|
+
registry_url="https://registry.example", # self-registers on start
|
|
46
|
+
verification_url="https://verify.example",
|
|
47
|
+
keys_dir="./keys", # stable identity across restarts
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
@agent.task
|
|
51
|
+
def handle(task):
|
|
52
|
+
tf = generate(task.input)
|
|
53
|
+
task.add_artifact("main.tf", tf) # hashed into the result's evidence
|
|
54
|
+
return {"main.tf": tf}
|
|
55
|
+
|
|
56
|
+
agent.run(port=8100)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`agent.run()` binds the port, publishes the A2A card at
|
|
60
|
+
`/.well-known/agent-card.json` (declaring the trust extension with your
|
|
61
|
+
principal_id), self-registers with the registry, and then answers:
|
|
62
|
+
|
|
63
|
+
| Inbound payload | What the SDK does |
|
|
64
|
+
|-------------------|---------------------------------------------------------------|
|
|
65
|
+
| `task.request` | mints a task id, replies with a `task.offer` at the list price |
|
|
66
|
+
| `task.counter` | accepts at the countered price if ≥ your private reserve, else holds list |
|
|
67
|
+
| `task.accept` | runs your `@agent.task` function, returns `task.result` + evidence |
|
|
68
|
+
| `trust.challenge` | signs the nonce, returns `trust.proof` (identity proof) |
|
|
69
|
+
|
|
70
|
+
The reserve (`min_price`) never appears in any card, offer, or counter response.
|
|
71
|
+
|
|
72
|
+
## Requester — discover, verify, delegate
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from treessera import Client
|
|
76
|
+
|
|
77
|
+
client = Client(registry_url="https://registry.example")
|
|
78
|
+
|
|
79
|
+
agent = client.discover("terraform.generate")[0] # or client.fetch_card(url)
|
|
80
|
+
|
|
81
|
+
if client.verify(agent): # cryptographic proof
|
|
82
|
+
result = client.delegate(agent, {"provider": "aws"},
|
|
83
|
+
max_price=40, counter_price=35)
|
|
84
|
+
print(result["output"])
|
|
85
|
+
print(result["evidence"]["artifact_hashes"])
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`delegate()` is the whole happy path — verify (if not already), negotiate (one
|
|
89
|
+
counter round), accept — and by default **refuses to transact with an unverified
|
|
90
|
+
agent**. Requesters call agents directly at their card `url`; the registry never
|
|
91
|
+
proxies work.
|
|
92
|
+
|
|
93
|
+
## The protocol vocabulary
|
|
94
|
+
|
|
95
|
+
Negotiation: `task.request → task.offer → task.counter → task.accept → task.result`
|
|
96
|
+
Trust: `trust.challenge → trust.proof`
|
|
97
|
+
|
|
98
|
+
Each is a Tessera payload carried inside an A2A `message/send` as a `data`
|
|
99
|
+
part, discriminated by its `type`. The `treessera.protocol` module owns the
|
|
100
|
+
envelope so you never hand-roll it.
|
|
101
|
+
|
|
102
|
+
## What's in the box
|
|
103
|
+
|
|
104
|
+
| Module | Purpose |
|
|
105
|
+
|-----------------|----------------------------------------------------------------|
|
|
106
|
+
| `Agent` | the provider facade (identity + card + negotiation + server + registration) |
|
|
107
|
+
| `Client` | the requester facade (discover + verify + negotiate + delegate) |
|
|
108
|
+
| `Identity` | ed25519 keypair, stable via `keys_dir`, sign/verify |
|
|
109
|
+
| `Pricing` | offer/counter logic with a private reserve |
|
|
110
|
+
| `Evidence` | artifact hashing for machine-checkable results |
|
|
111
|
+
| `build_card` | A2A card with the trust extension declared |
|
|
112
|
+
| `AgentServer` | stdlib HTTP surface (card, health, `message/send`) |
|
|
113
|
+
| `protocol` | message types + JSON-RPC envelope helpers |
|
|
114
|
+
|
|
115
|
+
## Configuration
|
|
116
|
+
|
|
117
|
+
The trust-extension URI is the one namespace identifier to set when your domain
|
|
118
|
+
lands. Change it in `treessera/config.py`, or override per process without
|
|
119
|
+
touching code:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
export TREESSERA_URI="https://treessera.com/extensions/trust/v1"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Run it locally
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
cd sdk/python
|
|
129
|
+
python examples/terraform_agent.py # serves on :8100, self-identifies
|
|
130
|
+
python examples/requester.py # discovers/verifies/delegates
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Tests
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
cd sdk/python
|
|
137
|
+
PYTHONPATH=. python -m pytest -q
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
40 tests: identity + challenge crypto, the copy-attack rejection, negotiation
|
|
141
|
+
reserve logic, card/evidence shape, provider dispatch, and a full end-to-end run
|
|
142
|
+
over real HTTP.
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
Apache-2.0.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""The other half: discover (or connect), verify, and delegate work.
|
|
2
|
+
|
|
3
|
+
Start ``terraform_agent.py`` first, then run this. With no registry, we connect
|
|
4
|
+
to the agent directly by URL; with a registry, swap ``fetch_card`` for
|
|
5
|
+
``discover("terraform.generate")[0]``.
|
|
6
|
+
|
|
7
|
+
python requester.py
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from treessera import Client
|
|
11
|
+
|
|
12
|
+
client = Client() # add registry_url=... to use discovery instead of a direct URL
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
agent = client.fetch_card("http://127.0.0.1:8100")
|
|
17
|
+
print("Found:", agent.name, "->", agent.principal_id)
|
|
18
|
+
|
|
19
|
+
# Cryptographic proof the agent holds the key behind its principal_id.
|
|
20
|
+
if not client.verify(agent):
|
|
21
|
+
print("Agent could not be verified — refusing to transact.")
|
|
22
|
+
return
|
|
23
|
+
print("Verified ✔ (signature challenge passed)")
|
|
24
|
+
|
|
25
|
+
# Negotiate + accept in one call. Refuses unverified agents by default.
|
|
26
|
+
result = client.delegate(agent, {"provider": "aws"}, max_price=40, counter_price=35)
|
|
27
|
+
print("Result:", result["output"])
|
|
28
|
+
print("Evidence:", result["evidence"]["artifact_hashes"])
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
main()
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""A complete, runnable Tessera provider in ~30 lines.
|
|
2
|
+
|
|
3
|
+
Run it::
|
|
4
|
+
|
|
5
|
+
pip install -e .. # install the treessera SDK
|
|
6
|
+
python terraform_agent.py # serves on http://127.0.0.1:8100
|
|
7
|
+
|
|
8
|
+
Then, from another process, discover/verify/delegate to it with a Client (see
|
|
9
|
+
``requester.py``), or just fetch its card::
|
|
10
|
+
|
|
11
|
+
curl http://127.0.0.1:8100/.well-known/agent-card.json
|
|
12
|
+
|
|
13
|
+
If you pass a registry URL below, the agent self-registers on start so any
|
|
14
|
+
requester can discover it by capability.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from treessera import Agent
|
|
18
|
+
|
|
19
|
+
agent = Agent(
|
|
20
|
+
name="Terraform Bot",
|
|
21
|
+
description="Generates production-ready Terraform modules from a short spec.",
|
|
22
|
+
capability="terraform.generate",
|
|
23
|
+
list_price=45,
|
|
24
|
+
min_price=30, # private reserve — never crosses the wire
|
|
25
|
+
currency="USD",
|
|
26
|
+
keys_dir="./keys", # stable identity across restarts
|
|
27
|
+
# registry_url="http://127.0.0.1:8090", # uncomment to self-register
|
|
28
|
+
# verification_url="http://127.0.0.1:8080",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@agent.task
|
|
33
|
+
def handle(task):
|
|
34
|
+
"""Do the actual work. Return any JSON-serializable result; attach
|
|
35
|
+
artifacts so their hashes land in the result's evidence."""
|
|
36
|
+
provider = (task.input or {}).get("provider", "aws")
|
|
37
|
+
module = (
|
|
38
|
+
'resource "%s_instance" "web" {\n'
|
|
39
|
+
' ami = var.ami\n'
|
|
40
|
+
' instance_type = "t3.micro"\n'
|
|
41
|
+
"}\n" % provider
|
|
42
|
+
)
|
|
43
|
+
task.add_artifact("main.tf", module)
|
|
44
|
+
return {"main.tf": module, "provider": provider}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
print("Terraform Bot: %s" % agent.principal_id)
|
|
49
|
+
agent.run(port=8100)
|