@@ -2,6 +2,7 @@ import type { AgentStep } from './agent-runner'
22import type { JudgingResult } from './judge'
33import type { AgentDefinition } from '../../sdk/src'
44import type { CodebuffClient } from '../../sdk/src/client'
5+ import { withTimeout } from '@codebuff/common/util/promise'
56
67export interface AgentTraceData {
78 agentId : string
@@ -140,7 +141,8 @@ const traceAnalyzerAgent: AgentDefinition = {
140141 recommendations : {
141142 type : 'array' ,
142143 items : { type : 'string' } ,
143- description : 'Recommendations for improving this agent and it\'s process. Note: do not include recommendations for improving the code in this task' ,
144+ description :
145+ "Recommendations for improving this agent and it's process. Note: do not include recommendations for improving the code in this task" ,
144146 } ,
145147 } ,
146148 required : [ 'agentId' , 'strengths' , 'weaknesses' , 'recommendations' ] ,
@@ -238,20 +240,24 @@ Analyze how these agents approached the problem, focusing on their processes and
238240Focus on the HOW, not the WHAT: We want to understand and improve how agents work, not evaluate their specific code output.`
239241
240242 const agentOutput : string [ ] = [ ]
241- const analyzerResult = await client . run ( {
242- agent : 'git-evals2-trace-analyzer' ,
243- prompt,
244- agentDefinitions : [ traceAnalyzerAgent ] ,
245- handleEvent : ( event ) => {
246- if ( event . type === 'text' ) {
247- agentOutput . push ( event . text )
248- } else if ( event . type === 'tool_call' ) {
249- agentOutput . push ( JSON . stringify ( event , null , 2 ) )
250- } else if ( event . type === 'error' ) {
251- console . warn ( '[Trace Analyzer] Error event:' , event . message )
252- }
253- } ,
254- } )
243+ const analyzerResult = await withTimeout (
244+ client . run ( {
245+ agent : 'git-evals2-trace-analyzer' ,
246+ prompt,
247+ agentDefinitions : [ traceAnalyzerAgent ] ,
248+ handleEvent : ( event ) => {
249+ if ( event . type === 'text' ) {
250+ agentOutput . push ( event . text )
251+ } else if ( event . type === 'tool_call' ) {
252+ agentOutput . push ( JSON . stringify ( event , null , 2 ) )
253+ } else if ( event . type === 'error' ) {
254+ console . warn ( '[Trace Analyzer] Error event:' , event . message )
255+ }
256+ } ,
257+ } ) ,
258+ 10 * 60 * 1000 ,
259+ 'Trace analyzer agent timed out after 10 minutes' ,
260+ )
255261
256262 const { output } = analyzerResult
257263
0 commit comments