Skip to content

Commit dddcb13

Browse files
committed
aligned callbacks between Py and TS
1 parent e1312af commit dddcb13

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

typescript/src/agents/agent.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,6 @@ export class AgentCallbacks {
4141
* Provides default implementations that can be overridden by subclasses.
4242
*/
4343

44-
async onLlmNewToken(_token: string): Promise<void> {
45-
/**
46-
* Called when a new token is generated by the LLM.
47-
*
48-
* @param token The new token generated
49-
*/
50-
// Default implementation does nothing
51-
}
52-
5344
async onAgentStart(
5445
_agentName: string,
5546
_input: any,
@@ -77,7 +68,7 @@ export class AgentCallbacks {
7768
// Default implementation does nothing
7869
}
7970

80-
async onAgentStop(
71+
async onAgentEnd(
8172
_agentName: string,
8273
_response: any,
8374
_messages: any[],
@@ -129,7 +120,17 @@ export class AgentCallbacks {
129120
// Default implementation does nothing
130121
}
131122

132-
async onLlmStop(
123+
async onLlmNewToken(_token: string, ..._kwargs: any[]): Promise<void> {
124+
/**
125+
* Called when a new token is generated by the LLM.
126+
*
127+
* @param token The new token generated
128+
* @param kwargs Additional keyword arguments that might be passed to the callback
129+
*/
130+
// Default implementation does nothing
131+
}
132+
133+
async onLlmEnd(
133134
_name: string,
134135
_output: any,
135136
_runId?: string,

typescript/src/utils/tool.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class AgentToolCallbacks {
6161

6262
onToolError(
6363
_toolName: string,
64+
_input: any,
6465
_error: Error,
6566
_runId?: string,
6667
_tags?: string[],
@@ -71,6 +72,7 @@ export class AgentToolCallbacks {
7172
* Callback method that runs when a tool encounters an error.
7273
*
7374
* @param toolName Name of the tool that encountered an error
75+
* @param input Object containing the tool's input
7476
* @param error The error that occurred
7577
* @param runId Unique identifier for this specific tool run
7678
* @param tags Optional list of string tags associated with this tool run

0 commit comments

Comments
 (0)