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
This commit is contained in:
linked-danis
2026-03-12 14:05:59 +01:00
parent e2c00b1bfc
commit b0bcba2922
2 changed files with 11 additions and 3 deletions

View File

@@ -343,7 +343,7 @@ export class PageAgentCore extends EventTarget {
return result 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 // Accumulated wait time warning
if (this.#states.totalWaitTime >= 3) { if (this.#states.totalWaitTime >= 3) {
this.pushObservation( 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 const remaining = this.config.maxSteps - step
if (remaining === 5) { if (remaining === 5) {
this.pushObservation( 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) { } else if (remaining === 2) {
this.pushObservation( this.pushObservation(

View File

@@ -152,6 +152,12 @@ export interface AgentConfig extends LLMConfig {
* @experimental Use with caution - incorrect prompts may break agent behavior. * @experimental Use with caution - incorrect prompts may break agent behavior.
*/ */
customSystemPrompt?: string customSystemPrompt?: string
/**
* Delay between steps in seconds.
* @default 0.4
*/
stepDelay?: number
} }
/** /**