Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pulsenetwork-data/.env.example.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Wallet the agent pays from. Use a THROWAWAY key holding a few USDC on Base,
# never a wallet you keep funds in. This is the only credential you need:
# PulseNetwork has no accounts, no signup and no API keys.
PULSE_WALLET_KEY=0xyour-throwaway-private-key

@cubic-dev-ai cubic-dev-ai Bot Aug 9, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The documented env-check promise doesn't hold with this placeholder: README says leaving the key placeholder yields "Refused: PULSE_WALLET_KEY is not set", but this non-empty placeholder (0xyour-throwaway-private-key) passes the if not key guard and instead hits Account.from_key, producing a different message ("not a valid private key"). Either add an explicit placeholder sentinel check in main.py alongside the empty check, or correct the README refusal-table entry, so the template's placeholder and the documented refusal actually match.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At pulsenetwork-data/.env.example.template, line 4:

<comment>The documented env-check promise doesn't hold with this placeholder: README says leaving the key placeholder yields "Refused: PULSE_WALLET_KEY is not set", but this non-empty placeholder (`0xyour-throwaway-private-key`) passes the `if not key` guard and instead hits Account.from_key, producing a different message ("not a valid private key"). Either add an explicit placeholder sentinel check in main.py alongside the empty check, or correct the README refusal-table entry, so the template's placeholder and the documented refusal actually match.</comment>

<file context>
@@ -0,0 +1,12 @@
+# Wallet the agent pays from. Use a THROWAWAY key holding a few USDC on Base,
+# never a wallet you keep funds in. This is the only credential you need:
+# PulseNetwork has no accounts, no signup and no API keys.
+PULSE_WALLET_KEY=0xyour-throwaway-private-key
+
+# Model for the agent (any browser-use supported provider works)
</file context>
Fix with cubic


# Model for the agent (any browser-use supported provider works)
OPENAI_API_KEY=sk-your-key-here

# Optional spending limits, enforced in code on every paid call.
# Defaults: 0.50 per call, 2.00 per session.
PULSE_MAX_PER_CALL_USD=0.50
PULSE_SESSION_BUDGET_USD=2.00
126 changes: 126 additions & 0 deletions pulsenetwork-data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Agent Buys Live Data Mid-Task (x402)

A browser-use agent that pays for the data it needs, per call, while it works.

Most agents are stuck with whatever the model already knows plus whatever a page
happens to show. This template gives the agent a wallet and three tools, so when
a task needs a fact the model cannot know (is this token a honeypot, is this
flight owed compensation, has this product been recalled) the agent finds the
right endpoint, checks the price, pays a few cents in USDC on Base, and keeps
going.

There is no signup, no API key and no account. The wallet is the identity.

## The Tools

| Tool | Cost | What it does |
| --- | --- | --- |
| `pulse_catalog` | free | Searches 950+ pay-per-call endpoints. Returns each match as a complete URL with its price and its query parameters. |
| `pulse_price` | free | Reads the exact price of one endpoint from its 402 challenge. Settles nothing. |
| `pulse_buy` | the endpoint price | Pays one call with USDC on Base and returns the JSON. |

Typical prices run from $0.005 to $0.35 per call. The demo task costs about
$0.015.

## Spending Controls

The limits are in the code, not in the prompt, so the agent cannot be talked
past them by a web page or by its own reasoning:

- **Host allowlist.** Every tool that makes an outbound request refuses any URL
that is not an https PulseNetwork endpoint, the free ones included. The agent
reads live web pages while it works, so a page must not be able to talk it
into fetching an internal address on the agent's behalf.
- **Per-call cap and session budget.** Enforced as an x402 payment policy, which
inspects the 402 challenge that is actually being signed. A price that changes
between the quote and the payment cannot slip through, because the quote is
not what authorizes the spend.
- **USDC on Base only.** The caps are counted in USDC's six decimals, so the
policy pins the asset as well as the network. The same number of atomic units
in a token with different decimals would be a different amount of money, and
an unpinned cap would not notice.
- **A lock around the buy path**, so two concurrent tool calls cannot both spend
the last of the budget.
- **The key never reaches the model.** It is read from the environment inside the
tool. The agent passes a URL and gets JSON back.

## Setup

### 1. Navigate to the project directory

```bash
cd pulsenetwork-data
```

### 2. Create a wallet and fund it

Generate a throwaway key and send it a few dollars of USDC on Base. Do not use a
wallet that holds anything you care about. A dollar or two is enough for
hundreds of calls.

### 3. Configure the environment

```bash
cp .env.example .env
```

Edit `.env` and set `PULSE_WALLET_KEY` and your model key. You can also lower
`PULSE_MAX_PER_CALL_USD` and `PULSE_SESSION_BUDGET_USD` from their defaults of
$0.50 and $2.00.

### 4. Install dependencies

```bash
uv sync
```

This installs `browser-use`, the official `x402` Python SDK with its httpx and
EVM extras, and `eth-account`.

### 5. Run it

```bash
uv run main.py
```

The demo task scans a real token on Robinhood Chain for rug and honeypot risk
before anyone buys it, and reports the verdict with its red and green flags.

## Using It In Your Own Agent

Import the `tools` object and hand it to any `Agent`:

```python
from main import tools

agent = Agent(task="...", llm=ChatOpenAI(model="gpt-4.1-mini"), tools=tools)
```

The tools compose with browser-use's own actions, so an agent can read a page,
buy a fact that the page does not contain, and act on both.

## Troubleshooting

| What you see | What it means |
| --- | --- |
| `Refused: PULSE_WALLET_KEY is not set` | No `.env`, or the key line is still the shipped placeholder. |
| `Refused: PULSE_WALLET_KEY is not a valid private key` | The key is set to something that is not a 0x private key. |
| `Refused: these tools only reach PulseNetwork endpoints` | The agent tried a URL outside PulseNetwork. Working as intended. |
| `Refused, nothing was paid: the endpoint asked for $X` | The price is above your remaining allowance. Raise the cap or pick a cheaper endpoint. |
| `Refused: the session budget is spent` | Restart the process, or raise `PULSE_SESSION_BUDGET_USD`. |
| `The payment did not complete` | Usually an unfunded wallet. Check the USDC balance on Base. |
| `Endpoint answered 400` | A missing or malformed parameter. `pulse_catalog` lists what each endpoint takes. |

## Links

- Catalog and docs: https://pulse.theaslangroupllc.com/llms.txt
- Machine-readable search: https://pulse.theaslangroupllc.com/api/catalog?q=token+safety
- x402 protocol: https://x402.org

## Disclosure

PulseNetwork is operated by The Aslan Group LLC, who wrote this template. The
tools only pay PulseNetwork endpoints, which is a deliberate safety limit rather
than a claim that nothing else is worth buying. The pattern itself is generic:
any x402 seller can be reached the same way by changing the host allowlist and
the catalog URL.
Binary file not shown.
Loading