Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions src/cli/operations/eval/__tests__/run-eval.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,42 @@ describe('handleRunEval', () => {
);
});

it('resolves Builtin skill evaluators to TOOL_CALL level', async () => {
const ctx = makeDeployedContext();
mockLoadDeployedProjectConfig.mockResolvedValue(ctx);
mockResolveAgent.mockReturnValue({
success: true,
agent: {
agentName: 'my-agent',
targetName: 'dev',
region: 'us-east-1',
accountId: '111222333444',
runtimeId: 'rt-123',
},
});

const spanRows = [makeToolCallSpanRow('session-1', 'trace-1', 'span-tool-1', 'calculator')];
setupCloudWatchToReturn(spanRows);

mockEvaluate.mockResolvedValue({
evaluationResults: [{ value: 1.0, context: { spanContext: { sessionId: 'session-1', spanId: 'span-tool-1' } } }],
});

// Builtin.SkillSelectionAccuracy / SkillInstructionFollowing are TOOL_CALL-level — they must
// target spans, not default to SESSION (which would send no targetSpanIds).
const result = await handleRunEval({
evaluator: ['Builtin.SkillSelectionAccuracy', 'Builtin.SkillInstructionFollowing'],
days: 7,
});

expect(result.success).toBe(true);
expect(mockEvaluate).toHaveBeenCalledWith(
expect.objectContaining({
targetSpanIds: ['span-tool-1'],
})
);
});

it('batches targetSpanIds into chunks of 10 for TOOL_CALL evaluators', async () => {
const ctx = makeDeployedContext();
mockLoadDeployedProjectConfig.mockResolvedValue(ctx);
Expand Down
4 changes: 4 additions & 0 deletions src/cli/operations/eval/run-eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ const BUILTIN_EVALUATOR_LEVELS: Record<string, EvaluatorLevel> = {
'Builtin.InstructionFollowing': 'TRACE',
'Builtin.Refusal': 'TRACE',
'Builtin.ToolSelectionAccuracy': 'TOOL_CALL',
// Skill evaluators judge the span that carries a skill invocation, so they are TOOL_CALL —
// not the SESSION default an unmapped Builtin.* falls through to, which would score wrong spans.
'Builtin.SkillSelectionAccuracy': 'TOOL_CALL',
'Builtin.SkillInstructionFollowing': 'TOOL_CALL',
};

/**
Expand Down
6 changes: 6 additions & 0 deletions src/cli/tui/screens/evaluator/__tests__/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ describe('LEVEL_PLACEHOLDERS', () => {
expect(LEVEL_PLACEHOLDERS.TOOL_CALL).toContain('context');
expect(LEVEL_PLACEHOLDERS.TOOL_CALL).toContain('tool_turn');
});

it('TOOL_CALL exposes skill placeholders for skill evaluators', () => {
expect(LEVEL_PLACEHOLDERS.TOOL_CALL).toContain('available_skills');
expect(LEVEL_PLACEHOLDERS.TOOL_CALL).toContain('invoked_skill');
expect(LEVEL_PLACEHOLDERS.TOOL_CALL).toContain('skill_content');
});
});

describe('DEFAULT_INSTRUCTIONS', () => {
Expand Down
5 changes: 4 additions & 1 deletion src/cli/tui/screens/evaluator/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export function getEvaluatorModelOptions(provider: EvaluatorModelProvider): Eval
export const LEVEL_PLACEHOLDERS: Record<EvaluationLevel, string[]> = {
SESSION: ['context', 'available_tools'],
TRACE: ['context', 'assistant_turn'],
TOOL_CALL: ['available_tools', 'context', 'tool_turn'],
TOOL_CALL: ['available_tools', 'context', 'tool_turn', 'available_skills', 'invoked_skill', 'skill_content'],
};

/**
Expand All @@ -218,6 +218,9 @@ export const PLACEHOLDER_DESCRIPTIONS: Record<string, string> = {
expected_tool_trajectory: 'caller-provided expected sequence of tool calls',
actual_tool_trajectory: 'actual sequence of tool calls from the session',
expected_response: 'caller-provided expected agent response',
available_skills: 'skills offered to the agent (name + description)',
invoked_skill: 'the skill the agent selected for this span',
skill_content: "the selected skill's SKILL.md instructions",
};

/**
Expand Down