百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

sdk

> 编程语言
开源

面向 AI 代理的商业行动层。在 OneShot 中集成工具、支付和计算功能。

194 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

面向 AI 代理的商业行动层。在 OneShot 中集成工具、支付和计算功能。

@oneshot-agent/sdk

Autonomous Agent SDK for executing real-world commercial transactions with automatic x402 payments.

Installation

bash
npm install @oneshot-agent/sdk

Using with Claude Desktop, Cursor, or Claude Code?

Use the MCP server instead for zero-code integration:

bash
npx -y @oneshot-agent/mcp-server

See the MCP Server documentation for setup instructions.

Teach your coding agent to use OneShot

Install the OneShot Agent Skills into Claude Code, Cursor, Codex, and 70+ other agents so they know how to call the SDK and MCP tools:

bash
# All OneShot skills
npx skills add oneshot-agent/agent-skills

# Or just what you need (e.g. setup + email)
npx skills add oneshot-agent/agent-skills --skill oneshot --skill oneshot-email

Skills available: oneshot (setup/auth), oneshot-email, oneshot-messaging, oneshot-research, oneshot-enrichment, oneshot-commerce, oneshot-browser, oneshot-build, oneshot-compute, soul-markets. Source: oneshot-agent/agent-skills.

Quick Start

…

Network

The SDK operates on Base Mainnet with real USDC. Fund your agent wallet with USDC on Base before making paid tool calls.

typescript
agent.usdcAddress; // 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
agent.chainId;     // 8453

Paying with ETH

Set currency: 'ETH' and the SDK keeps the wallet funded in USDC for you:

  • Before each payment it reads the wallet's USDC and subtracts payments it has signed in the last ~90s that may not have settled yet. If that covers the charge, no swap happens — the call costs one eth_call.
  • Otherwise it swaps ETH→USDC on Uniswap V3 (Base mainnet) for swapBufferMultiplier × the charge (default 10, range 1–1000), so one swap covers many calls. If your provider exposes getBalance and the wallet's ETH cannot cover the buffer, it swaps just the shortfall (a send-only provider always gets the buffered amount). Set swapBufferMultiplier: 1 for exact-shortfall swaps.
  • Concurrent calls from one instance are serialized around the swap, so a burst never double-swaps or races the wallet nonce.

Run one process per wallet in ETH mode: each process keeps its own in-flight ledger. ETH mode requires a wallet provider with sendTransaction and is Base mainnet only.

Available Methods

Method Description
Communication
email() Send emails with attachments
voice() Make phone calls
sms() Send SMS messages
inboxList() List inbound emails
inboxGet() Get email by ID
smsInboxList() List inbound SMS
smsInboxGet() Get SMS by ID
notifications() List agent notifications
markNotificationRead() Mark notification as read
Domain Pool
listDomains() List your sending domains with warmup/rotation state
pauseDomain() Take a domain out of rotation
resumeDomain() Put a paused domain back into rotation
Research & People
research() Deep web research
peopleSearch() Search people by criteria
enrichProfile() Enrich from LinkedIn/email
findEmail() Find email for a person
verifyEmail() Verify email deliverability
companySearch() Search companies by name, domain, industry, location, size, funding
enrichCompany() Enrich a company from domain, name, LinkedIn URL, or ticker
localSearch() Discover local businesses (restaurants, contractors, practices) by category × location
localResolve() Business name + address → website domain, phone, status, confidence
govSolicitations() Federal Sources Sought / Presolicitation notices by NAICS with the contracting officer's contact
deepResearchPerson() Full dossier on a person
socialProfiles() Find all social accounts
articleSearch() Find articles about a person
personNewsfeed() Recent social posts with engagement
personInterests() Analyze interests across categories
personInteractions() Map followers, following, replies
Web & Commerce
webSearch() Search the web
webRead() Read any URL as markdown + screenshot
commerceBuy() Purchase products
commerceSearch() Search products
Browser
browser() Autonomous browser — navigate, click, extract
createBrowserProfile() Create a persistent browser profile
startBrowserProfileSetup(id, loginUrl) Start interactive account login / 2FA
getBrowserProfileSetup(id) Get setup readiness and private live URL
finishBrowserProfileSetup(id) Save profile and inspect stored cookie metadata
listBrowserProfiles() List saved browser profiles
deleteBrowserProfile() Delete a browser profile
Build
build() Build and deploy production websites
updateBuild() Update an existing website
Compute (Agentic Goals)
compute() Launch autonomous multi-step goal
getComputeGoal() Get goal status and progress
getComputeTasks() List tasks for a goal
getComputeBudget() Check remaining budget for a goal
respondToComputeTask() Provide input to a pending task
pauseComputeGoal() Pause a running goal
resumeComputeGoal() Resume a paused goal
cancelComputeGoal() Cancel a goal
fundComputeGoal() Add funds to a goal's budget
Analytics & Balance
getBalance() Check token balance
getUnifiedBalance() Get balance across all chains
spendBreakdown() Spending breakdown by tool/period
rocs() Return on compute stats
receiptsList() List payment receipts (limit/offset or since/until window)
tagReceiptValue() Tag a receipt with business value (by receipt_id or request_id)

