UNPKG

@statelyai/agent

Version:

Stateful agents that make decisions based on finite-state machine models

23 lines (18 loc) 605 B
import { Agent, AgentPlan, AgentPlanInput, AnyAgent } from '../types'; import { getShortestPaths } from '@xstate/graph'; export async function simplePlanner<T extends AnyAgent>( agent: T, input: AgentPlanInput<any> ): Promise<AgentPlan<any> | undefined> { // 1. Determine goal state criteria // e.g. a state where the agent has won a game void 0; // 2. Determine possible events that can occur void 0; // 3. Get shortest paths from current state to // a state matching the criteria, using // possible events void 0; // 4. Return shortest path as a plan return null as any; }