Programmatic agents
Install with npm ci, copy .env.example to .env, then set AI_PROVIDER, AI_MODEL, and your provider API key. No model name is hardcoded: use one available to your account.
import { runAgent } from "../src/agent.js";
const result = await runAgent("Show the latest ZetaChain EVM blocks and explain the gas price.");
console.log(result.text);
runAgent discovers the live catalog and selects a default set of common read/preparation tools. Pass { toolNames: ["get_supported_networks", "get_balance"] } as the second argument to choose up to 64 tools for a specific workflow. This keeps the request within provider tool limits. Unknown or mutating tools are rejected. The agent stops after eight steps and closes the MCP connection even on failure. AI requests have a two-minute limit. It does not load wallet keys and does not expose signing, broadcast or contract-verification tools to the model.
Example prompts:
- “Inspect this public EVM address: 0x…; separate ZETA from ERC-20 balances.”
- “Explain the status and receipt of transaction 0x…; distinguish missing index data from failure.”
- “Prepare a 0.001 ZETA transfer from 0x… to 0x…; do not execute it.”
- “Show the validator statistics for zetavaloper1….”
Replace address placeholders with your intended values. For direct deterministic calls without AI:
import { callTool, withMcp } from "../src/mcp.js";
await withMcp(async client => {
console.log(await callTool(client, "get_supported_networks"));
});
The lower-level callTool is not restricted to read-only operations; scripts using it are responsible for explicit authorization. The CLI asks before executing mutating tools. AI SDK reference