Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Build with Altana

Run a portfolio with multiple agents

What you need
Goal
I want a portfolio wallet run by more than one agent, each with its own job, all transparent and revocable.
Who it's for
Developers running several agents on one wallet, each with a different job and its own limits.
What you'll use
grantSession twice with complementary scopes, execute, the Keystore read for mutual verification, revokeSession.
Prerequisites
A smart agentic wallet set up in Give an agent a wallet and a policy, funded on BNB.

Two agents share one wallet, each with its own scoped session. You grant them separately, they can verify each other, and you can revoke either one without touching the other.

Step 1: Connect as the wallet admin

One shared wallet, and you hold the admin key.
Each agent will get its own session with a separate job.

import {
  createClient,
  BNB,
  signerFromPrivateKey,
} from "@altananetwork/sdk";
 
const client = createClient({ chains: [BNB] });
const signer = signerFromPrivateKey(process.env.PRIVATE_KEY as `0x${string}`);
 
// One shared wallet, the operator is admin. Two agents, separated duties.

Step 2: Grant Agent A a session for swaps

Agent A can reach only the PancakeSwap router, capped at X per day.
It cannot touch anything else on the wallet.

// Agent A: swaps on PancakeSwap, cap X.
const sessionA = await client.grantSession({
  wallet,
  signer,
  permissions: {
    calls: [{ to: "0xPancakeRouter..." }],
    spend: [{ limit: capX, period: "day", token: "0xStable..." }],
  },
  expiry,
});

Step 3: Grant Agent B a session for lending

Agent B gets a separate key scoped to the lending pool, capped at Y.
The two agents' scopes never overlap.

// Agent B: lending / rebalance, cap Y.
const sessionB = await client.grantSession({
  wallet,
  signer,
  permissions: {
    calls: [{ to: "0xLendingPool..." }],
    spend: [{ limit: capY, period: "day", token: "0xStable..." }],
  },
  expiry,
});

Step 4: Verify and revoke independently

Each agent can confirm the other is still authorized with a free Keystore read.
When you revoke one agent's key, the other keeps working.

// Before coordinating, Agent B can verify Agent A is still authorized
// using the Keystore read from the "Verify agent authority" guide.
 
// Revoke Agent A without touching Agent B:
await client.revokeSession({ wallet, signer, session: sessionA });
// Agent B keeps working.

Why it is different

Multiple agents on one wallet with divided, independently verifiable, independently revocable authority. Agent-to-agent verification uses only your own agents, with nothing external to set up.

What's next