UNPKG

tinyagent-ts

Version:

Modern TypeScript framework for building AI agents with pluggable tools and ReAct reasoning

26 lines (25 loc) 764 B
import { ReActState, ReActStep, ActionStep } from './types'; import { LLMMessage } from '../model'; /** * Implementation of ReAct state management */ export declare class ReActStateManager implements ReActState { private task; private steps; setTask(text: string): void; getTask(): string; clear(): void; addThought(text: string): void; addAction(action: ActionStep): void; addObservation(text: string): void; addReflexion(text: string): void; getSteps(): ReActStep[]; /** * Get the last argument value used for a specific key in any tool call. */ getLastArgValue(argKey: string): unknown; /** * Convert state to LLM messages format */ toMessages(systemPrompt: string): LLMMessage[]; }