Skip to content

Commit 88eaeed

Browse files
committed
move examples
1 parent 50b4369 commit 88eaeed

4 files changed

Lines changed: 12 additions & 14 deletions

File tree

examples/guides/x402_examples/agent_integration/x402_agent_buying.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from x402.client import X402Client
21
from eth_account import Account
32
from x402.clients.httpx import x402HttpxClient
43

@@ -10,8 +9,7 @@
109

1110

1211
async def buy_x402_service(
13-
base_url: str = None,
14-
endpoint: str = None
12+
base_url: str = None, endpoint: str = None
1513
):
1614
"""
1715
Purchase a service from the X402 bazaar using the provided affordable_service details.
@@ -31,20 +29,22 @@ async def buy_x402_service(
3129
```python
3230
affordable_service = {"id": "service123", "price": 90000}
3331
response = await buy_x402_service(
34-
affordable_service,
35-
base_url="https://api.cdp.coinbase.com",
32+
affordable_service,
33+
base_url="https://api.cdp.coinbase.com",
3634
endpoint="/x402/v1/bazaar/services/service123"
3735
)
3836
print(await response.aread())
3937
```
4038
"""
41-
key = os.getenv('X402_PRIVATE_KEY')
42-
39+
key = os.getenv("X402_PRIVATE_KEY")
40+
4341
# Set up your payment account from private key
4442
account = Account.from_key(key)
4543

46-
async with x402HttpxClient(account=account, base_url=base_url) as client:
44+
async with x402HttpxClient(
45+
account=account, base_url=base_url
46+
) as client:
4747
response = await client.get(endpoint)
4848
print(await response.aread())
49-
50-
return response
49+
50+
return response

examples/guides/x402_examples/agent_integration/x402_discovery_query.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import httpx
55

66

7-
87
async def query_x402_services(
98
limit: Optional[int] = None,
109
max_price: Optional[int] = None,
@@ -207,7 +206,6 @@ def get_x402_services_sync(
207206
return str(services)
208207

209208

210-
211209
agent = Agent(
212210
agent_name="X402-Discovery-Agent",
213211
agent_description="A agent that queries the x402 discovery services from the Coinbase CDP API.",
@@ -228,4 +226,4 @@ def get_x402_services_sync(
228226
out = agent.run(
229227
task="Summarize the first 10 services under 100000 atomic units (e.g., $0.10 USDC)"
230228
)
231-
print(out)
229+
print(out)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
55

66
[tool.poetry]
77
name = "swarms"
8-
version = "8.6.1"
8+
version = "8.6.2"
99
description = "Swarms - TGSC"
1010
license = "MIT"
1111
authors = ["Kye Gomez <kye@swarms.world>"]

0 commit comments

Comments
 (0)