aimarket-bridges 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.
- aimarket_bridges-0.1.0/.gitignore +15 -0
- aimarket_bridges-0.1.0/LICENSE +190 -0
- aimarket_bridges-0.1.0/PKG-INFO +154 -0
- aimarket_bridges-0.1.0/README.md +120 -0
- aimarket_bridges-0.1.0/aimarket_bridges/__init__.py +51 -0
- aimarket_bridges-0.1.0/aimarket_bridges/autogen.py +454 -0
- aimarket_bridges-0.1.0/aimarket_bridges/catalog.py +375 -0
- aimarket_bridges-0.1.0/aimarket_bridges/client.py +390 -0
- aimarket_bridges-0.1.0/aimarket_bridges/crewai.py +514 -0
- aimarket_bridges-0.1.0/aimarket_bridges/langchain.py +533 -0
- aimarket_bridges-0.1.0/aimarket_bridges/receipts.py +326 -0
- aimarket_bridges-0.1.0/aimarket_bridges/schema.py +310 -0
- aimarket_bridges-0.1.0/docs/en.md +800 -0
- aimarket_bridges-0.1.0/docs/es.md +745 -0
- aimarket_bridges-0.1.0/docs/fr.md +751 -0
- aimarket_bridges-0.1.0/docs/index.html +522 -0
- aimarket_bridges-0.1.0/docs/ru.md +740 -0
- aimarket_bridges-0.1.0/docs/zh.md +681 -0
- aimarket_bridges-0.1.0/pyproject.toml +98 -0
- aimarket_bridges-0.1.0/tests/live_manifest.json +3846 -0
- aimarket_bridges-0.1.0/tests/test_autogen.py +1396 -0
- aimarket_bridges-0.1.0/tests/test_core.py +1110 -0
- aimarket_bridges-0.1.0/tests/test_crewai.py +1104 -0
- aimarket_bridges-0.1.0/tests/test_langchain.py +1415 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Package-local. hatchling chooses its build exclusion list by walking UP from here for a
|
|
2
|
+
# .gitignore, then force-includes whichever file it found into the sdist — bypassing
|
|
3
|
+
# `exclude`. With no file at this level it reached the repository root and published a
|
|
4
|
+
# 209-line inventory of a private monorepo, naming the path of every secret file in it.
|
|
5
|
+
#
|
|
6
|
+
# See oracles/core/.gitignore for the full account; the real guarantee is the allow-list in
|
|
7
|
+
# pyproject.toml plus the gate in scripts/publish_pypi.sh.
|
|
8
|
+
|
|
9
|
+
data/
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
*.egg-info/
|
|
13
|
+
__pycache__/
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.venv/
|
|
@@ -0,0 +1,190 @@
|
|
|
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
|
+
Copyright 2026 AI-Factory Project Contributors
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aimarket-bridges
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Use AIMarket capabilities as native tools in LangChain/LangGraph, CrewAI and AutoGen
|
|
5
|
+
Project-URL: Homepage, https://modelmarket.dev
|
|
6
|
+
Project-URL: Repository, https://github.com/alexar76/aimarket-bridges
|
|
7
|
+
Author-email: AIMarket <dev@modelmarket.dev>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agents,aimarket,autogen,crewai,langchain,langgraph,mcp,tools
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Requires-Dist: aimarket-agent<3,>=2.2
|
|
17
|
+
Requires-Dist: httpx<1,>=0.27
|
|
18
|
+
Requires-Dist: pydantic<3,>=2.7.2
|
|
19
|
+
Provides-Extra: autogen
|
|
20
|
+
Requires-Dist: autogen-agentchat<1,>=0.7; extra == 'autogen'
|
|
21
|
+
Requires-Dist: autogen-core<1,>=0.7; extra == 'autogen'
|
|
22
|
+
Provides-Extra: crewai
|
|
23
|
+
Requires-Dist: crewai<2,>=1.0; extra == 'crewai'
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: jsonschema>=4; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
28
|
+
Provides-Extra: langchain
|
|
29
|
+
Requires-Dist: langchain-core<2,>=1.0; extra == 'langchain'
|
|
30
|
+
Provides-Extra: langgraph
|
|
31
|
+
Requires-Dist: langchain-core<2,>=1.0; extra == 'langgraph'
|
|
32
|
+
Requires-Dist: langgraph<2,>=1.0; extra == 'langgraph'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# aimarket-bridges
|
|
36
|
+
|
|
37
|
+
**Give your LangGraph, CrewAI or AutoGen agent 47 more tools in two lines.**
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from aimarket_bridges.langchain import aimarket_tools
|
|
41
|
+
|
|
42
|
+
tools = aimarket_tools("https://modelmarket.dev", intent="verifiable randomness")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Every tool is a real capability on the [AIMarket](https://modelmarket.dev) network — a
|
|
46
|
+
verifiable random draw, a Byzantine-resistant consensus number, a proof of elapsed sequential
|
|
47
|
+
work, an optimal-transport plan — each returning a **signed receipt** your agent can verify
|
|
48
|
+
without trusting the marketplace.
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install "aimarket-bridges[langgraph]"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install "aimarket-bridges[crewai]"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install "aimarket-bridges[autogen]"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The core has no framework dependency. Install only the one you use — CrewAI and AutoGen do not
|
|
65
|
+
agree on a pydantic version and cannot share an environment.
|
|
66
|
+
|
|
67
|
+
## The three adapters
|
|
68
|
+
|
|
69
|
+
| Framework | Import | Returns |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| LangChain / LangGraph | `aimarket_bridges.langchain` | `list[StructuredTool]` |
|
|
72
|
+
| CrewAI | `aimarket_bridges.crewai` | `list[crewai.tools.BaseTool]` |
|
|
73
|
+
| AutoGen | `aimarket_bridges.autogen` | `list[autogen_core.tools.BaseTool]` |
|
|
74
|
+
|
|
75
|
+
Same signature everywhere:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
aimarket_tools(
|
|
79
|
+
base_url, # the hub, e.g. "https://modelmarket.dev"
|
|
80
|
+
intent="", # rank by relevance instead of taking the whole catalogue
|
|
81
|
+
limit=0, # cap how many tools the agent sees
|
|
82
|
+
max_price_usd=None, # never hand over a tool you cannot afford
|
|
83
|
+
free_only=False,
|
|
84
|
+
budget_usd=1.0, # hard ceiling across every call these tools make
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## What it costs
|
|
89
|
+
|
|
90
|
+
Capabilities are priced per call, from $0.001. The `budget_usd` ceiling is enforced **before**
|
|
91
|
+
each call and is safe across threads, so an agent that loops cannot outspend it. `max_price_usd`
|
|
92
|
+
filters at build time — the honest place for a limit, because once a tool is in the agent's
|
|
93
|
+
registry the agent decides when to call it.
|
|
94
|
+
|
|
95
|
+
There is a free trial tier: an agent with no wallet can try capabilities before any payment is
|
|
96
|
+
set up.
|
|
97
|
+
|
|
98
|
+
## Receipts actually verify
|
|
99
|
+
|
|
100
|
+
Every call returns a signed 7-field receipt. It is kept out of the tool's text result — it would
|
|
101
|
+
cost the model context for a blob it never reads — and is available through the framework's own
|
|
102
|
+
metadata channel and through `HubClient.last_receipt`.
|
|
103
|
+
|
|
104
|
+
Verification uses the key of the capability's **origin**, not the hub's. This matters: 42 of the
|
|
105
|
+
47 live capabilities are federated, so their receipts are signed by the provider, not by the
|
|
106
|
+
broker that routed the call. Checking against the hub's key reports `invalid-signature` on
|
|
107
|
+
perfectly valid receipts for 89% of the catalogue.
|
|
108
|
+
|
|
109
|
+
## Refusals are results, not crashes
|
|
110
|
+
|
|
111
|
+
When a capability rejects its input, your agent gets a sentence it can act on:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
sortes.draw@v1 refused this input: 'num_bytes' must be an integer, got str
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
and it corrects the argument on the next turn. Nothing raises, so one bad argument does not
|
|
118
|
+
abort the surrounding graph or crew. Transport and configuration failures **do** raise — those
|
|
119
|
+
the model cannot fix, and swallowing them yields an agent that reports success having called
|
|
120
|
+
nothing.
|
|
121
|
+
|
|
122
|
+
## Without a framework
|
|
123
|
+
|
|
124
|
+
The core is usable on its own if you are wiring something with no adapter yet:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from aimarket_bridges import fetch_catalog, HubClient
|
|
128
|
+
|
|
129
|
+
capabilities = fetch_catalog("https://modelmarket.dev", intent="consensus")
|
|
130
|
+
with HubClient("https://modelmarket.dev", budget_usd=0.50) as hub:
|
|
131
|
+
result = hub.invoke(capabilities[0], {"values": [1.0, 2.0, 3.0, 100.0]})
|
|
132
|
+
print(result.output, result.receipt_verified)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`fetch_catalog` **raises** when the hub is unreachable rather than returning an empty list. An
|
|
136
|
+
agent that starts up believing it has no capabilities is a much worse failure than one that
|
|
137
|
+
refuses to start.
|
|
138
|
+
|
|
139
|
+
## Notes on the frameworks
|
|
140
|
+
|
|
141
|
+
Written against langchain-core 1.5.2, langgraph 1.2.10, crewai 1.15.8, autogen-core 0.7.5,
|
|
142
|
+
each verified by introspection rather than from documentation. They disagree about how a tool
|
|
143
|
+
declares its arguments, which is most of what this package absorbs:
|
|
144
|
+
|
|
145
|
+
- **langchain-core** accepts a raw JSON Schema dict, so a capability's schema passes straight
|
|
146
|
+
through.
|
|
147
|
+
- **crewai** requires a pydantic model and reads `.model_fields` off it.
|
|
148
|
+
- **autogen** derives schemas from Python type annotations, so a runtime-shaped capability
|
|
149
|
+
needs an explicit args model.
|
|
150
|
+
|
|
151
|
+
The `oneOf` in `kantor.transport@v1` (a point is an array of numbers *or* a number) and in
|
|
152
|
+
`fermat.route@v1` (an edge is an array *or* an object) becomes a proper union in all three.
|
|
153
|
+
|
|
154
|
+
Apache-2.0.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# aimarket-bridges
|
|
2
|
+
|
|
3
|
+
**Give your LangGraph, CrewAI or AutoGen agent 47 more tools in two lines.**
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from aimarket_bridges.langchain import aimarket_tools
|
|
7
|
+
|
|
8
|
+
tools = aimarket_tools("https://modelmarket.dev", intent="verifiable randomness")
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Every tool is a real capability on the [AIMarket](https://modelmarket.dev) network — a
|
|
12
|
+
verifiable random draw, a Byzantine-resistant consensus number, a proof of elapsed sequential
|
|
13
|
+
work, an optimal-transport plan — each returning a **signed receipt** your agent can verify
|
|
14
|
+
without trusting the marketplace.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install "aimarket-bridges[langgraph]"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install "aimarket-bridges[crewai]"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install "aimarket-bridges[autogen]"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The core has no framework dependency. Install only the one you use — CrewAI and AutoGen do not
|
|
31
|
+
agree on a pydantic version and cannot share an environment.
|
|
32
|
+
|
|
33
|
+
## The three adapters
|
|
34
|
+
|
|
35
|
+
| Framework | Import | Returns |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| LangChain / LangGraph | `aimarket_bridges.langchain` | `list[StructuredTool]` |
|
|
38
|
+
| CrewAI | `aimarket_bridges.crewai` | `list[crewai.tools.BaseTool]` |
|
|
39
|
+
| AutoGen | `aimarket_bridges.autogen` | `list[autogen_core.tools.BaseTool]` |
|
|
40
|
+
|
|
41
|
+
Same signature everywhere:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
aimarket_tools(
|
|
45
|
+
base_url, # the hub, e.g. "https://modelmarket.dev"
|
|
46
|
+
intent="", # rank by relevance instead of taking the whole catalogue
|
|
47
|
+
limit=0, # cap how many tools the agent sees
|
|
48
|
+
max_price_usd=None, # never hand over a tool you cannot afford
|
|
49
|
+
free_only=False,
|
|
50
|
+
budget_usd=1.0, # hard ceiling across every call these tools make
|
|
51
|
+
)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## What it costs
|
|
55
|
+
|
|
56
|
+
Capabilities are priced per call, from $0.001. The `budget_usd` ceiling is enforced **before**
|
|
57
|
+
each call and is safe across threads, so an agent that loops cannot outspend it. `max_price_usd`
|
|
58
|
+
filters at build time — the honest place for a limit, because once a tool is in the agent's
|
|
59
|
+
registry the agent decides when to call it.
|
|
60
|
+
|
|
61
|
+
There is a free trial tier: an agent with no wallet can try capabilities before any payment is
|
|
62
|
+
set up.
|
|
63
|
+
|
|
64
|
+
## Receipts actually verify
|
|
65
|
+
|
|
66
|
+
Every call returns a signed 7-field receipt. It is kept out of the tool's text result — it would
|
|
67
|
+
cost the model context for a blob it never reads — and is available through the framework's own
|
|
68
|
+
metadata channel and through `HubClient.last_receipt`.
|
|
69
|
+
|
|
70
|
+
Verification uses the key of the capability's **origin**, not the hub's. This matters: 42 of the
|
|
71
|
+
47 live capabilities are federated, so their receipts are signed by the provider, not by the
|
|
72
|
+
broker that routed the call. Checking against the hub's key reports `invalid-signature` on
|
|
73
|
+
perfectly valid receipts for 89% of the catalogue.
|
|
74
|
+
|
|
75
|
+
## Refusals are results, not crashes
|
|
76
|
+
|
|
77
|
+
When a capability rejects its input, your agent gets a sentence it can act on:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
sortes.draw@v1 refused this input: 'num_bytes' must be an integer, got str
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
and it corrects the argument on the next turn. Nothing raises, so one bad argument does not
|
|
84
|
+
abort the surrounding graph or crew. Transport and configuration failures **do** raise — those
|
|
85
|
+
the model cannot fix, and swallowing them yields an agent that reports success having called
|
|
86
|
+
nothing.
|
|
87
|
+
|
|
88
|
+
## Without a framework
|
|
89
|
+
|
|
90
|
+
The core is usable on its own if you are wiring something with no adapter yet:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from aimarket_bridges import fetch_catalog, HubClient
|
|
94
|
+
|
|
95
|
+
capabilities = fetch_catalog("https://modelmarket.dev", intent="consensus")
|
|
96
|
+
with HubClient("https://modelmarket.dev", budget_usd=0.50) as hub:
|
|
97
|
+
result = hub.invoke(capabilities[0], {"values": [1.0, 2.0, 3.0, 100.0]})
|
|
98
|
+
print(result.output, result.receipt_verified)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`fetch_catalog` **raises** when the hub is unreachable rather than returning an empty list. An
|
|
102
|
+
agent that starts up believing it has no capabilities is a much worse failure than one that
|
|
103
|
+
refuses to start.
|
|
104
|
+
|
|
105
|
+
## Notes on the frameworks
|
|
106
|
+
|
|
107
|
+
Written against langchain-core 1.5.2, langgraph 1.2.10, crewai 1.15.8, autogen-core 0.7.5,
|
|
108
|
+
each verified by introspection rather than from documentation. They disagree about how a tool
|
|
109
|
+
declares its arguments, which is most of what this package absorbs:
|
|
110
|
+
|
|
111
|
+
- **langchain-core** accepts a raw JSON Schema dict, so a capability's schema passes straight
|
|
112
|
+
through.
|
|
113
|
+
- **crewai** requires a pydantic model and reads `.model_fields` off it.
|
|
114
|
+
- **autogen** derives schemas from Python type annotations, so a runtime-shaped capability
|
|
115
|
+
needs an explicit args model.
|
|
116
|
+
|
|
117
|
+
The `oneOf` in `kantor.transport@v1` (a point is an array of numbers *or* a number) and in
|
|
118
|
+
`fermat.route@v1` (an edge is an array *or* an object) becomes a proper union in all three.
|
|
119
|
+
|
|
120
|
+
Apache-2.0.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""AIMarket capabilities as native tools in the frameworks people actually build with.
|
|
2
|
+
|
|
3
|
+
from aimarket_bridges.langchain import aimarket_tools
|
|
4
|
+
tools = aimarket_tools("https://modelmarket.dev", intent="verifiable randomness")
|
|
5
|
+
|
|
6
|
+
The framework adapters live in submodules and are NOT imported here, on purpose: importing
|
|
7
|
+
this package must not pull in langchain, crewai or autogen. Those three do not even agree on
|
|
8
|
+
a pydantic version — crewai pins it lower than autogen — so they cannot share one
|
|
9
|
+
environment, let alone one import graph. Ask for the one you use:
|
|
10
|
+
|
|
11
|
+
aimarket_bridges.langchain LangChain / LangGraph (StructuredTool)
|
|
12
|
+
aimarket_bridges.crewai CrewAI (crewai.tools.BaseTool)
|
|
13
|
+
aimarket_bridges.autogen AutoGen (autogen_core.tools.BaseTool)
|
|
14
|
+
|
|
15
|
+
What every adapter shares is in the core, and is usable on its own if you are wiring a
|
|
16
|
+
framework that has no adapter yet:
|
|
17
|
+
|
|
18
|
+
Capability / fetch_catalog what the hub sells, in tool-ready form
|
|
19
|
+
HubClient / InvokeResult one call, with the budget, the refusal and the receipt
|
|
20
|
+
model_from_schema JSON Schema -> pydantic, for frameworks that demand a model
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
from aimarket_bridges.catalog import Capability, CatalogError, fetch_catalog, tool_name_for
|
|
26
|
+
from aimarket_bridges.client import (
|
|
27
|
+
BudgetExceeded,
|
|
28
|
+
HubClient,
|
|
29
|
+
HubUnavailable,
|
|
30
|
+
InvokeResult,
|
|
31
|
+
)
|
|
32
|
+
from aimarket_bridges.receipts import OriginKeyResolver, ReceiptCheck
|
|
33
|
+
from aimarket_bridges.schema import SchemaError, model_from_schema, unsupported_keywords
|
|
34
|
+
|
|
35
|
+
__all__ = [
|
|
36
|
+
"Capability",
|
|
37
|
+
"CatalogError",
|
|
38
|
+
"fetch_catalog",
|
|
39
|
+
"tool_name_for",
|
|
40
|
+
"HubClient",
|
|
41
|
+
"InvokeResult",
|
|
42
|
+
"BudgetExceeded",
|
|
43
|
+
"HubUnavailable",
|
|
44
|
+
"OriginKeyResolver",
|
|
45
|
+
"ReceiptCheck",
|
|
46
|
+
"model_from_schema",
|
|
47
|
+
"unsupported_keywords",
|
|
48
|
+
"SchemaError",
|
|
49
|
+
"__version__",
|
|
50
|
+
]
|
|
51
|
+
__version__ = "0.1.0"
|