Skip to main content
Lucid agents follow a plan → accomplish → execute → validate lifecycle, with every step generating verifiable receipts.

Initialize an Agent

const agent = await lucid.agents.init({
  name: "research-agent",
  passportId: "passport_agent_123",
  capabilities: ["web-search", "summarization", "code-generation"]
});

Plan a Goal

const plan = await lucid.agents.plan({
  agentId: agent.id,
  goal: "Research the latest advances in quantum computing and summarize the top 5 breakthroughs"
});

console.log("Steps:", plan.steps.length);
plan.steps.forEach((step, i) => console.log(`  ${i + 1}. ${step.description}`));

Execute the Plan

const execution = await lucid.agents.execute({
  agentId: agent.id,
  planId: plan.id
});

console.log("Status:", execution.status);
console.log("Results:", execution.results);
console.log("Receipts:", execution.receiptIds); // Every step has a receipt!

Validate Results

const validation = await lucid.agents.validate({
  agentId: agent.id,
  executionId: execution.id
});

console.log("Valid:", validation.valid);
console.log("Score:", validation.qualityScore);

Verify Agent History

// Full audit trail
const history = await lucid.agents.history(agent.id);

// MMR root for all agent receipts
const root = await lucid.agents.root(agent.id);