Skip to content

Commit 18fecb7

Browse files
committed
do not do zod validation for programmatic step
1 parent 7ee636a commit 18fecb7

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

backend/src/run-programmatic-step.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ export async function runProgrammaticStep(
232232
state,
233233
userId,
234234
autoInsertEndStepParam: true,
235+
validateInputSchema: false,
235236
})
236237

237238
// TODO: Remove messages from state and always use agentState.messageHistory.

backend/src/tools/tool-executor.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export interface ExecuteToolCallParams<T extends string = ToolName> {
126126
state: Record<string, any>
127127
userId: string | undefined
128128
autoInsertEndStepParam?: boolean
129+
validateInputSchema?: boolean
129130
}
130131

131132
export function executeToolCall<T extends ToolName>({
@@ -145,15 +146,16 @@ export function executeToolCall<T extends ToolName>({
145146
state,
146147
userId,
147148
autoInsertEndStepParam = false,
149+
validateInputSchema = true
148150
}: ExecuteToolCallParams<T>): Promise<void> {
149-
const toolCall: CodebuffToolCall<T> | ToolCallError = parseRawToolCall<T>(
151+
const toolCall: CodebuffToolCall<T> | ToolCallError = validateInputSchema ? parseRawToolCall<T>(
150152
{
151153
toolName,
152154
toolCallId: generateCompactId(),
153155
input,
154156
},
155157
autoInsertEndStepParam,
156-
)
158+
) : {toolName, toolCallId: generateCompactId(), input} as CodebuffToolCall<T>
157159
if ('error' in toolCall) {
158160
toolResults.push({
159161
type: 'tool-result',

common/src/tools/params/tool/set-messages.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@ export const setMessagesParams = {
1414
// Make sure to pass through any additional properties!
1515
.looseObject({
1616
role: z.enum(['user', 'assistant']),
17-
content: z.string().or(
18-
z.array(
19-
z.object({
20-
type: z.enum(['text']),
21-
text: z.string(),
22-
}),
23-
),
24-
),
17+
content: z.string()
2518
}),
2619
),
2720
})

0 commit comments

Comments
 (0)