Skip to content

Commit 6bec422

Browse files
committed
includeMessageHistory defaults to false! Tell codebuff whether the spawned agent has access to the message history
1 parent 898e5be commit 6bec422

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

backend/src/templates/prompts.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { getAgentTemplate } from './agent-registry'
44

55
import type { AgentTemplate } from '@codebuff/common/types/agent-template'
66
import type { AgentTemplateType } from '@codebuff/common/types/session-state'
7+
import { buildArray } from '@codebuff/common/util/array'
78

89
export async function buildSpawnableAgentsDescription(
910
spawnableAgents: AgentTemplateType[],
@@ -31,15 +32,19 @@ prompt: {"description": "A coding task to complete", "type": "string"}
3132
params: None`
3233
}
3334
const { inputSchema } = agentTemplate
34-
if (!inputSchema) {
35-
return `- ${agentType}: ${agentTemplate.spawnerPrompt}
36-
prompt: None
37-
params: None`
38-
}
39-
const { prompt, params } = inputSchema
40-
return `- ${agentType}: ${agentTemplate.spawnerPrompt}
41-
prompt: ${schemaToJsonStr(prompt)}
42-
params: ${schemaToJsonStr(params)}`
35+
const inputSchemaStr = inputSchema
36+
? [
37+
`prompt: ${schemaToJsonStr(inputSchema.prompt)}`,
38+
`params: ${schemaToJsonStr(inputSchema.params)}`,
39+
].join('\n')
40+
: ['prompt: None', 'params: None'].join('\n')
41+
42+
return buildArray(
43+
`- ${agentType}: ${agentTemplate.spawnerPrompt}`,
44+
agentTemplate.includeMessageHistory &&
45+
'This agent can see the current message history.',
46+
inputSchemaStr,
47+
).join('\n')
4348
})
4449
.filter(Boolean)
4550
.join('\n\n')

backend/src/templates/strings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export async function getAgentPrompt<T extends StringField>(
157157

158158
let addendum = ''
159159

160-
// Add parent instructions for instructionsPrompt
160+
// Add tool instructions, spawnable agents, and output schema prompts to instructionsPrompt
161161
if (promptType.type === 'instructionsPrompt' && agentState.agentType) {
162162
addendum +=
163163
'\n\n' +

common/src/types/dynamic-agent-template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const DynamicAgentDefinitionSchema = z.object({
124124

125125
// Input and output
126126
inputSchema: InputSchemaObjectSchema,
127-
includeMessageHistory: z.boolean().default(true),
127+
includeMessageHistory: z.boolean().default(false),
128128
outputMode: z
129129
.enum(['last_message', 'all_messages', 'structured_output'])
130130
.default('last_message'),

0 commit comments

Comments
 (0)