@tychilabs/agent-finance
v1.0.0
Published
Financial home for AI agents — TypeScript SDK for self-custody wallets on the agent's device, policy on every spend, local signing, x402 payments, and ERC-8004 identity.
Maintainers
Readme
What is it?
TypeScript SDK for Tychi Agent Finance. Connect your app or agent runtime to Tychi — local identity and wallet on the agent's device, policy-controlled spending, local signing when money moves.
Using Cursor / Claude / MCP? Use @tychilabs/agent-finance-mcp instead. This package is for direct code integration.
What it is not
- Not a generic RPC wallet library.
- Not a full agent runtime or LLM host.
- Not an MCP server.
Install
npm install @tychilabs/agent-finance- Node.js >= 20
- ESM (or TS targeting ESM)
Quickstart
import { Policy, onboardNewAgent } from "@tychilabs/agent-finance";
const { session, client } = await onboardNewAgent({
baseUrl: "https://agents.tychilabs.com",
agentName: "My Agent",
vaultPassword: "local-vault-password",
sessionPassword: "session-password",
llmApiKey: process.env.OPENAI_API_KEY!,
provider: "openai",
chainId: 10143,
policy: Policy.execute({
chains: [10143],
actions: ["get_portfolio", "transfer_native"],
maxPerTxUsd: 25,
}),
});
const run = await session.run({
message: "Check my wallet balance.",
});
console.log(run.text);
// If Tychi returns a pending tx or x402 payment:
// await client.tx.signBroadcastAndResume(pending, run.run_id, provider, vaultPassword);
// await client.x402.signFetchAndResume(pending, run.run_id, provider, vaultPassword);Returning agent with existing vault? loadOrCreateAgentKeypair → createTyiClient → auth.login() → session — see Architecture.
What you get
| Area | Main APIs |
| --- | --- |
| Onboard | onboardNewAgent, onboardAgent |
| Client | createTyiClient, listCatalog, listTools, listProviders |
| Session | startSession, session.unlock, applyPolicy, session.run |
| Policy | Policy.readOnly, Policy.execute |
| Wallet | wallets.create, wallets.bindLocal — single wallet V1 |
| Transactions | tx.signBroadcastAndResume |
| x402 | x402.signFetchAndResume, external wallet helpers |
| ERC-8004 | registerErc8004, registerErc8004Onboard, profile helpers |
Trust boundary
- Agent's device: TYI seed + EVM key in local vault (
~/.tyiby default). Tx and x402 signatures happen here. - Your app inputs:
vaultPassword,sessionPassword,llmApiKey,baseUrl— pass as function args (tests may use env vars). - Tychi: orchestrates sessions, policy, and prepared actions. Prepares txs/x402 to match policy; does not hold the agent's private key.
Docs
| Doc | Topic | | --- | --- | | architecture.md | Flow, local vs remote | | vault.md | Identity + encrypted wallet | | x402.md | In-session + external buyer flows | | erc8004.md | Agent on-chain identity | | testing.md | Live scenario tests |
Related packages
| Package | Role |
| --- | --- |
| @tychilabs/agent-finance (this) | TypeScript SDK |
| @tychilabs/agent-finance-mcp | MCP for Cursor, Claude, OpenClaw, Hermes |
| agent-finance | Monorepo |
Security
See SECURITY.md.
License
Apache-2.0 — see LICENSE.
