Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

1.3 KB
Raw Blame
// `list_agent_wallets`: every agent this owner has on this network, with live
// balances. One RPC round per agent, so it stays honest rather than fast.

import { z } from 'zod';

import { NETWORK } from '../config.js';
import { listAgents } from '../lib/store.js';
import { agentContext, describeAgent } from '../lib/agent.js';

export const def = {
	name: 'list_agent_wallets',
	title: 'Every agent wallet on this machine',
	annotations: { readOnlyHint: true, idempotentHint: false, openWorldHint: true },
	description:
		'List the agent wallets configured here, each with its live vault balance, remaining on-chain allowance, and ' +
		'guardrails. Read-only.',
	inputSchema: {
		owner: z.string().optional().describe('Only agents belonging to this owner address.'),
	},
	async handler(args) {
		const records = listAgents().filter((r) => !args.owner || r.owner === args.owner);
		const agents = [];
		for (const record of records) {
			try {
				agents.push(describeAgent(await agentContext(record.id)));
			} catch (err) {
				agents.push({ id: record.id, owner: record.owner, error: err.message, code: err.code || 'unreadable' });
			}
		}
		return {
			ok: true,
			network: NETWORK,
			count: agents.length,
			agents,
			...(agents.length === 0
				? { empty: 'No agent wallets yet. Run create_agent_wallet to give an agent a spending allowance.' }
				: {}),
		};
	},
};