@openmerch/agent
v0.2.5
Published
OpenMerch Agent SDK — discover services, execute tasks, manage wallet
Maintainers
Readme
@openmerch/agent
TypeScript SDK for OpenMerch agents. Discover services, execute tasks against providers, and manage wallet balances on the OpenMerch protocol.
@openmerch/agent is intended for clients and agents that need to discover and invoke machine payable services through OpenMerch and the Machine Payable Protocol (MPP). It focuses on the public agent-side contract: discovery, execution requests, and payment-aware integration points.
Installation
npm install @openmerch/agentOverview
This package provides the type definitions and interfaces for building an OpenMerch agent. Agents interact with the network to:
- Discover available services by keyword, price, or execution mode
- Execute tasks against provider services (sync, async, or streaming)
- Manage wallet balances and track transaction history
Usage
import type {
AgentConfig,
ServiceQuery,
TaskRequest,
TaskResult,
WalletBalance,
} from "@openmerch/agent";
// Search for services
const query: ServiceQuery = {
keyword: "translation",
mode: "sync",
maxPrice: "500",
currency: "USD",
};
// Build a task request
const task: TaskRequest = {
serviceId: "translation-v1",
mode: "sync",
payload: { text: "Hello", targetLang: "es" },
maxPrice: "100",
};Exported Types
ServiceQuery— filter criteria for service discoveryServiceListing— a service returned from discoveryServiceQueryResult— paginated discovery resultsTaskRequest— request to execute a taskTaskResult— result from a sync executionAsyncTaskHandle— handle for polling async tasksTaskStreamChunk— a chunk from a streaming executionWalletBalance— current wallet balanceWalletTransaction— a single transaction recordAgentConfig— agent connection configuration
Current Scope
This package currently exports type definitions and interfaces. Runtime client functionality is under active development.
Payment support: Pricing is expressed in USD-denominated units for accounting. Onchain settlement currently uses USDC on Base and Base Sepolia.
