@@ -33,34 +33,34 @@ export async function agentTodo(): Promise<agentTodoOutput> {
3333 tools,
3434 } ) ;
3535
36- messages . push ( { role : "assistant" , content : result . content } ) ;
36+ messages . push ( result ) ;
3737
3838 if ( result . tool_calls ) {
39+ log . info ( "result.tool_calls" , { result } ) ;
3940 for ( const toolCall of result . tool_calls ) {
4041 switch ( toolCall . function . name ) {
4142 case "createTodo" :
43+ log . info ( "createTodo" , { toolCall } ) ;
4244 const toolResult = await step < typeof functions > ( { } ) . createTodo (
4345 JSON . parse ( toolCall . function . arguments )
4446 ) ;
4547
4648 messages . push ( {
4749 role : "tool" ,
4850 tool_call_id : toolCall . id ,
49- content : JSON . stringify ( toolResult ) ,
51+ content : toolResult ,
5052 } ) ;
5153
5254 const toolChatResult = await step < typeof functions > ( { } ) . llmChat ( {
5355 messages,
5456 tools,
5557 } ) ;
5658
57- messages . push ( {
58- role : "assistant" ,
59- content : toolChatResult . content ,
60- } ) ;
59+ messages . push ( toolChatResult ) ;
6160
6261 break ;
6362 case "executeTodoWorkflow" :
63+ log . info ( "executeTodoWorkflow" , { toolCall } ) ;
6464 const workflowId = `executeTodoWorkflow-${ new Date ( ) . getTime ( ) } ` ;
6565 const workflowResult = await childExecute ( {
6666 child : executeTodoWorkflow ,
@@ -81,10 +81,7 @@ export async function agentTodo(): Promise<agentTodoOutput> {
8181 }
8282 ) ;
8383
84- messages . push ( {
85- role : "assistant" ,
86- content : toolWorkflowResult . content ,
87- } ) ;
84+ messages . push ( toolWorkflowResult ) ;
8885
8986 break ;
9087 default :
0 commit comments