Skip to content
JaDi03Public

About

AI investment agent on NEAR. Type what you want; your own agent trades on NEAR Intents, the AI runs in a TEE on NEAR AI Cloud, and a contract on your account refuses anything over your limits.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Inti

network intents tee security node license

Inti is an investment agent on NEAR. You type buy $5 of bitcoin, and your own agent on NEAR Intents buys it with NEAR from your wallet, within limits you set.

Live app: https://getinti.xyz (NEAR mainnet, real funds). To try it without an account or funds, open the dry run at https://getinti.xyz/try.

Demo video: https://x.com/_Ja_V1/status/2121621345314189646

Giving an AI agent money usually means giving it your keys. Inti never holds your money or your full-access key. It gets a key that can only send one order at a time to your own agent, and a contract on your own account refuses any order above your limits. Inti checks the same limits first, so an order over them never reaches the chain.

You can check this yourself: the contract on mainnet rebuilds to the same hash from this repository (how), every AI reply in the signed-in app carries a signature from the model's hardware (how), and the transactions of a real trade are linked under Try it.


Table of Contents

  1. Why Inti exists
  2. Try it
  3. What an intent is, and why it matters here
  4. How it works
  5. Your limits and Inti's key
  6. Check it yourself
  7. Run your own server
  8. Project structure
  9. Tech stack
  10. Built during the NEAR hackathon

Why Inti exists

Every year there are fewer barriers to using a blockchain. The ones left are the ones that stop careful people:

  • Signing what you cannot read. A wallet asks you to approve a string of code.
  • A mistake you cannot undo. One wrong network or address and the money is gone.
  • Handing an AI the keys to your money. An agent that can trade for you can usually also empty your account.

You sign in with email or Google, you type "buy $5 of bitcoin", and you read in plain words what you are about to sign. The agent never writes an address. Your limits live in a contract on your own account: Inti's server checks them first, and the contract refuses any order over them even if the server got it wrong.

Try it

Dry run (no account, no wallet, nothing moves):

Open https://getinti.xyz/try, or tap Dry run, no funds on the landing page. You get a practice wallet with $100 of NEAR set aside for orders, a limit of $25 per order and $50 per day (each message starts a fresh practice day), and the same portfolio, limits and rules panels as the real app.

  • Type buy $5 of bitcoin. The agent asks NEAR Intents for a real quote (dry: true, so nothing is bought) and answers with what you would get.
  • Under the reply, Where your money would sit shows the four steps the money would take: it waits in your wallet under your limits, goes to your own agent on NEAR Intents, is swapped with a minimum you accept, and the bitcoin comes back to your wallet.
  • Agent log shows every request the agent sent to the NEAR Intents Agent API and the exact answer.
  • Type buy $30 of gold. The order is over the practice limit of $25, so it is refused before any quote.

The dry run code is in agent/server/dryRun.ts (server) and web/src/dryrun/ (page). Its tools can only read prices and ask for quotes; none of them can move money.

Signed in, without funds (nothing moves):

Open https://getinti.xyz on a phone or a computer.

  1. Sign in with email or Google. You see your dashboard and an empty NEAR wallet that Privy made for you. You never see a seed phrase.
  2. Next to the logo, a shield says AI hardware verified. Tap it to see each check on the AI model's hardware and run them again.
  3. In the chat, type buy $5 of bitcoin. Inti answers in plain words. Under the reply you see Simulated portfolio, no real funds moved: until you have an agent and a signed permission, every order runs on a practice portfolio.
  4. Under the same reply, tap Signed by the verified AI model to see the signature over that exact answer.

