From b0bcba29221f80448666ebed0aea137cf796e4b5 Mon Sep 17 00:00:00 2001 From: linked-danis Date: Thu, 12 Mar 2026 14:05:59 +0100 Subject: [PATCH] feat: add stepDelay config option Add configurable delay between agent steps. Previously hardcoded to 0.4s. Changes: - Add stepDelay?: number to AgentConfig - Use config value with 0.4s default --- packages/core/src/PageAgentCore.ts | 8 +++++--- packages/core/src/types.ts | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/core/src/PageAgentCore.ts b/packages/core/src/PageAgentCore.ts index c7ab84b..ba64bd3 100644 --- a/packages/core/src/PageAgentCore.ts +++ b/packages/core/src/PageAgentCore.ts @@ -343,7 +343,7 @@ export class PageAgentCore extends EventTarget { return result } - await waitFor(0.4) // @TODO: configurable + await waitFor(this.config.stepDelay ?? 0.4) } } @@ -511,7 +511,8 @@ export class PageAgentCore extends EventTarget { // Accumulated wait time warning if (this.#states.totalWaitTime >= 3) { this.pushObservation( - `You have waited ${this.#states.totalWaitTime} seconds accumulatively. DO NOT wait any longer unless you have a good reason.` + `You have waited ${this.#states.totalWaitTime} seconds accumulatively. ` + + `DO NOT wait any longer unless you have a good reason.` ) } @@ -527,7 +528,8 @@ export class PageAgentCore extends EventTarget { const remaining = this.config.maxSteps - step if (remaining === 5) { this.pushObservation( - `⚠️ Only ${remaining} steps remaining. Consider wrapping up or calling done with partial results.` + `⚠️ Only ${remaining} steps remaining. ` + + `Consider wrapping up or calling done with partial results.` ) } else if (remaining === 2) { this.pushObservation( diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 33669c3..9daff76 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -152,6 +152,12 @@ export interface AgentConfig extends LLMConfig { * @experimental Use with caution - incorrect prompts may break agent behavior. */ customSystemPrompt?: string + + /** + * Delay between steps in seconds. + * @default 0.4 + */ + stepDelay?: number } /**