close
Skip to content

Add timeout parameter to Agent contract#274

Closed
jkudish wants to merge 1 commit intolaravel:0.xfrom
jkudish:fix/agent-contract-timeout
Closed

Add timeout parameter to Agent contract#274
jkudish wants to merge 1 commit intolaravel:0.xfrom
jkudish:fix/agent-contract-timeout

Conversation

@jkudish
Copy link
Copy Markdown

@jkudish jkudish commented Mar 16, 2026

The Promptable trait's prompt() and stream() methods accept ?int $timeout = null, but the Agent contract interface does not declare this parameter. This causes static analyzers like PHPStan to flag timeout: as an unknown argument when calling prompt() on the Agent return type — e.g. from the agent() helper.

// agent() returns Agent (the contract), which lacks $timeout
agent(instructions: '...')->prompt(
    prompt: '...',
    provider: 'claude-cli',
    model: 'claude-sonnet-4-5',
    timeout: 600, // PHPStan: Unknown parameter $timeout
);

This was introduced in #20 which added $timeout to the trait but didn't update the contract.

This PR adds ?int $timeout = null to both prompt() and stream() on the Agent interface to match the Promptable trait implementation.

@pushpak1300
Copy link
Copy Markdown
Member

Added in #412

@pushpak1300
Copy link
Copy Markdown
Member

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants