ddg-langchain 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.
- ddg_langchain-0.1.0/.gitignore +7 -0
- ddg_langchain-0.1.0/LICENSE +21 -0
- ddg_langchain-0.1.0/PKG-INFO +201 -0
- ddg_langchain-0.1.0/README.md +173 -0
- ddg_langchain-0.1.0/ddg_langchain/__init__.py +62 -0
- ddg_langchain-0.1.0/ddg_langchain/client.py +267 -0
- ddg_langchain-0.1.0/ddg_langchain/crewai.py +180 -0
- ddg_langchain-0.1.0/ddg_langchain/errors.py +62 -0
- ddg_langchain-0.1.0/ddg_langchain/tools.py +161 -0
- ddg_langchain-0.1.0/examples/crewai_crew.py +42 -0
- ddg_langchain-0.1.0/examples/langchain_agent.py +49 -0
- ddg_langchain-0.1.0/pyproject.toml +41 -0
- ddg_langchain-0.1.0/tests/__init__.py +0 -0
- ddg_langchain-0.1.0/tests/conftest.py +72 -0
- ddg_langchain-0.1.0/tests/test_client.py +92 -0
- ddg_langchain-0.1.0/tests/test_crewai.py +76 -0
- ddg_langchain-0.1.0/tests/test_live.py +55 -0
- ddg_langchain-0.1.0/tests/test_tools.py +62 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daedalus Development Group
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: ddg-langchain
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LangChain + CrewAI tools for DDG Agent Services (x402-payable, USDC on Base, no API key)
|
|
5
|
+
Project-URL: Homepage, https://agents.daedalusdevelopmentgroup.com
|
|
6
|
+
Project-URL: Repository, https://github.com/daedalusdevelopmentgroup/ddg-agent-payable-services
|
|
7
|
+
Author: Daedalus Development Group
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agents,crewai,langchain,llm,payments,tools,x402
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Requires-Dist: langchain-core>=0.3
|
|
16
|
+
Requires-Dist: pydantic>=2.5
|
|
17
|
+
Requires-Dist: requests>=2.31
|
|
18
|
+
Provides-Extra: crewai
|
|
19
|
+
Requires-Dist: crewai>=0.60; extra == 'crewai'
|
|
20
|
+
Requires-Dist: langchain-core>=0.3; extra == 'crewai'
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: crewai>=0.60; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
24
|
+
Requires-Dist: x402[evm,requests]>=2.0; extra == 'dev'
|
|
25
|
+
Provides-Extra: x402
|
|
26
|
+
Requires-Dist: x402[evm,requests]>=2.0; extra == 'x402'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# ddg-langchain
|
|
30
|
+
|
|
31
|
+
LangChain + CrewAI tools for **[DDG Agent Services](https://agents.daedalusdevelopmentgroup.com)**
|
|
32
|
+
— 376 pay-per-call x402 API routes on Base. Priced per call in USDC, no API
|
|
33
|
+
key, no account, no KYC.
|
|
34
|
+
|
|
35
|
+
This package wraps three flagship routes as agent tools:
|
|
36
|
+
|
|
37
|
+
| Tool | Route | Price | Notes |
|
|
38
|
+
| --- | --- | --- | --- |
|
|
39
|
+
| `ddg_web_search` | `POST /v1/web-search` | $0.005 | 20+ engines, structured JSON. First call/agent/day free. |
|
|
40
|
+
| `ddg_price_feed` | `POST /v1/price-feed` | $0.005 | Crypto / forex / stock. First call/agent/day free. |
|
|
41
|
+
| `ddg_site_audit` | `POST /v1/site-audit` | $0.01 | Read-only public-site audit, up to 120 s. |
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install ddg-langchain # LangChain tools (no payment signing)
|
|
47
|
+
pip install "ddg-langchain[x402]" # + automatic x402 settlement (EVM key)
|
|
48
|
+
pip install "ddg-langchain[crewai]" # + CrewAI toolkit
|
|
49
|
+
pip install "ddg-langchain[dev]" # everything + pytest
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Quickstart — LangChain
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from ddg_langchain import build_tools
|
|
56
|
+
|
|
57
|
+
tools = build_tools() # 3 StructuredTools, ready for any agent
|
|
58
|
+
price = tools[1].invoke({"asset": "BTC"})
|
|
59
|
+
print(price["price"], price["_ddg"])
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Quickstart — CrewAI
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from ddg_langchain.crewai import DdgCrewAIToolkit
|
|
66
|
+
from crewai import Agent, Crew, Task, Process
|
|
67
|
+
|
|
68
|
+
toolkit = DdgCrewAIToolkit()
|
|
69
|
+
researcher = Agent(role="Researcher", goal="...", tools=toolkit.tools)
|
|
70
|
+
crew = Crew(agents=[researcher], tasks=[Task(..., agent=researcher)], process=Process.sequential)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Payment (x402) — how it settles
|
|
74
|
+
|
|
75
|
+
There is no API key. A route outside the free tier answers `402` with an x402
|
|
76
|
+
challenge; this package offers three behaviours:
|
|
77
|
+
|
|
78
|
+
### 1. Automatic settlement (recommended)
|
|
79
|
+
|
|
80
|
+
Set an EVM key. The client builds a `requests.Session` through the **official
|
|
81
|
+
x402 Python SDK** (`x402.x402ClientSync` + `x402_requests` + `EthAccountSigner`),
|
|
82
|
+
registers the *exact* EVM scheme pinned to Base (`eip155:8453`), and the SDK
|
|
83
|
+
answers the 402, signs the EIP-3009 authorization, retries, and exposes the
|
|
84
|
+
settle response.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
export DDG_AGENT_ID=acme-research-agent # stable identity -> X-Agent-Id (free tier key)
|
|
88
|
+
export DDG_EVM_PRIVATE_KEY=0x... # wallet that pays the USDC
|
|
89
|
+
export DDG_MAX_PRICE_USD=0.05 # per-call cap (default 0.05)
|
|
90
|
+
python examples/langchain_agent.py
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The wallet address is the payer; it needs USDC on Base (`0x833589fC...02913`).
|
|
94
|
+
`<amount>` values in challenges are **atomic USDC (6 decimals)**: `5000` = $0.005.
|
|
95
|
+
|
|
96
|
+
### 2. Out-of-band signature
|
|
97
|
+
|
|
98
|
+
Settle with any other x402 client (TypeScript `x402-fetch`, a facilitator, a
|
|
99
|
+
hardware wallet flow) and hand the proof over:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
export DDG_PAYMENT_SIGNATURE=<base64 PAYMENT-SIGNATURE>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 3. Challenge-only (no key)
|
|
106
|
+
|
|
107
|
+
Tools still run, free tier works, and any paid call returns a JSON payload
|
|
108
|
+
instead of raising:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"status": "payment_required",
|
|
113
|
+
"route": "/v1/price-feed",
|
|
114
|
+
"accepts": [{ "network": "eip155:8453", "asset": "0x833589...02913",
|
|
115
|
+
"amount": "5000", "payTo": "0x8AfBD522...30Bc6",
|
|
116
|
+
"extra": { "name": "USD Coin", "version": "2" } }],
|
|
117
|
+
"how_to_settle": "Set DDG_EVM_PRIVATE_KEY ... or send the base64 PAYMENT-SIGNATURE."
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
That is deliberate: an agent should be able to *report* a paywall rather than
|
|
122
|
+
crash a crew. Programmatic callers who want the exception can use the client
|
|
123
|
+
directly — `DdgClient().price_feed("BTC")` raises `DdgPaymentRequired`.
|
|
124
|
+
|
|
125
|
+
### Spend cap
|
|
126
|
+
|
|
127
|
+
When a key is configured, every call is **pre-flighted** with a keyless request
|
|
128
|
+
so the real challenge price is known *before* anything is signed. A quote above
|
|
129
|
+
`DDG_MAX_PRICE_USD` raises `DdgSpendLimitExceeded` and nothing is paid.
|
|
130
|
+
|
|
131
|
+
## API
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from ddg_langchain import DdgClient, DdgConfig, build_tools, describe_routes
|
|
135
|
+
|
|
136
|
+
client = DdgClient(DdgConfig(
|
|
137
|
+
base_url="https://agents.daedalusdevelopmentgroup.com",
|
|
138
|
+
agent_id="acme-research-agent",
|
|
139
|
+
private_key=None, # or "0x..."
|
|
140
|
+
max_price_usd=0.05,
|
|
141
|
+
timeout=180,
|
|
142
|
+
))
|
|
143
|
+
|
|
144
|
+
client.web_search("x402 protocol", limit=5)
|
|
145
|
+
client.price_feed("BTC")
|
|
146
|
+
client.site_audit("https://example.com", business_type="saas", market="us-b2b")
|
|
147
|
+
client.last_settlement # settle response from the last paid call, if any
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Every successful return carries a `_ddg` metadata block:
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
"_ddg": {
|
|
154
|
+
"route": "/v1/web-search",
|
|
155
|
+
"status_code": 200,
|
|
156
|
+
"price_usd": "$0.005",
|
|
157
|
+
"payment_receipt": "ft-9ee46d0a911229b8-4684b8d3",
|
|
158
|
+
"free_tier": true,
|
|
159
|
+
"settled": false,
|
|
160
|
+
"settlement": null
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Environment variables: `DDG_BASE_URL`, `DDG_AGENT_ID`, `DDG_EVM_PRIVATE_KEY`,
|
|
165
|
+
`DDG_PAYMENT_SIGNATURE`, `DDG_MAX_PRICE_USD`, `DDG_TIMEOUT`.
|
|
166
|
+
|
|
167
|
+
## Tests
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
pytest # offline: fake transport, no keys, no network
|
|
171
|
+
pytest -m live # real edge, free tier only (costs nothing)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The live tests assert that a fresh agent id gets a real `200` on the free tier
|
|
175
|
+
and that the second call on the same identity returns a genuine 402 challenge
|
|
176
|
+
with `accepts[0].network == "eip155:8453"`.
|
|
177
|
+
|
|
178
|
+
## Honest status / what is missing to go live
|
|
179
|
+
|
|
180
|
+
* **Code is verified, the paid path is not.** The offline suite passes, and the
|
|
181
|
+
live tests drive the real edge end-to-end — but only on the free tier and the
|
|
182
|
+
challenge path. No paid settlement has been executed by this package against
|
|
183
|
+
the live edge, because that needs a funded Base wallet key.
|
|
184
|
+
* **To go live you need:** a wallet with USDC on Base, funded with at least
|
|
185
|
+
`DDG_MAX_PRICE_USD` per call, exported as `DDG_EVM_PRIVATE_KEY`; the
|
|
186
|
+
`x402[evm]` extra installed (`pip install "ddg-langchain[x402]"`).
|
|
187
|
+
* **Untested against real x402 settlement:** the pre-flight-then-pay flow, the
|
|
188
|
+
EIP-3009 signature the SDK produces for DDG's `payTo`, and
|
|
189
|
+
`last_settlement` decoding. All three are exercised only with the fake
|
|
190
|
+
transport today.
|
|
191
|
+
* **Facilitator behaviour is DDG-side.** If a settle ever fails (gas, rate
|
|
192
|
+
limit, stale challenge), the failure surfaces as an HTTP error from the edge —
|
|
193
|
+
see DDG's x402 debugger notes for the failure taxonomy.
|
|
194
|
+
* **CrewAI** is exercised only if the extra is installed; otherwise the whole
|
|
195
|
+
`tests/test_crewai.py` module is skipped, and the toolkit's lazy import keeps
|
|
196
|
+
LangChain-only installs lean.
|
|
197
|
+
* **Not published** to PyPI.
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
MIT
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# ddg-langchain
|
|
2
|
+
|
|
3
|
+
LangChain + CrewAI tools for **[DDG Agent Services](https://agents.daedalusdevelopmentgroup.com)**
|
|
4
|
+
— 376 pay-per-call x402 API routes on Base. Priced per call in USDC, no API
|
|
5
|
+
key, no account, no KYC.
|
|
6
|
+
|
|
7
|
+
This package wraps three flagship routes as agent tools:
|
|
8
|
+
|
|
9
|
+
| Tool | Route | Price | Notes |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| `ddg_web_search` | `POST /v1/web-search` | $0.005 | 20+ engines, structured JSON. First call/agent/day free. |
|
|
12
|
+
| `ddg_price_feed` | `POST /v1/price-feed` | $0.005 | Crypto / forex / stock. First call/agent/day free. |
|
|
13
|
+
| `ddg_site_audit` | `POST /v1/site-audit` | $0.01 | Read-only public-site audit, up to 120 s. |
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install ddg-langchain # LangChain tools (no payment signing)
|
|
19
|
+
pip install "ddg-langchain[x402]" # + automatic x402 settlement (EVM key)
|
|
20
|
+
pip install "ddg-langchain[crewai]" # + CrewAI toolkit
|
|
21
|
+
pip install "ddg-langchain[dev]" # everything + pytest
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quickstart — LangChain
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from ddg_langchain import build_tools
|
|
28
|
+
|
|
29
|
+
tools = build_tools() # 3 StructuredTools, ready for any agent
|
|
30
|
+
price = tools[1].invoke({"asset": "BTC"})
|
|
31
|
+
print(price["price"], price["_ddg"])
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quickstart — CrewAI
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from ddg_langchain.crewai import DdgCrewAIToolkit
|
|
38
|
+
from crewai import Agent, Crew, Task, Process
|
|
39
|
+
|
|
40
|
+
toolkit = DdgCrewAIToolkit()
|
|
41
|
+
researcher = Agent(role="Researcher", goal="...", tools=toolkit.tools)
|
|
42
|
+
crew = Crew(agents=[researcher], tasks=[Task(..., agent=researcher)], process=Process.sequential)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Payment (x402) — how it settles
|
|
46
|
+
|
|
47
|
+
There is no API key. A route outside the free tier answers `402` with an x402
|
|
48
|
+
challenge; this package offers three behaviours:
|
|
49
|
+
|
|
50
|
+
### 1. Automatic settlement (recommended)
|
|
51
|
+
|
|
52
|
+
Set an EVM key. The client builds a `requests.Session` through the **official
|
|
53
|
+
x402 Python SDK** (`x402.x402ClientSync` + `x402_requests` + `EthAccountSigner`),
|
|
54
|
+
registers the *exact* EVM scheme pinned to Base (`eip155:8453`), and the SDK
|
|
55
|
+
answers the 402, signs the EIP-3009 authorization, retries, and exposes the
|
|
56
|
+
settle response.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
export DDG_AGENT_ID=acme-research-agent # stable identity -> X-Agent-Id (free tier key)
|
|
60
|
+
export DDG_EVM_PRIVATE_KEY=0x... # wallet that pays the USDC
|
|
61
|
+
export DDG_MAX_PRICE_USD=0.05 # per-call cap (default 0.05)
|
|
62
|
+
python examples/langchain_agent.py
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The wallet address is the payer; it needs USDC on Base (`0x833589fC...02913`).
|
|
66
|
+
`<amount>` values in challenges are **atomic USDC (6 decimals)**: `5000` = $0.005.
|
|
67
|
+
|
|
68
|
+
### 2. Out-of-band signature
|
|
69
|
+
|
|
70
|
+
Settle with any other x402 client (TypeScript `x402-fetch`, a facilitator, a
|
|
71
|
+
hardware wallet flow) and hand the proof over:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
export DDG_PAYMENT_SIGNATURE=<base64 PAYMENT-SIGNATURE>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 3. Challenge-only (no key)
|
|
78
|
+
|
|
79
|
+
Tools still run, free tier works, and any paid call returns a JSON payload
|
|
80
|
+
instead of raising:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"status": "payment_required",
|
|
85
|
+
"route": "/v1/price-feed",
|
|
86
|
+
"accepts": [{ "network": "eip155:8453", "asset": "0x833589...02913",
|
|
87
|
+
"amount": "5000", "payTo": "0x8AfBD522...30Bc6",
|
|
88
|
+
"extra": { "name": "USD Coin", "version": "2" } }],
|
|
89
|
+
"how_to_settle": "Set DDG_EVM_PRIVATE_KEY ... or send the base64 PAYMENT-SIGNATURE."
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
That is deliberate: an agent should be able to *report* a paywall rather than
|
|
94
|
+
crash a crew. Programmatic callers who want the exception can use the client
|
|
95
|
+
directly — `DdgClient().price_feed("BTC")` raises `DdgPaymentRequired`.
|
|
96
|
+
|
|
97
|
+
### Spend cap
|
|
98
|
+
|
|
99
|
+
When a key is configured, every call is **pre-flighted** with a keyless request
|
|
100
|
+
so the real challenge price is known *before* anything is signed. A quote above
|
|
101
|
+
`DDG_MAX_PRICE_USD` raises `DdgSpendLimitExceeded` and nothing is paid.
|
|
102
|
+
|
|
103
|
+
## API
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from ddg_langchain import DdgClient, DdgConfig, build_tools, describe_routes
|
|
107
|
+
|
|
108
|
+
client = DdgClient(DdgConfig(
|
|
109
|
+
base_url="https://agents.daedalusdevelopmentgroup.com",
|
|
110
|
+
agent_id="acme-research-agent",
|
|
111
|
+
private_key=None, # or "0x..."
|
|
112
|
+
max_price_usd=0.05,
|
|
113
|
+
timeout=180,
|
|
114
|
+
))
|
|
115
|
+
|
|
116
|
+
client.web_search("x402 protocol", limit=5)
|
|
117
|
+
client.price_feed("BTC")
|
|
118
|
+
client.site_audit("https://example.com", business_type="saas", market="us-b2b")
|
|
119
|
+
client.last_settlement # settle response from the last paid call, if any
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Every successful return carries a `_ddg` metadata block:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
"_ddg": {
|
|
126
|
+
"route": "/v1/web-search",
|
|
127
|
+
"status_code": 200,
|
|
128
|
+
"price_usd": "$0.005",
|
|
129
|
+
"payment_receipt": "ft-9ee46d0a911229b8-4684b8d3",
|
|
130
|
+
"free_tier": true,
|
|
131
|
+
"settled": false,
|
|
132
|
+
"settlement": null
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Environment variables: `DDG_BASE_URL`, `DDG_AGENT_ID`, `DDG_EVM_PRIVATE_KEY`,
|
|
137
|
+
`DDG_PAYMENT_SIGNATURE`, `DDG_MAX_PRICE_USD`, `DDG_TIMEOUT`.
|
|
138
|
+
|
|
139
|
+
## Tests
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
pytest # offline: fake transport, no keys, no network
|
|
143
|
+
pytest -m live # real edge, free tier only (costs nothing)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The live tests assert that a fresh agent id gets a real `200` on the free tier
|
|
147
|
+
and that the second call on the same identity returns a genuine 402 challenge
|
|
148
|
+
with `accepts[0].network == "eip155:8453"`.
|
|
149
|
+
|
|
150
|
+
## Honest status / what is missing to go live
|
|
151
|
+
|
|
152
|
+
* **Code is verified, the paid path is not.** The offline suite passes, and the
|
|
153
|
+
live tests drive the real edge end-to-end — but only on the free tier and the
|
|
154
|
+
challenge path. No paid settlement has been executed by this package against
|
|
155
|
+
the live edge, because that needs a funded Base wallet key.
|
|
156
|
+
* **To go live you need:** a wallet with USDC on Base, funded with at least
|
|
157
|
+
`DDG_MAX_PRICE_USD` per call, exported as `DDG_EVM_PRIVATE_KEY`; the
|
|
158
|
+
`x402[evm]` extra installed (`pip install "ddg-langchain[x402]"`).
|
|
159
|
+
* **Untested against real x402 settlement:** the pre-flight-then-pay flow, the
|
|
160
|
+
EIP-3009 signature the SDK produces for DDG's `payTo`, and
|
|
161
|
+
`last_settlement` decoding. All three are exercised only with the fake
|
|
162
|
+
transport today.
|
|
163
|
+
* **Facilitator behaviour is DDG-side.** If a settle ever fails (gas, rate
|
|
164
|
+
limit, stale challenge), the failure surfaces as an HTTP error from the edge —
|
|
165
|
+
see DDG's x402 debugger notes for the failure taxonomy.
|
|
166
|
+
* **CrewAI** is exercised only if the extra is installed; otherwise the whole
|
|
167
|
+
`tests/test_crewai.py` module is skipped, and the toolkit's lazy import keeps
|
|
168
|
+
LangChain-only installs lean.
|
|
169
|
+
* **Not published** to PyPI.
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
MIT
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""ddg-langchain — DDG Agent Services tools for LangChain, LangGraph and CrewAI.
|
|
2
|
+
|
|
3
|
+
Three flagship x402-payable routes (USDC on Base, no API key, no KYC) exposed as
|
|
4
|
+
agent tools, with payment settlement via the official x402 Python SDK.
|
|
5
|
+
|
|
6
|
+
from ddg_langchain import build_tools
|
|
7
|
+
tools = build_tools() # 3 LangChain StructuredTools
|
|
8
|
+
|
|
9
|
+
# CrewAI
|
|
10
|
+
from ddg_langchain.crewai import DdgCrewAIToolkit
|
|
11
|
+
tools = DdgCrewAIToolkit().tools
|
|
12
|
+
|
|
13
|
+
Environment:
|
|
14
|
+
DDG_BASE_URL default https://agents.daedalusdevelopmentgroup.com
|
|
15
|
+
DDG_AGENT_ID stable agent identity -> X-Agent-Id (free tier key)
|
|
16
|
+
DDG_EVM_PRIVATE_KEY EVM key; enables automatic x402 settlement
|
|
17
|
+
DDG_PAYMENT_SIGNATURE pre-signed base64 PAYMENT-SIGNATURE (alternative)
|
|
18
|
+
DDG_MAX_PRICE_USD per-call spend cap, default 0.05
|
|
19
|
+
DDG_TIMEOUT HTTP timeout seconds, default 180
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from .client import DEFAULT_BASE_URL, DdgClient, DdgConfig, ROUTE_PRICES_USD, get_client, set_client
|
|
23
|
+
from .errors import (
|
|
24
|
+
DdgError,
|
|
25
|
+
DdgPaymentRequired,
|
|
26
|
+
DdgRequestError,
|
|
27
|
+
DdgSpendLimitExceeded,
|
|
28
|
+
)
|
|
29
|
+
from .tools import (
|
|
30
|
+
DdgPriceFeedInput,
|
|
31
|
+
DdgSiteAuditInput,
|
|
32
|
+
DdgWebSearchInput,
|
|
33
|
+
build_tools,
|
|
34
|
+
ddg_price_feed,
|
|
35
|
+
ddg_site_audit,
|
|
36
|
+
ddg_web_search,
|
|
37
|
+
describe_routes,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__version__ = "0.1.0"
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"DEFAULT_BASE_URL",
|
|
44
|
+
"ROUTE_PRICES_USD",
|
|
45
|
+
"DdgClient",
|
|
46
|
+
"DdgConfig",
|
|
47
|
+
"DdgError",
|
|
48
|
+
"DdgPaymentRequired",
|
|
49
|
+
"DdgPriceFeedInput",
|
|
50
|
+
"DdgRequestError",
|
|
51
|
+
"DdgSiteAuditInput",
|
|
52
|
+
"DdgSpendLimitExceeded",
|
|
53
|
+
"DdgWebSearchInput",
|
|
54
|
+
"build_tools",
|
|
55
|
+
"ddg_price_feed",
|
|
56
|
+
"ddg_site_audit",
|
|
57
|
+
"ddg_web_search",
|
|
58
|
+
"describe_routes",
|
|
59
|
+
"get_client",
|
|
60
|
+
"set_client",
|
|
61
|
+
"__version__",
|
|
62
|
+
]
|