Skip to content

Commit 6225e20

Browse files
committed
add tool results for spawn_agents_async message input
1 parent 9696c5d commit 6225e20

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

backend/src/tools/handlers/spawn-agents-async.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ASYNC_AGENTS_ENABLED } from '@codebuff/common/constants'
12
import { CodebuffMessage } from '@codebuff/common/types/message'
23
import {
34
AgentState,
@@ -12,7 +13,6 @@ import { agentRegistry } from '../../templates/agent-registry'
1213
import { AgentTemplate } from '../../templates/types'
1314
import { logger } from '../../util/logger'
1415
import { CodebuffToolCall, CodebuffToolHandlerFunction } from '../constants'
15-
import { ASYNC_AGENTS_ENABLED } from '@codebuff/common/constants'
1616
import { handleSpawnAgents } from './spawn-agents'
1717

1818
export const handleSpawnAgentsAsync = ((params: {
@@ -92,15 +92,6 @@ export const handleSpawnAgentsAsync = ((params: {
9292
agentRegistry.initialize(fileContext)
9393
const allTemplates = agentRegistry.getAllTemplates()
9494

95-
const conversationHistoryMessage: CoreMessage = {
96-
role: 'user',
97-
content: `For context, the following is the conversation history between the user and an assistant:\n\n${JSON.stringify(
98-
mutableState.messages,
99-
null,
100-
2
101-
)}`,
102-
}
103-
10495
const triggerSpawnAgentsAsync = async () => {
10596
const results: Array<{
10697
agentType: string
@@ -109,6 +100,15 @@ export const handleSpawnAgentsAsync = ((params: {
109100
error?: string
110101
}> = []
111102

103+
const conversationHistoryMessage: CoreMessage = {
104+
role: 'user',
105+
content: `For context, the following is the conversation history between the user and an assistant:\n\n${JSON.stringify(
106+
mutableState.messages,
107+
null,
108+
2
109+
)}`,
110+
}
111+
112112
// Validate and spawn agents asynchronously
113113
for (const { agent_type: agentTypeStr, prompt, params } of agents) {
114114
try {

0 commit comments

Comments
 (0)