
Loading...

Loading...
Capability ยท Agent
A tool-calling loop on any LightChain model - no native function-calling needed. The model thinks, calls a tool, reads the observation, repeats. Run it LIVE with your wallet below (each reasoning step is one user-paid inference), or copy the Node setup.
Toggle the tools the model may call. Add your own in code.
The live agent drives the SDK's own Agent loop with your wallet as the inference backend - the same code below, in the browser.
import { Agent } from "lightnode-sdk";
const agent = new Agent({
network: "mainnet",
privateKey: process.env.PRIVATE_KEY,
maxIterations: 4,
tools: [
{
name: "add",
description: "Add two numbers",
args: { a: "number", b: "number" },
handler: ({ a, b }) => Number(a) + Number(b),
},
{
name: "now",
description: "Current ISO timestamp",
args: {},
handler: () => new Date().toISOString(),
},
],
});
const { answer, steps } = await agent.run("What is 21 + 21, and what time is it now?");
console.log(answer);
console.log(steps.map((s) => s.kind)); // thought / tool_call / answerScaffold it into your project: npx lightnode add agent.