🏃Runtime
Key Methods:
initialize(): Sets up the agent's runtime environment, including services, plugins, and knowledge processing.processActions(): Executes actions based on message content and state.evaluate(): Assesses messages and state using registered evaluators.composeState(): Constructs the agent's state object for response generation.updateRecentMessageState(): Updates the state with recent messages and attachments.registerService(): Adds a service to the runtime.registerMemoryManager(): Registers a memory manager for specific types of memories.ensureRoomExists()/ensureUserExists(): Ensures the existence of rooms and users in the database.
State Management:
Copy
interface State {
// Core identifiers
userId?: UUID;
agentId?: UUID;
roomId: UUID;
// Character information
bio: string;
lore: string;
messageDirections: string;
postDirections: string;
// Conversation context
actors: string;
actorsData?: Actor[];
recentMessages: string;
recentMessagesData: Memory[];
// Goals and knowledge
goals?: string;
goalsData?: Goal[];
knowledge?: string;
knowledgeData?: KnowledgeItem[];
ragKnowledgeData?: RAGKnowledgeItem[];
}
// State management methods
async function manageState() {
// Initial state composition
const state = await runtime.composeState(message, {
additionalContext: "custom context"
});
// Update state with new messages
const updatedState = await runtime.updateRecentMessageState(state);
}Last updated