With real funds (NEAR mainnet):

  1. Open Spending limits and follow its four steps in order:

    • Protect your account with a passkey.
    • Add funds: send NEAR to the address shown. The step tells you how much is needed (about 1.9 NEAR with 0.1 NEAR set aside for orders; it grows with what you set aside). About 1.7 NEAR of it pays for the contract's storage on your account and comes back when you Turn off Inti.
    • Create your agent: your own agent on NEAR Intents, which can send only to you.
    • Set your spending limits and tap Activate Inti. You sign two transactions. The first installs the Spending Limits contract on your account, sets your limits and gives Inti a key that can only call fund_agent. The second wraps the NEAR you set aside for orders.
  2. Sign a trading permission (a grant) for your agent, for 7, 30 or 90 days.

  3. Type buy $5 of gold, buy Zcash if it drops to $900, or sell half my bitcoin and buy euro with it. The agent places each order, one after another, and tells you what it got and what it cost. The result appears in your portfolio. To ask the price without buying, type how much bitcoin do I get for $5?. A real use on mainnet, 14 November 2026: buy $5 of gold, then sell it, half for bitcoin and half for euro. On chain you see only two transactions:

    • C68paMYv: the Spending Limits contract on the user's account sends 1.488 wNEAR to the user's agent in NEAR Intents, after checking the limits.
    • 5cr7nwxz: NEAR Intents sends 0.00003638 BTC to the user's wallet.

    The gold purchase, its sale and the euro happened inside the agent's confidential balance, so no public transaction shows them. The euro stays with the agent (see Where your assets sit).

  4. Type an order above your limit. Inti tells you it is over your limit and sends no transaction, so you pay no fee. If Inti's check were ever wrong, the contract would refuse the order on chain (see Your limits and Inti's key).

  5. To stop Inti you have two switches, both signed by you. Pause Inti deletes Inti's key from your account, and any earlier Inti key it still has, so no more money leaves your wallet; your agent can still trade what it already holds while your grant lasts. Freezing your agent stops everything it does until you unfreeze it.

What an intent is, and why it matters here

An intent is a signed statement of what you want ("I want $5 of bitcoin, and I accept no less than this much"), not the steps to get it. Solvers compete to fill it, and the network checks that the result matches what you signed.

That idea came with a promise: people would say what they want and the chain would stay out of sight. NEAR's co-founder Illia Polosukhin wrote in 2023: "hopefully, users won't have to manage or even know about the technical layers."

The words you type become an intent on NEAR Intents, placed by your own agent through the Agent API. What stays visible is what should: your limits, what each order spends, and where your money is at every step.

How it works

A purchase: you ask to buy $5 of bitcoin, the AI picks a tool, Inti checks your limits, then the money comes from your wallet through your Spending Limits contract or from your agent's balance. Your agent on NEAR Intents trades under your signed policy. BTC, ETH and ZEC go to your wallet; XAUT, EURe, SOL and NEAR stay in your agent's balance.

  1. You write what you want. The app sends it to Inti's server, which checks your Privy sign-in on every request.
  2. The model decides. It runs on NEAR AI Cloud inside a TEE (private hardware) and picks one of eight tools. It names an asset and an amount in dollars; it never writes an address.
  3. The contract checks. Inti's key calls fund_agent on your account. The contract adds the order to what the last 24 hours already spent and refuses it if a limit would be passed.
  4. Your agent trades. The NEAR goes to your own agent on NEAR Intents, which swaps it with a minimum you accept, from its confidential balance.
  5. The result comes home. Bitcoin, ether and Zcash go to your wallet; if one could not be sent right away, Inti tries again every 5 minutes. Gold, euro, Solana and the NEAR from a sale stay with your agent (see Where your assets sit).

The agent

The model decides; the code and the contract enforce the limits.

  • agent/core/loop.ts: the loop. A brain is any object with a step() method.
  • agent/brains/nearai.ts: the brain, model deepseek-ai/DeepSeek-V4.1-Flash-1017 on NEAR AI Cloud, which runs inside NEAR AI's TEE.
  • agent/server/realTools.ts: the eight tools the model can call: get_portfolio, get_quote, buy_now, buy_at_price, get_sell_quote, sell_now, send_near_to_wallet and ask_user.
