Using APIs and datasets from local agent harnesses
Autonomous agents running in local Python or Node harnesses can discover and consume paid APIs and datasets directly through Sella. By initializing an MCP client and connecting a provisioned agent wallet, your local agent inspects schemas for free and executes pay-per-call queries settled in USDC over x402 on Base and Solana.
On this page
Most developers building autonomous agent loops run their code locally. Whether you are orchestrating agents in Python with LangChain and LlamaIndex, running custom TypeScript event loops, or working inside IDEs like Cursor and Claude Desktop, your agent needs real-world data and external tools to complete complex tasks.
Historically, giving a local agent access to third-party tools meant managing dozens of separate API accounts, signing up for monthly subscriptions, and hardcoding credit cards into local environment variables. If an agent needed to run three web searches, pull two blockchain state proofs, and download one training dataset, you had to subscribe to three different SaaS vendors and pay upfront minimums.
In an agent marketplace, you connect your local harness to a single Model Context Protocol (MCP) endpoint. Your local agent searches the catalogue, inspects data schemas for free, and pays for API calls and dataset downloads on demand using x402 micropayments in USDC.
Here is the complete guide to initializing Sella inside a local agent harness, finding verified tools, and executing paid calls safely.
How the local harness architecture works#
When an agent runs in a local harness, it interacts with Sella through a standard JSON-RPC interface over MCP.

The interaction pattern divides into two distinct operational phases:
- Free discovery phase: The agent calls
search_catalog,describe_catalog, andget_listing. These tools run in a keyless, rate-limited sandbox and return complete Application Data Contract (ADC) metadata, schema types, and pricing terms without touching your balance. - Paid execution phase: When the agent calls
call_apiorget_dataset, the request is authenticated via the agent's API key. The Sella backend proxy checks operator spend limits and settles the micro-payment in USDC over x402 on Base or Solana.
Because the settlement is machine-native, your local harness does not need to handle invoicing, credit card forms, or vendor onboarding.
Full initialization steps for your local harness#
Connecting your local harness to Sella takes four sequential steps.
- 1
Step 1: Onboard your agent and initialize the wallet
Your agent needs an API key and a local wallet configuration. Choose one of the three supported onboarding methods:
- Method A (Dashboard Setup Code): Open the Sella dashboard in your browser, generate a one-time setup code (such as
SELLA-XXXX-XXXX-XXXX-XXXX), and pass it to your local agent. - Method B (In-Band Email Authentication): In your agent code, call
sella_auth_startwith your email. Check your inbox for the 6-digit verification code, and callsella_auth_completeto receive your credentials. - Method C (Command Line): Run
npx sella-cli initin your terminal to generate credentials automatically.
When onboarding completes, save the returned
walletConfigto~/.sella-wallet.jsonand keep theapiKeyin your local.envfile. - Method A (Dashboard Setup Code): Open the Sella dashboard in your browser, generate a one-time setup code (such as
- 2
Step 2: Configure your local MCP client
Add the Sella MCP server to your local environment. If you are using a configuration file (like in Claude Desktop, Cursor, or a local harness runner), add the server definition:
{ "mcpServers": { "sella": { "url": "https://www.selltoagent.dev/api/mcp", "headers": { "Authorization": "Bearer YOUR_SELLA_API_KEY" } } } }If you are using the Python MCP SDK in a custom agent harness, connect to the endpoint using an asynchronous HTTP session:
import os from mcp import ClientSession from mcp.client.sse import sse_client async def init_sella(): api_key = os.getenv("SELLA_API_KEY") headers = {"Authorization": f"Bearer {api_key}"} async with sse_client("https://www.selltoagent.dev/api/mcp", headers=headers) as (read, write): async with ClientSession(read, write) as session: await session.initialize() return session - 3
Step 3: Discover endpoints and inspect schemas
Before spending funds, have your agent search the catalogue for relevant capabilities using
search_catalog:{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "search_catalog", "arguments": { "query": "solana rpc archive", "kind": "api" } } }The agent inspects candidate listings with
get_listing. As detailed in our post on what an agent reads on a listing, the response contains the exact column types, endpoint URL format, nullability rates, and unit price in USDC. - 4
Step 4: Verify price with a dry run and execute
To prevent unexpected token or dollar spend, your local agent runs a dry-run check before the live invocation:
Preflight price checkRun it { "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "call_api", "arguments": { "endpoint_id": "api_solana_rpc_archive", "dry_run": true } } }The dry-run response confirms the per-call price and verifies that your local wallet policy approves the expenditure. Once confirmed, the agent sets
dry_run: falseto execute the call and receive the live data payload.
Calling APIs vs. downloading datasets#
Depending on your agent's workload, Sella supports two primary consumption models:
1. Pay-per-call API proxies (call_api)#
For real-time queries, search requests, and inference tasks, your agent uses USDC pay-per-call APIs.
- How it works: Your local agent passes the
endpoint_idand query arguments tocall_api. - Payment: Sella handles the upstream authentication and settles the $0.01 to $0.05 USDC fee from your local wallet per call.
- Best for: Real-time market prices, on-demand web search, and dynamic entity enrichment.
2. Full dataset package delivery (get_dataset)#
For quantitative modeling, fine-tuning, or bulk backtesting, your agent buys complete data packages:
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "get_dataset",
"arguments": {
"dataset_id": "ds_liquidity_pools_2026_q3"
}
}
}Once the x402 payment clears, Sella delivers the data inline or returns a signed temporary download URL. If a download is interrupted by a local network drop, your harness can call deliver_product with the product_id to obtain a fresh temporary link without paying a second time.
Automated error handling and budget guardrails#
When running unattended agent harnesses in production, implement these four defensive safeguards:
- Pre-flight wallet balance checks: Call
budget_statusat the start of every autonomous loop to confirm that your active wallet on Base or Solana has sufficient USDC balance for planned operations. - Handle offline providers gracefully: If an upstream vendor goes offline,
call_apireturns anENDPOINT_OFFLINEerror code. Configure your harness to catch this code and querybrowse_catalogfor alternative verified providers. - Enforce hard local spending caps: While Sella's
policy_checktool provides server-side policy advice, your local agent code should enforce local per-hour and per-day token and dollar limits. - Local result caching: Store deterministic API responses locally in SQLite or Redis. An agent running repeated entity lookups should check its local cache first before issuing a paid API query.
Frequently asked questions
- What is a local agent harness?
- A local agent harness is any local execution environment running an autonomous agent loop, such as a Python LangChain script, a custom Node event loop, Cursor, or Claude Desktop.
- Do local agents need API keys for every provider in the catalogue?
- No. Your local harness connects only to the Sella MCP server. When your agent calls call_api or get_dataset, Sella proxies the execution and settles the cost from your agent wallet over x402.
- Can my local harness check the price before spending money?
- Yes. An agent can call call_api with dry_run set to true, or run purchase_preview, to inspect the exact USDC cost and verify policy approval before making a live paid request.
Connect your local harness to Sella
Test discovery tools and dry-run API calls in the interactive playground, or grab your setup code to connect your local agent in seconds.