Configuration

…

Spend Budgets

Cap what the agent can spend, so a runaway loop can't drain the wallet overnight.

typescript
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,        // warn at 80% of daily
    pauseAt: 1.0,        // stop paying at 100%
  },
  alerts: { email: '[email protected]' },
});

Unlike maxCost (a per-call client-side check), budgets are enforced server-side against your receipt ledger. The config is synced once before your first paid call, so the daily figure is a true per-agent total — shared across every process, restart, and serverless invocation using the same wallet, not a per-instance counter.

At alertAt you get a notification (in-app via agent.notifications(), plus email if you set one). At pauseAt paid calls are rejected with a BudgetExceededError until the window resets at the next UTC midnight:

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

Check utilization any time:

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

Omit budgets entirely to leave whatever is stored server-side untouched — agents without a budget are unlimited, which is the default.

The sync fails closed: if the budget can't be confirmed with the server (network error, 5xx, rate limit, rejected config) the paid call throws BudgetSyncError and is not made — proceeding would silently drop the guardrail you asked for. It retries on the next paid call. An invalid config (daily: -1, alertAt: 2) throws ValidationError at construction.

Authentication

Every request identifies you by your wallet address (X-Agent-ID). Paid tools additionally settle a signed x402 USDC payment.

Read endpoints — inboxList / inboxGet, smsInboxList / smsInboxGet, notifications / markNotificationRead, getUnifiedBalance, and createBrowserProfile / listBrowserProfiles / deleteBrowserProfile — return private, per-agent data. Since a wallet address is public, the SDK proves you actually control it: on each read it signs a short-lived EIP-712 read proof and sends it as the x-agent-proof header. The API verifies the signature locally and rejects any request whose proof doesn't match the X-Agent-ID wallet, so no one can read your inbox/balance by supplying your address.

This is fully automatic — you don't do anything beyond providing your privateKey. Requires SDK ≥ 0.25.0. Older SDKs (or raw HTTP callers) will keep working until the API enables enforcement, after which they must send a valid x-agent-proof; upgrade to stay ahead of it.

Access tokens (credits-only sessions)

Some code can't hold your wallet key — a hosted MCP client such as Grok Bot, a cloud runner, a third-party agent platform. For those, mint an access token from a wallet session and hand it over instead:

typescript
// From a wallet session (once):
const { token } = await agent.createAccessToken({ name: 'grok-bot' });

// In the hosted environment:
const hosted = await OneShot.create({ accessToken: token }); // resolves the wallet address
await hosted.webSearch({ query: '…' });                        // billed to the agent's credits

An access-token session identifies the agent with the token (no x-agent-proof), pays every call from the agent's prepaid credit balance, and never signs x402. When credits can't cover a call it throws InsufficientCreditsError (required, balance, shortfall) — top up from the wallet session with agent.topUpCredits(amount) (pays the same USDC via x402) and retry. Budgets set on the agent still apply, with credit-funded spend counted; they are read-only from a token session (agent.budgets() works, passing budgets to the constructor throws). A token cannot mint, list, or revoke tokens; do that from the wallet session (listAccessTokens(), revokeAccessToken(id)). accessToken is exclusive with privateKey / cdp / walletProvider and with currency: 'ETH'. Requires SDK ≥ 0.33.0.

Tool Options

All methods accept these common options:

typescript
interface ToolOptions {
  maxCost?: number;      // Max USDC willing to pay (see supported tools below)
  timeout?: number;      // Timeout in seconds
  signal?: AbortSignal;  // Cancel before payment (see Cancellation section)
  wait?: boolean;        // Wait for async jobs (default: true)
  onStatusUpdate?: (status: string, requestId: string) => void;
}

maxCost Support

The maxCost option is a client-side guard — the SDK compares the quoted price against your limit and throws before signing any payment if it exceeds it. This is supported on tools with variable pricing:

Method maxCost
commerceBuy() Supported
voice() Supported
sms() Supported
build() / updateBuild() Supported
browser() Supported
All other tools Not applicable (fixed low-cost pricing)

Verifying Receipts

Signed receipts use Ed25519 over the canonical public receipt fields, the revision counter and a SHA-256 digest of metadata — nothing private. The response also carries the signature, digest, key_id and alg needed to verify; those are not part of the signed bytes, and neither is the caller-supplied value_tag. Unsigned receipts return malformed_receipt. verifyReceipt works offline after fetching the public keys:

…

verifyReceipt recomputes the canonical payload with the same canonicalizeReceipt function the API uses to sign — the two can never drift apart because they're literally the same function, imported on both sides. It matches

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言