export const ASSETS = {
  bitcoin: { name: "Bitcoin", symbol: "BTC", assetId: "nep141:nbtc.bridge.near", decimals: 8, kind: "crypto" },

agent/policy/assets.ts: the model chooses from a fixed list by name. The token address comes from this file, so a prompt hidden in a message cannot make the agent pay somewhere else.

Where your assets sit

The agent buys and sells bitcoin (BTC), ether (ETH) and Zcash (ZEC), and pays with NEAR. These go to your wallet.

It also buys gold (XAUT), euro (EURe) and Solana (SOL) (agent/policy/heldAssets.ts). These stay in your agent's confidential balance on NEAR Intents, and the dashboard shows how much your agent holds of each, with its price. When you ask Inti to sell, the agent sells for NEAR and keeps that NEAR to pay for your next purchase. To bring it to your wallet, type send my NEAR to my wallet or use the send button next to your agent's NEAR on the dashboard.

Why they stay with the agent: since 12 November 2026 the Agent API trades only from the agent's confidential balance; the public balance can only send funds out (the API answers public_balance_exit_only). From the confidential balance it sends to a NEAR wallet only tokens that live on NEAR. Gold, euro and Solana live on Ethereum, Gnosis and Solana, so a withdrawal of them answers unsupported_token (agent/server/orders.ts).

What this means for you:

  • The agent's rules are the ones you signed: it can send only to you, and you can freeze it at any time with your own signature.
  • Withdrawals and sales go through the agent, so they need Inti's server to be running. While it is down, your gold, euro and SOL stay with your agent. They do not move anywhere else.

Until 12 November 2026 Inti sent gold, euro and Solana to the user's NEAR wallet. That version is in the tag gold-euro-sol-final. One of its trades on mainnet, a sale of gold for Solana on 12 November 2026:

  1. 7BrWbDgR: the Spending Limits contract on the user's account sends 0.000062 XAUT to the agent in NEAR Intents.
  2. CCAuxeuM: the agent gives the gold to a market maker.
  3. 2S16iWuB: the market maker gives 0.002874 SOL to the agent.
  4. 9N1LZEDu: the SOL leaves NEAR Intents for the user's wallet.

Server and web app

agent/server/ is the API the web app calls: POST /api/chat runs the agent for the signed-in user, and the /api/agent/* routes create the user's agent and the grant the user signs. It checks the Privy access token on every request with Privy's public verification key, so it never needs the Privy app secret.

web/ is the app. PrivyNearSigner plugs the Privy wallet into the near-api-js Signer, so near-api-js builds and hashes NEP-413 messages and NEP-366 delegate actions, the two signatures the Agent API asks an owner for, and Privy signs the hash.

Your limits and Inti's key

Who decides what: you set the funding limits in the contract on your account, authorize or remove Inti's key that can only call fund_agent, and sign your agent's policy, which sends only to you and which you can freeze or unfreeze. Inti's server requests trades with a valid grant and checks the combined spending. Your NEAR Intents agent receives only limited funding.

You keep your full-access key, in your Privy wallet. Inti gets a NEAR function-call key that is scoped to one contract (your own account) and one method (fund_agent), with no deposit allowed.

What Inti's key can do: send one order to your own agent, within your limits.

What Inti's key cannot do, because the network or the contract refuses it:

  • send NEAR or tokens to anyone, including itself;
  • call any method other than fund_agent, or attach a deposit;
  • change your limits or your agent (set_limit, remove_limit and set_agent require 1 yoctoNEAR, which a function-call key cannot attach);
  • choose where an order goes: fund_agent takes no destination, it always pays your agent;
  • add or remove keys, or deploy code.
require!(new_spent <= limit.per_day.0, "over the daily limit");
if (amount > limit.perOrder) return "over_order_limit";
if ((await chain.spentLast24h(account.owner, token)) + amount > limit.perDay) return "over_daily_limit";

agent/server/orders.ts: before it signs an order, Inti reads your limits and what the last 24 hours spent from your own contract. An order over a limit is stopped here, so it never reaches the chain and costs you nothing.

contracts/spending-limits/src/lib.rs: the contract checks again. Before Inti's key sends an order, the contract adds it to what the last 24 hours already sent. If the total would pass your daily limit, the order is refused and nothing moves. Even with Inti's key, nobody can spend more than your limits.

Inti's key also has a gas allowance of 0.25 NEAR (web/src/limits/config.ts), from which it pays each order's network fee. It is one total, not per day, and the dashboard shows what is left under Fees left for Inti. When it runs out, Inti cannot send orders; Pause Inti and then Resume Inti add the key again with a new allowance.

If Inti's key were stolen, the most it could do is send your limits to your own agent, use up the 24 orders of a day, and spend its 0.25 NEAR allowance on fees. Deleting the key ends all three. Because your account keeps its full-access key, it never depends on that allowance and cannot be locked out by it.

We tried this on mainnet on 14 November 2026, with Inti's real key on a real user's account, acting as a thief would:

  1. Send 0.01 NEAR to another wallet. NEAR refused it before it ran, because the key can only call fund_agent: Access key requires full access.
  2. Send a tenth of the user's bitcoin to the same wallet. NEAR refused it before it ran, because the key can call no other contract and attach no deposit: Deposit is not allowed with function call.
  3. Call fund_agent, the one call the key allows, for 1 yoctoNEAR over the per-order limit. The Spending Limits contract refused it on chain: Smart contract panicked: over the per-order limit (Hum36XqT).

The other wallet received nothing. The first two cost no fee and leave no transaction, because NEAR refuses them before they run; the third cost 0.00016 NEAR of gas from Inti's allowance. The check ran once from Inti's server with its real key; its script is not part of this repository.

Terminal output of the three tries, each one stopped, next to the user's portfolio in Inti, which still shows the same bitcoin.

The Agent API adds a second layer: your agent runs under a policy you sign, which only lets it send to your wallet.

Contract details, tests and formal proofs: Spending Limits contract.

Check it yourself

The code builds and its tests pass

With Node 24 and pnpm 11, on a fresh clone and with no .env:

pnpm install
pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm web:build

The contract has its own tests, property runs and formal proofs: see Spending Limits contract.

The contract on mainnet is this code

The contract is verified on SourceScan (verification transaction 9spE94qW). To rebuild it and compare the hash yourself, you need Linux, macOS or WSL, Docker running, and cargo-near (the CLI was tested with 0.23.0; the build itself runs inside the pinned Docker image sourcescan/cargo-near:0.22.0-rust-1.99.1). The build writes its git commit into the wasm, so check out the commit that was deployed, cb3fe63, the one the contract's on-chain metadata names. It takes about 2 minutes.

git clone https://github.com/JaDi03/inti.git
cd inti
git checkout cb3fe63
cd contracts/spending-limits
cargo near build reproducible-wasm
sha256sum target/near/inti_spending_limits.wasm
# ec08c308af218f6d1273a1ae785617d67b9bb3fa3ed95f843a5e1a9c19c3d161

The same hash is in web/src/limits/config.ts, and it matches web/public/inti-spending-limits.wasm, the only build the app installs.

The AI model's hardware, checked live

if (reportData.slice(64) === nonce) passed.add("binds_nonce");
if (reportData.slice(0, 64) === signingAddress.slice(2).padEnd(64, "0")) passed.add("binds_key");

agent/server/attestation.ts: Inti sends NEAR AI a new random challenge and gets back the hardware report of its model. It checks the Intel TDX quote against Intel's own certificates (@phala/dcap-qvl), that the quote carries the challenge and the model's signing key, that the machine is not in debug mode, that its startup log and published setup match what the chip measured, and asks NVIDIA whether the GPU is genuine. The steps follow NEAR AI's verification docs. One recent result is shared by everyone who opens the app; "Verify again" runs a new one.

Each reply, signed

if (sig.text !== `${model}:${call.requestHash}:${call.responseHash}`) return "other_bytes";

agent/server/replyProof.ts: every AI model call behind a reply keeps the SHA-256 of the exact bytes sent and received (agent/brains/nearai.ts). NEAR AI signs those hashes inside the chip; Inti checks that the signature covers them, names the model, and comes from the key the hardware check found.

Together they prove that a genuine, sealed Intel TDX machine with an NVIDIA GPU, running this model, signed each reply. They do not prove which of the model's machines served it (they share one key), which software runs inside beyond its own measurements, or that your messages are hidden: NEAR AI's gateway and Inti's server both see them.

Run your own server

The app and its API on your own server, at https://your-domain.com. You need Ubuntu or Debian (x64, tested on Ubuntu 24.04), a user with sudo, and a domain pointing to the server with ports 80 and 443 open.

git clone https://github.com/JaDi03/inti.git
cd inti
cp .env.example .env && chmod 600 .env
nano .env                       # INTI_SITE and the four keys at the top of the file
sudo bash deploy/install.sh
Key Where it comes from
NEAR_INTENTS_AGENT_API_KEY your partner key for the Agent API
NEAR_AI_API_KEY cloud.near.ai
PRIVY_APP_ID, PRIVY_VERIFICATION_KEY your app in the Privy dashboard

.env.example points the Agent API at https://api.demo.agentsonintents.com. NEAR Intents and the Agent API have no testnet, so orders through that host are real orders on NEAR mainnet.

The script checks .env before it installs anything and says what is missing. It installs Node, pnpm and Caddy, creates Inti's key and the key that encrypts the grants, builds the app, and starts the API behind HTTPS. It ends with Done. Open https://your-domain.com. In the Privy dashboard, add that domain to the app's allowed domains.

To update, or to apply a changed setting, run the same command from the same folder:

cd inti
sudo bash deploy/install.sh

The script first updates the folder with git pull, then installs exactly that commit. It runs as root, so whoever can push to the branch you cloned decides what runs on your server: clone a repository you trust, or your own fork.

.env is merged into /etc/inti/inti.env and removed, so no copy with your keys stays in the folder you cloned. To change a setting, edit that file, or write a new .env with only the settings to change, and run the command again. The key that encrypts the grants is made once and never replaced.

Each install is a new release. If the new one does not start, the previous one keeps running.

What Where
The live release (code, packages and built app), owned by root; the previous one is kept /opt/inti/current, /opt/inti/releases
Where the system user inti-build builds the app; it cannot read any key /var/lib/inti-build
Settings, readable only by root and inti /etc/inti/inti.env
Inti's key and the users' grants, readable only by inti /var/lib/inti
The API, run by the system user inti, which cannot change the code, and restarted if it stops systemd: inti-agent (journalctl -u inti-agent -f)
The app with HTTPS, and /api to the API Caddy: /etc/caddy/inti.caddy

Users authorize Inti's key on their own account. Keep a copy of /var/lib/inti/inti-key.json and of SERVER_GRANT_KEY from /etc/inti/inti.env. To move to a new server without asking users to do it again, copy inti-key.json and grants.json to the new server's /var/lib/inti/, and put SERVER_GRANT_KEY in its .env, before you run the script. It keeps a key and grants that are already there.

To run it on your computer or change the code, see CONTRIBUTING.md.

Project structure

inti/
├── agent/                    the agent: the AI model proposes, the code decides
│   ├── core/
│   │   ├── loop.ts           one chat message: the model picks tools until it has an answer
│   │   ├── tools.ts          the tools the model can call on the practice portfolio
│   │   ├── guard.ts          limits checked in code before any action runs
│   │   ├── money.ts          dollar math in whole micro-dollars, never floats
│   │   ├── portfolio.ts      tokens and prices from the NEAR Intents token list
│   │   ├── sanitize.ts       cleans token names before the model reads them
│   │   └── types.ts          the shapes the loop speaks, whatever the model
│   ├── brains/
│   │   ├── nearai.ts         the model on NEAR AI Cloud, inside a TEE
│   │   └── scripted.ts       a model that follows a script, for tests
│   ├── policy/
│   │   ├── assets.ts         the assets Inti trades, by a fixed name the model picks from
│   │   ├── heldAssets.ts     the assets that stay with the agent (gold, euro, SOL)
│   │   ├── agentPolicy.ts    the policy each agent signs: it sends only to its owner
│   │   ├── build.ts          builds that policy in human units
│   │   ├── verify.ts         checks a live policy matches the one the user signed
│   │   └── units.ts          exact decimal to token-unit conversion
│   ├── server/
│   │   ├── index.ts          starts the server from the environment
│   │   ├── app.ts            the routes the web app calls
│   │   ├── config.ts         settings and every cap on use and cost
│   │   ├── auth.ts           checks the Privy sign-in on every request
│   │   ├── realTools.ts      the tools the model gets with real money
│   │   ├── trading.ts        buys, sells and price orders for one user
│   │   ├── orders.ts         one order end to end: fund the agent, swap, send home
│   │   ├── agentCash.ts      trades paid with what the agent already holds
│   │   ├── held.ts           buying and selling the assets the agent keeps
│   │   ├── spendLog.ts       what Inti sent in the last 24 hours, checked before the contract
│   │   ├── agents.ts         creates and finds each user's agent on the Agent API
│   │   ├── grants.ts         the trading permission each user signs, stored encrypted
│   │   ├── dashboard.ts      the agent's balances, open orders and signed rules
│   │   ├── attestation.ts    checks the model runs on attested hardware
│   │   ├── replyProof.ts     checks each reply was signed inside the TEE
│   │   ├── chatJobs.ts       a message's progress while it runs
│   │   ├── quota.ts          messages per user and per day
│   │   └── dryRun.ts         the dry run: practice wallet, live quotes, nothing moves
│   └── cli/new-key.ts        creates Inti's function-call key for a server
├── contracts/spending-limits/
│   ├── src/lib.rs            the contract on the user's own account: limits and fund_agent
│   ├── tests/                unit, property and sandbox tests
│   └── verification/         formal proofs (Kani) of the limit arithmetic
├── web/src/
│   ├── landing/              the landing page
│   ├── dryrun/               the dry run page at /try
│   ├── dashboard/            portfolio, receive, grant renewal, price protection
│   ├── limits/               Spending Limits: activation, limits, passkey, signing
│   ├── agent/                create the agent, sign the grant, freeze
│   ├── chat/                 the chat and its messages
│   ├── assets/               the assets panel
│   ├── verify/               the AI hardware badge and each reply's signature
│   └── privySigner.ts        lets near-api-js sign with the Privy wallet
├── deploy/                   install.sh and the server files it sets up
└── docs/                     diagrams and images used in this README

Tech stack

Built during the NEAR hackathon

Inti was written from scratch for the NEAR hackathon (build window 1 to 14 November 2026). The first commit is from 5 November 2026, and every change since is in the commit history. No code from an earlier product is reused, and no other project of ours is entered in this hackathon. Open-source libraries are the ones listed under Tech stack.

Tracks it is built for: AI Security & Defense (spending limits, a function-call key, TEE attestation), Unstoppable DeFi (trading through NEAR Intents with no custodian) and Privacy & Private AI (the model runs in a TEE, the agent trades from a confidential balance).

License

MIT, see LICENSE.

About

AI investment agent on NEAR. Type what you want; your own agent trades on NEAR Intents, the AI runs in a TEE on NEAR AI Cloud, and a contract on your account refuses anything over your limits.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages