Skip to content

Commit 93633f8

Browse files
committed
Custom tool result type
1 parent fbd5e7d commit 93633f8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

packages/agent-sdk/src/autonomous.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
import { BitteToolResult } from "@bitte-ai/types";
2-
31
const BITTE_API_URL =
42
"https://ai-runtime-446257178793.europe-west1.run.app/chat";
53

4+
export interface ToolResult {
5+
toolCallId: string;
6+
result: {
7+
error?: string;
8+
data?: unknown;
9+
};
10+
}
11+
612
export interface AgentResponse {
713
content: string;
8-
toolResults: BitteToolResult[];
14+
toolResults: ToolResult[];
915
messageId: string;
1016
finishReason: string;
1117
agentId: string;
@@ -123,11 +129,10 @@ export async function callAgent(
123129

124130
return {
125131
content: content.trim(),
126-
toolResults: toolResults.map((toolResult) =>
127-
toolResult.result.error
128-
? { error: toolResult.result.error }
129-
: { data: toolResult.result.data },
130-
),
132+
toolResults: toolResults.map((toolResult) => ({
133+
toolCallId: toolResult.toolCallId,
134+
result: toolResult.result,
135+
})),
131136
messageId,
132137
finishReason,
133138
agentId: resultAgentId,

0 commit comments

Comments
 (0)