Repository navigation
Releases
Releases · railpayapp/railpay-agent-tools
railpay-agent-tools v0.5.0
Added
confirm(payment)option: a human-in-the-loop callback asked before every payment, after the limits pass, with the tool, amount, recipient, URL or memo, the seller's description and the session totals. Anything buttruerefuses withpayment_declined(sourceuser) and nothing is signed. The amount stays held while it waits, so parallel calls cannot spend it.- Session payment log: every payment gets an id (
pay_1,pay_2, …), returned aspayment_id.toolkit.payments()lists them with tool, status, amount, recipient, URL or memo, transaction and time, and theonPaymentoption is called when one is made or changes status.session()also counts payments. retry_payment_idinput onrailpay_fetch: after a pending, unaccepted or unanswered payment, resends the same signed payment to the same URL, so the seller can serve the resource without a second charge. A settled payment cannot be reused (payment_already_used) and an expired one is refused (payment_expired).railpay-agent-tools/langchain:langchainTools(toolkit)returns LangChain.jsDynamicStructuredTools built from the JSON Schema, forbindTools,ToolNodeandcreateAgent.@langchain/core^1 is an optional peer dependency. Tested with@langchain/core1.5.0 and@langchain/anthropic1.6.6.- Guide
docs/which-to-use.md: railpay-mcp vs railpay-agent-tools vs railpay-sdk. - Example
examples/langchain.tsand a LangChain quick start in the README.
Changed
SpendingGuard.authorize()now takes thetoolthe payment is for.PaymentInfois nowPaymentRecord, withid,tool,url,memoandatadded.PaymentInfostays as a deprecated alias.- When a payment is pending, unaccepted or unanswered, results now point the model to
retry_payment_idinstead of telling it to give up.
railpay-agent-tools v0.4.0
Added
railpay-agent-tools/anthropic:anthropicTools()for thetoolsof the Messages API, andrunAnthropicToolUses(toolkit, message.content), which returns thetool_resultblocks for RailPay'stool_useblocks, withis_error: trueon refusals.- The dispatcher skips other tools, server tools and toolset members such as the browser tools, and works with both
client.messagesandclient.beta.messages. - Plain objects that type-check as the
@anthropic-ai/sdktypes, so the SDK is not a dependency. Tested with@anthropic-ai/sdk1.12.0. - Example
examples/anthropic.ts(Claude tool loop with server-side refusal fallbacks) and an Anthropic quick start in the README.
railpay-agent-tools v0.3.0
Added
railpay-agent-tools/openai:openaiChatTools()andopenaiResponsesTools()for thetoolsof Chat Completions and the Responses API, and the dispatchersrunOpenAIChatToolCalls(toolkit, message.tool_calls)andrunOpenAIResponsesToolCalls(toolkit, response.output), which return therole: "tool"messages orfunction_call_outputitems to send back.- The dispatchers run only RailPay's calls, one after another, and skip other tools. Arguments that are not valid JSON get an
invalid_inputresult. - Plain objects that type-check as the
openaiSDK types, soopenaiis not a dependency. Tested withopenai7.62.0. - Example
examples/openai.ts(Responses API tool loop) and an OpenAI quick start in the README.
Fixed
- The generic quick start in the README now type-checks.
railpay-agent-tools v0.2.0
Added
railpay-agent-tools/ai:aiSdkTools(toolkit)turns the tools into Vercel AI SDK tools forgenerateTextandstreamText, built withtool()andjsonSchema()(no zod schemas needed). The model gets the structured result, refusals included, and the AI SDK abort signal is passed through to the HTTP requests.ai^7 as an optional peer dependency. Tested withai7.0.179.- Example
examples/ai-sdk.ts(Claude through@ai-sdk/anthropic) and an AI SDK quick start in the README.
railpay-agent-tools v0.1.0
First release.
Added
createRailPayTools(): framework-neutral payment tools for an AI agent with a RailPay agent wallet (USDG on Robinhood Chain, chain id 4663). Each tool has a name, a description written for the model, a JSON Schema andexecute().railpay_balance: balance, ETH for gas, spent today, the owner's policy, this session's limits andmax_payment_now_usdg.railpay_quote: reads an x402 price without paying. Works without an agent key.railpay_fetch: pays an x402 v2exact402 in USDG with an EIP-3009 authorization, through railpay-sdk'swithPayment, and returns status, a truncated body and the settlement transaction link.railpay_send: pays another RailPay agent. Not offered, and refused, unlessallowSend: true.- Spending guard, checked before RailPay is asked to sign:
maxPerCall(default 0.1 USDG; the model can lower it per call withmax_amount),sessionBudget(held across parallel calls) andallowedHosts(checked before any request). - Structured results: refusals and failures come back as
{ ok: false, error: { code, message, source, retryable, hint } }instead of throwing. The agent's RailPay policy codes map to sourcepolicy. - railpay-sdk 0.1.0 is bundled into the build, so the package has no runtime dependencies.
pnpm smoke: read-only check against the live dapp.