Skip to content

Commit 5d174dc

Browse files
committed
Log trace when agent errors
1 parent f22879e commit 5d174dc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

evals/git-evals2/judge.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,30 @@ ${agentDiff || '(No changes made)'}
165165
\`\`\`
166166
${error ? `\n## Error Encountered\n${error}` : ''}`
167167

168+
const agentOutput: string[] = []
168169
const judgeResult = await client.run({
169170
agent: 'git-evals2-judge',
170171
prompt: judgePrompt,
171172
agentDefinitions: [judgeAgent],
173+
handleEvent: (event) => {
174+
if (event.type === 'text') {
175+
agentOutput.push(event.text)
176+
}
177+
else if (event.type === 'tool_call') {
178+
agentOutput.push(JSON.stringify(event, null, 2))
179+
}
180+
},
172181
})
173182

174183
if (judgeResult.output.type !== 'structuredOutput') {
175184
console.error(
176185
'Error running judge agent - not structured output',
177186
JSON.stringify(judgeResult.output, null, 2),
178187
)
188+
console.error(
189+
'Judge agent output trace:',
190+
agentOutput.join(''),
191+
)
179192
return {
180193
analysis: 'Error running judge agent - not structured output',
181194
strengths: [],

evals/git-evals2/trace-analyzer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,18 @@ Analyze how these agents approached the problem, focusing on their processes and
247247
248248
Focus on the HOW, not the WHAT: We want to understand and improve how agents work, not evaluate their specific code output.`
249249

250+
const agentOutput: string[] = []
250251
const analyzerResult = await client.run({
251252
agent: 'git-evals2-trace-analyzer',
252253
prompt,
253254
agentDefinitions: [traceAnalyzerAgent],
255+
handleEvent: (event) => {
256+
if (event.type === 'text') {
257+
agentOutput.push(event.text)
258+
} else if (event.type === 'tool_call') {
259+
agentOutput.push(JSON.stringify(event, null, 2))
260+
}
261+
},
254262
})
255263

256264
const { output } = analyzerResult
@@ -260,6 +268,7 @@ Focus on the HOW, not the WHAT: We want to understand and improve how agents wor
260268
'Error running trace analyzer - not structured output',
261269
JSON.stringify(output, null, 2),
262270
)
271+
console.error('Trace analyzer output trace:', agentOutput.join(''))
263272
return {
264273
overallAnalysis: 'Error running trace analyzer - not structured output',
265274
agentFeedback: [],

0 commit comments

Comments
 (0)