Skip to content

Commit 42c3c00

Browse files
committed
logging
1 parent 7ded4b5 commit 42c3c00

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/handlers/stagehandAgentHandler.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class StagehandAgentHandler {
4646
? { instruction: instructionOrOptions }
4747
: instructionOrOptions;
4848

49-
const maxSteps = options.maxSteps || 10;
49+
const maxSteps = options.maxSteps || 20;
5050
const actions: AgentAction[] = [];
5151
let finalMessage = "";
5252
let completed = false;
@@ -88,6 +88,8 @@ export class StagehandAgentHandler {
8888
},
8989
});
9090

91+
let stepNumber = 0;
92+
9193
const result = await this.llmClient.generateText({
9294
model: wrappedModel,
9395
system: systemPrompt,
@@ -99,8 +101,8 @@ export class StagehandAgentHandler {
99101
onStepFinish: async (event) => {
100102
this.logger({
101103
category: "agent",
102-
message: `Step finished: ${event.finishReason}`,
103-
level: 2,
104+
message: `Taking step ${++stepNumber}/${maxSteps}`,
105+
level: 1,
104106
});
105107

106108
if (event.toolCalls && event.toolCalls.length > 0) {
@@ -114,6 +116,12 @@ export class StagehandAgentHandler {
114116
category: "agent",
115117
message: `reasoning: ${event.text}`,
116118
level: 1,
119+
auxiliary: {
120+
toolCalls: {
121+
value: JSON.stringify(event.toolCalls),
122+
type: "object",
123+
},
124+
},
117125
});
118126
}
119127

0 commit comments

Comments
 (0)