Packages

Building with the packages

Two packages cover most of an integration: a typed client for your server, and Fin's blocks for your React chat. Use either one alone, or both together.

How they fit

Your API key and your users' sessions stay on your server. The SDK talks to Fin, your server relays the conversation, and the React package draws it.

  1. Your server creates the user, opens their session after your own sign-in, and starts a run for each message: users.create, users.createSession, runs.start.
  2. Your server follows the conversation with events.stream and relays each event to the page.
  3. Your page folds the events with threadReducer, and draws Fin's entries with FinEntry beside your own message bubbles.
  4. The user decides an approval or answers a question; your server sends it with approvals.approve, approvals.deny or questions.answer.

Neither package needs the other: use the SDK under your own interface, or the components over data your server reads by HTTP.

Install

Terminal
npm install @nearai/financial-agents-sdk                   # on your server
npm install @nearai/financial-agents-react @base-ui/react  # in your React app

Requirements

@nearai/financial-agents-sdk@nearai/financial-agents-react
Runs onYour server: Node 20+, Bun, Deno, edge runtimesThe browser, and your server for server rendering
Peer dependenciesNoneReact 19, react-dom 19, @base-ui/react 1.3+
TypeScript5.4+5.4+
Entry points@nearai/financial-agents-sdk@nearai/financial-agents-react, /model, /fixtures, /styles.css

Money needs the user's signature

Creating the agent wallet, withdrawing and approving a trade each carry the user's wallet signature of the exact message Fin issued. Fin verifies it on arrival and again before anything is signed.

The approval card shows the exact terms of the contract Fin derived, never the model's words. A contract the card cannot read offers only Cancel: nobody approves terms they were not shown.

Next steps

Fin documentation Built from the API contract · v1

Search all documentation