> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oneshotagent.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OneShot SDK Overview

> Connect by SDK or MCP. Call one tool at a known price, or hand over a goal with a budget. OneShot handles execution and payment.

![](https://mintcdn.com/freebutter/jPFJoUgC4P5j3KGx/images/objects/sdk.webp?fit=max\&auto=format\&n=jPFJoUgC4P5j3KGx\&q=85\&s=6c7b21971709dd2e1d31d738554022c7)

## SDK

Call [tools](https://docs.oneshotagent.com/tools-and-goals.md#a-tool): `agent.email()`; [goals](https://docs.oneshotagent.com/tools-and-goals.md#a-goal): `agent.compute()`. SDK: signs payments, polls jobs, retries [rate limits](https://docs.oneshotagent.com/rate-limits.md). [Receipts](https://docs.oneshotagent.com/sdk/audit-context.md) carry `memo` and `decisionContext`. [Quickstart](https://docs.oneshotagent.com/quickstart.md).

> [!NOTE]
>
> Base Mainnet, real USDC: fund the wallet before paid calls.

> [tab] CDP Wallet (Recommended)
>
> ```typescript theme={null}
> import { OneShot } from "@oneshot-agent/sdk";
>
> // Coinbase CDP Server Wallet — no private key needed
> // Reads CDP_API_KEY_ID, CDP_API_KEY_SECRET, CDP_WALLET_SECRET from env
> const agent = await OneShot.create({ cdp: true });
>
> // Send email (handles quote + payment + send automatically)
> await agent.email({
>   to: "user@example.com",
>   subject: "Hello from OneShot",
>   body: "This was sent autonomously!",
> });
> ```

> [tab] Private Key
>
> ```typescript theme={null}
> import { OneShot } from "@oneshot-agent/sdk";
>
> // Raw private key — existing behavior
> const agent = new OneShot({
>   privateKey: process.env.AGENT_PRIVATE_KEY,
> });
>
> // Deep research
> const report = await agent.research({
>   topic: "Latest AI agent frameworks",
>   depth: "deep",
> });
>
> console.log(report.report_content);
> ```

[ETH mode](https://docs.oneshotagent.com/sdk/installation.md#pay-with-eth) tops up USDC when low.

## Paying with raw HTTP

`402` returns `PAYMENT-REQUIRED`. Sign the USDC authorization; send base64 JSON in `payment-signature`, never `Authorization`.

## Read authentication

The SDK signs `x-agent-proof` for private reads. Raw HTTP: `401 proof_required` returns `required_scope` (`"read"`/`"write"`).

1. Set `agent` to the `X-Agent-ID` wallet, `scope` to `required_scope`, `issuedAt` to integer Unix seconds, `nonce` to 32 random bytes, `0x`-prefixed hex, never reused.

2. Sign EIP-712 data with that wallet:

   ```json theme={null}
   {
     "domain": { "name": "OneShot Agent Auth", "version": "1" },
     "primaryType": "AgentReadAuth",
     "types": {
       "AgentReadAuth": [
         { "name": "agent", "type": "address" },
         { "name": "scope", "type": "string" },
         { "name": "issuedAt", "type": "uint256" },
         { "name": "nonce", "type": "bytes32" }
       ]
     },
     "message": { "agent": "0xYourWallet", "scope": "read", "issuedAt": 1760000000, "nonce": "0x…32 bytes…" }
   }
   ```

3. Base64-encode JSON `{ agent, scope, issuedAt, nonce, signature }` as `x-agent-proof`, with `X-Agent-ID`.

```ts theme={null}
import { Wallet, randomBytes, hexlify } from 'ethers';

const wallet = new Wallet(PRIVATE_KEY);
const scope = 'read'; // use the 401's required_scope ('write' for write endpoints)
const message = { agent: wallet.address, scope, issuedAt: Math.floor(Date.now() / 1000), nonce: hexlify(randomBytes(32)) };
const signature = await wallet.signTypedData(
  { name: 'OneShot Agent Auth', version: '1' },
  {
    AgentReadAuth: [
      { name: 'agent', type: 'address' },
      { name: 'scope', type: 'string' },
      { name: 'issuedAt', type: 'uint256' },
      { name: 'nonce', type: 'bytes32' },
    ],
  },
  message,
);
const proof = Buffer.from(JSON.stringify({ ...message, signature })).toString('base64');
const headers = { 'X-Agent-ID': wallet.address, 'x-agent-proof': proof };
```

Python: `eth_account.messages.encode_typed_data`.

Proofs last 5 minutes, single-use. Tokens are exempt. `401 invalid_proof`: `expired`, `already_used`, `wrong_scope`, `invalid`; SDKs retry the first two once. `401 proof_required`: TypeScript SDKs retry once, correcting the clock from `server_time` or re-signing replayed reads. Raw callers derive `issuedAt` from `server_time`.

## Supported tools

Quote-based tools price each call; `maxCost` rejects higher quotes before signing. [Pricing](https://docs.oneshotagent.com/pricing.md). `agent.tool(name, options)` calls any tool.

| Group | Methods |
| - | - |
| [Messaging](https://docs.oneshotagent.com/api-reference/email/send.md) | `agent.email()`, `agent.voice()` (quote), `agent.sms()` (quote), `agent.inboxList()`, `agent.inboxGet(id)`, `agent.smsInboxList()`, `agent.smsInboxGet(id)` |
| [Research and enrichment](https://docs.oneshotagent.com/api-reference/research/person-intelligence.md) | `agent.research()`, `agent.personFind()`, `agent.personDossier()` (2-5 min), `agent.personSocialAccounts()`, `agent.personArticles()`, `agent.personPosts()`, `agent.personInterests()`, `agent.personFollowers()`, `agent.personProfile()`, `agent.personEmail()`, `agent.personEmailStatus()`, `agent.companyFind()`, `agent.companyProfile()`, `agent.businessFind()`, `agent.businessResolve()`, `agent.recordSolicitationsFind()` |
| [Web and browser](https://docs.oneshotagent.com/api-reference/browser/create.md) | `agent.webSearch()`, `agent.webRead()`, `agent.browser()` (quote), `agent.createBrowserProfile()`, `agent.listBrowserProfiles()`, `agent.deleteBrowserProfile(id)` |
| [Build](https://docs.oneshotagent.com/api-reference/build/create.md) | `agent.build()` (quote), `agent.updateBuild()` (quote) |
| [Commerce](https://docs.oneshotagent.com/api-reference/commerce/buy.md) | `agent.productFind()`, `agent.commerceBuy()` (quote) |
| [Account](https://docs.oneshotagent.com/api-reference/notifications/list.md) | `agent.notifications()`, `agent.markNotificationRead(id)`, `agent.getBalance(tokenAddress)` |

Person profile: name+company, email, phone or LinkedIn/X/GitHub URL.

[Login/2FA](https://docs.oneshotagent.com/api-reference/browser/profiles.md#interactive-login-and-2fa): `agent.startBrowserProfileSetup()` returns a single-use `setup_url` that expires in 10 minutes; `agent.createBrowserProfileSetupLink()` renews it. **Done** sets `completed_at`; **Cancel** ends setup without it.

### Compute

`agent.compute(options)` (x402 quote) creates a goal. Free: `getComputeGoal`, `getComputeTasks`, `getComputeOutputs`, `getComputeOutput(goalId, key)`, `getComputeBudget`, `cancelComputeGoal`, `respondToComputeTask`, `pauseComputeGoal`, `resumeComputeGoal`. `fundComputeGoal(goalId, amount)` is an x402 quote. Pause, resume and fund need a recurring goal (`schedule`). Unspent budget returns as credits when goals end. Python: same methods in snake case; [access tokens](https://docs.oneshotagent.com/sdk/remote-mcp.md) need `oneshot-python` ≥ 0.26.0. [Compute](https://docs.oneshotagent.com/api-reference/compute/create.md).

## Server-side cost cap (`X-Max-Cost-USDC`)

Rejects higher quotes before payment: `400 exceeds_caller_budget`. TypeScript `maxCost`, Python `max_cost`.

```bash theme={null}
curl -X POST https://win.oneshotagent.com/v1/tools/voice/call \
  -H "X-Agent-ID: 0x..." \
  -H "X-Max-Cost-USDC: 2.00" \
  -H "Content-Type: application/json" \
  -d '{"objective":"book a table","target_number":"+14155551234","max_duration_minutes":3}'
```

```json theme={null}
{
  "error": "exceeds_caller_budget",
  "message": "Quote $2.500000 exceeds X-Max-Cost-USDC cap $2.00",
  "quote": { "total": "2.500000", "cap": "2.00" }
}
```

## Spend budgets

Caps each UTC day and call across every process on one wallet. [Contract](https://docs.oneshotagent.com/api-reference/budgets/overview).

```typescript TypeScript theme={null}
const agent = await OneShot.create({
  cdp: true,
  budgets: {
    daily: 50,           // max USDC per UTC day
    perTransaction: 5,   // max USDC for any single call
    alertAt: 0.8,        // notify at 80% of daily
    pauseAt: 1.0,        // stop paying at 100%
  },
  alerts: { email: "you@example.com" },
});
```

```python Python theme={null}
client = OneShotClient(
    "0x...",
    budgets={"daily": 50, "per_transaction": 5, "alert_at": 0.8, "pause_at": 1.0},
    alert_email="you@example.com",
)
```

`alertAt` sends `budget_warning` (plus email if set); at `pauseAt`, paid calls fail until UTC midnight:

```typescript TypeScript theme={null}
import { BudgetExceededError } from "@oneshot-agent/sdk";

try {
  await agent.research({ topic: "..." });
} catch (err) {
  if (err instanceof BudgetExceededError) {
    console.log(`${err.reason} budget hit — $${err.spent} spent, resumes ${err.resetsAt}`);
  }
}

const b = await agent.budgets();
// { daily_usdc: 50, spent_today_usdc: "41.20", pct_used: 0.824, resets_at: "…" }
```

```python Python theme={null}
from oneshot import BudgetExceededError

try:
    client.research(topic="...")
except BudgetExceededError as e:
    print(f"{e.reason} budget hit — ${e.spent} spent, resumes {e.resets_at}")

client.get_budgets()
```

Omit `budgets`: unchanged. No budget: unlimited. Unconfirmed sync: `BudgetSyncError`, no paid call. Invalid config: `ValidationError`. MCP: `ONESHOT_BUDGET_*`; `oneshot_budget_status` is read-only.

## SDKs and packages

| Package |
| - |
| [`@oneshot-agent/sdk`](https://www.npmjs.com/package/@oneshot-agent/sdk) |
| [`@oneshot-agent/mcp-server`](https://www.npmjs.com/package/@oneshot-agent/mcp-server) |
| [`oneshot-python`](https://pypi.org/project/oneshot-python/) |
| [`langchain-oneshot`](https://pypi.org/project/langchain-oneshot/) |
| [`game-plugin-oneshot`](https://pypi.org/project/game-plugin-oneshot/) |

[Source](https://github.com/oneshot-agent/sdk)

## Next steps

> [card] [Installation](https://docs.oneshotagent.com/sdk/installation.md)

> [card] [Examples](https://docs.oneshotagent.com/sdk/examples.md)

> [card] [LangChain (Python)](https://docs.oneshotagent.com/sdk/langchain.md)

> [card] [MCP Server](https://docs.oneshotagent.com/sdk/mcp.md)

> [card] [Virtuals GAME SDK](https://docs.oneshotagent.com/sdk/virtuals.md)

> [card] [Agent Skills](https://docs.oneshotagent.com/sdk/agent-skills.md)

> [card] [Pricing](https://docs.oneshotagent.com/pricing.md)

## Optional phone lookup

<Snippet file="phone-lookup.mdx" />


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.