Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions packages/core/lib/v3/agent/utils/validateExperimentalFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export interface AgentValidationOptions {
executeOptions?:
| (Partial<AgentExecuteOptionsBase> & { callbacks?: unknown })
| null;
/** Whether this is streaming mode (can be derived from agentConfig.stream) */
isStreaming?: boolean;
}

/**
Expand All @@ -24,15 +22,15 @@ export interface AgentValidationOptions {
* - Invalid argument errors for CUA (streaming, abort signal, message continuation, excludeTools, output schema are not supported)
* - Experimental feature checks for integrations and tools (both CUA and non-CUA)
* - Experimental feature checks for hybrid mode (requires experimental: true)
* - Experimental feature checks for non-CUA only (callbacks, signal, messages, streaming, excludeTools, output schema)
* - Experimental feature checks for non-CUA only (callbacks, signal, messages, excludeTools, output schema)
*
* Throws StagehandInvalidArgumentError for invalid/unsupported configurations.
* Throws ExperimentalNotConfiguredError if experimental features are used without experimental mode.
*/
export function validateExperimentalFeatures(
options: AgentValidationOptions,
): void {
const { isExperimental, agentConfig, executeOptions, isStreaming } = options;
const { isExperimental, agentConfig, executeOptions } = options;

// Check if CUA mode is enabled (via mode: "cua" or deprecated cua: true)
const isCuaMode =
Expand Down Expand Up @@ -83,12 +81,6 @@ export function validateExperimentalFeatures(
if (hasIntegrations || hasTools) {
features.push("MCP integrations and custom tools");
}

// Check streaming mode (either explicit or derived from config) - only for non-CUA
if (!isCuaMode && (isStreaming || agentConfig?.stream)) {
features.push("streaming");
}

// Check execute options features - only for non-CUA
if (executeOptions && !isCuaMode) {
if (executeOptions.callbacks) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/v3/tests/agent-callbacks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test.describe("Stagehand agent callbacks behavior", () => {
test.beforeEach(async () => {
v3 = new V3({
...v3TestConfig,
experimental: true, // Required for callbacks and streaming
experimental: true, // Required for callbacks
});
await v3.init();
});
Expand Down
14 changes: 0 additions & 14 deletions packages/core/lib/v3/tests/agent-experimental-validation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,6 @@ test.describe("Stagehand agent experimental feature validation", () => {
}
});

test("throws ExperimentalNotConfiguredError for streaming mode", async () => {
try {
const agent = v3.agent({
stream: true,
model: "anthropic/claude-sonnet-4-20250514",
});
await agent.execute("test instruction");
throw new Error("Expected error to be thrown");
} catch (error) {
expect(error).toBeInstanceOf(ExperimentalNotConfiguredError);
expect((error as Error).message).toContain("streaming");
}
});

test("throws ExperimentalNotConfiguredError for callbacks", async () => {
const agent = v3.agent({
model: "anthropic/claude-sonnet-4-20250514",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/v3/tests/agent-streaming.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test.describe("Stagehand agent streaming behavior", () => {
test.beforeEach(async () => {
v3 = new V3({
...v3TestConfig,
experimental: true, // Required for streaming
experimental: true,
});
await v3.init();
});
Expand Down
1 change: 0 additions & 1 deletion packages/core/lib/v3/v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,6 @@ export class V3 {
typeof instructionOrOptions === "object"
? instructionOrOptions
: null,
isStreaming,
});
SessionFileLogger.logAgentTaskStarted({
invocation: "Agent.execute",
Expand Down
Loading