Evaluators
Evaluators are components that assess and extract information from conversations, helping agents build long-term memory and track goal progress. They analyze conversations to extract facts, update goals, and maintain agent state.
Overview
Evaluators help agents:
- Extract useful information from conversations
- Track progress toward goals
- Build long-term memory
- Maintain context awareness
Built-in Evaluators
Fact Evaluator
The fact evaluator extracts factual information from conversations for long-term memory storage.
interface Fact {
claim: string;
type: 'fact' | 'opinion' | 'status';
in_bio: boolean;
already_known: boolean;
}
Fact Types
fact
: True statements about the world or character that don't changestatus
: Facts that are true but may change over timeopinion
: Non-factual opinions, thoughts, feelings, or recommendations
Example Facts:
[
{
"claim": "User lives in Oakland",
"type": "fact",
"in_bio": false,
"already_known": false
},
{
"claim": "User completed marathon in 3 hours",
"type": "fact",
"in_bio": false,
"already_known": false
},
{
"claim": "User is proud of their achievement",
"type": "opinion",
"in_bio": false,
"already_known": false
}
]
Goal Evaluator
The goal evaluator tracks progress on agent goals and objectives.
interface Goal {
id: string;
name: string;
status: 'IN_PROGRESS' | 'DONE' | 'FAILED';
objectives: Objective[];
}
interface Objective {
description: string;
completed: boolean;
}
Goal Updates
- Monitors conversation for goal progress
- Updates objective completion status
- Marks goals as complete when all objectives are done
- Marks goals as failed when they cannot be completed
Example Goal:
{
"id": "goal-123",
"name": "Complete Marathon Training",
"status": "IN_PROGRESS",
"objectives": [
{
"description": "Run 30 miles per week",
"completed": true
},
{
"description": "Complete practice half-marathon",
"completed": false
}
]
}
Creating Custom Evaluators
To create a custom evaluator, implement the Evaluator interface:
interface Evaluator {
name: string;
similes: string[];
description: string;
validate: (runtime: IAgentRuntime, message: Memory) => Promise<boolean>;
handler: (
runtime: IAgentRuntime,
message: Memory,
state?: State,
options?: any
) => Promise<any>;
examples: EvaluatorExample[];
}
Example custom evaluator:
const customEvaluator: Evaluator = {
name: "CUSTOM_EVALUATOR",
similes: ["ALTERNATE_NAME"],
description: "Evaluates something in the conversation",
validate: async (runtime, message) => {
// Determine if evaluation should run
return true;
},
handler: async (runtime, message, state, options) => {
// Evaluation logic
return evaluationResult;
},
examples: [
// Example inputs and outputs
]
};