fix(agent): include model in structured response output (#4092)

* fix(agent): include model in structured response output

* fix(agent): update test expectation for model in structured response
This commit is contained in:
Waleed
2026-04-09 22:50:26 -07:00
committed by GitHub
parent 04c1f8e475
commit 3efbd1d612
2 changed files with 3 additions and 1 deletions
@@ -667,6 +667,7 @@ describe('AgentBlockHandler', () => {
expect(result).toEqual({
result: 'Success',
score: 0.95,
model: 'mock-model',
tokens: { input: 10, output: 20, total: 30 },
toolCalls: { list: [], count: 0 },
providerTiming: { total: 100 },
@@ -1070,19 +1070,20 @@ export class AgentBlockHandler implements BlockHandler {
private processStandardResponse(result: any): BlockOutput {
return {
content: result.content,
model: result.model,
...this.createResponseMetadata(result),
...(result.interactionId && { interactionId: result.interactionId }),
}
}
private createResponseMetadata(result: {
model?: string
tokens?: { input?: number; output?: number; total?: number }
toolCalls?: Array<any>
timing?: any
cost?: any
}) {
return {
model: result.model,
tokens: result.tokens || {
input: DEFAULTS.TOKENS.PROMPT,
output: DEFAULTS.TOKENS.COMPLETION,