Skip to content

Commit 6508f8e

Browse files
committed
Make stepPrompt optional!
1 parent bee3d45 commit 6508f8e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AgentConfig } from '../util/agent-config'
55

66
// Filter models to only include those that begin with allowed prefixes
77
const filteredModels = Object.values(models).filter((model) =>
8-
ALLOWED_MODEL_PREFIXES.some((prefix) => model.startsWith(prefix))
8+
ALLOWED_MODEL_PREFIXES.some((prefix) => model.startsWith(prefix)),
99
)
1010

1111
if (filteredModels.length === 0) {
@@ -33,13 +33,13 @@ const JsonSchemaSchema: z.ZodType<any> = z.lazy(() =>
3333
description: z.string().optional(),
3434
enum: z.array(z.any()).optional(),
3535
})
36-
.passthrough()
37-
)
36+
.passthrough(),
37+
),
3838
)
3939
.optional(),
4040
required: z.array(z.string()).optional(),
4141
})
42-
.passthrough()
42+
.passthrough(),
4343
)
4444

4545
// Schema for the combined inputSchema object
@@ -75,7 +75,7 @@ const HandleStepsSchema = z
7575
}),
7676
prompt: z.string().optional(),
7777
params: z.any().optional(),
78-
})
78+
}),
7979
)
8080
.returns(z.any())
8181
.optional()
@@ -86,7 +86,7 @@ export const DynamicAgentConfigSchema = z.object({
8686
.string()
8787
.regex(
8888
/^[a-z0-9-]+$/,
89-
'Agent ID must contain only lowercase letters, numbers, and hyphens'
89+
'Agent ID must contain only lowercase letters, numbers, and hyphens',
9090
), // The unique identifier for this agent
9191
version: z.string().optional(),
9292

@@ -104,20 +104,20 @@ export const DynamicAgentConfigSchema = z.object({
104104
if (!tools) return true
105105
const validToolNames = toolNames as readonly string[]
106106
const invalidTools = tools.filter(
107-
(tool) => !validToolNames.includes(tool)
107+
(tool) => !validToolNames.includes(tool),
108108
)
109109
return invalidTools.length === 0
110110
},
111111
(tools) => {
112112
if (!tools) return { message: 'Tools array is undefined' }
113113
const validToolNames = toolNames as readonly string[]
114114
const invalidTools = tools.filter(
115-
(tool) => !validToolNames.includes(tool)
115+
(tool) => !validToolNames.includes(tool),
116116
)
117117
return {
118118
message: `Invalid tool names: ${invalidTools.join(', ')}. Available tools: ${toolNames.join(', ')}`,
119119
}
120-
}
120+
},
121121
),
122122
subagents: z.array(z.string()).optional().default([]),
123123

@@ -133,7 +133,7 @@ export const DynamicAgentConfigSchema = z.object({
133133
parentPrompt: z.string().optional(),
134134
systemPrompt: z.string().optional(),
135135
instructionsPrompt: z.string().optional(),
136-
stepPrompt: z.string(),
136+
stepPrompt: z.string().optional(),
137137
// NOTE: Removed from AgentConfig. If there's a need, can be added back or else removed entirely.
138138
parentInstructions: z.record(z.string(), z.string()).optional(),
139139

@@ -166,7 +166,7 @@ export const DynamicAgentTemplateSchema = DynamicAgentConfigSchema.extend({
166166
message:
167167
"outputSchema can only be used with outputMode 'json'. Remove outputMode or set it to 'json'.",
168168
path: ['outputMode'],
169-
}
169+
},
170170
)
171171
.refine(
172172
(data) => {
@@ -183,6 +183,6 @@ export const DynamicAgentTemplateSchema = DynamicAgentConfigSchema.extend({
183183
message:
184184
"outputMode 'json' requires the 'set_output' tool. Add 'set_output' to toolNames.",
185185
path: ['toolNames'],
186-
}
186+
},
187187
)
188188
export type DynamicAgentTemplate = z.infer<typeof DynamicAgentTemplateSchema>

common/src/util/agent-config.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export interface AgentConfig {
6161

6262
/** Prompt inserted at each agent step. Powerful for changing the agent's behavior,
6363
* but usually not necessary for smart models. Prefer instructionsPrompt for most instructions. */
64-
stepPrompt: string
64+
stepPrompt?: string
6565

6666
// ============================================================================
6767
// Input and Output

0 commit comments

Comments
 (0)