Advanced Workflow

  1. Start Leia AI Agent:

bun start --advanced --agent-type "strategy-agent"
  1. Load Game Context:

const gameContext = {
  playerID: "0xabcdef1234567890",
  resources: { gold: 500, wood: 100 },
  turn: 7,
  availableActions: ["build", "attack", "trade"],
};

leia.loadContext(gameContext);

Goal Execution:

const goal = {
  description: "Build a fortress to protect resources",
  subgoals: [
    { action: "GATHER_RESOURCES", conditions: { wood: 200, stone: 100 } },
    { action: "BUILD_FORTRESS", conditions: { location: [50, 75], resourcesSpent: { wood: 150, stone: 100 } } },
  ],
};

leia.executeGoal(goal);

Dynamic Monitoring:

// Monitoring agent's actions and reasoning
leia.on("action:start", (data) => {
  console.log(`🔄 Agent action started: ${data.action}`);
});

leia.on("action:complete", (data) => {
  console.log(`✅ Action completed: ${data.action.type} with result: ${data.result}`);
});

Last updated