Skip to content

Add timeout feature for agent runs #1425

@conpaine109

Description

@conpaine109

Have you read the docs? Agents SDK docsYES

Have you searched for related issues? Others may have had similar requests – YES

Describe the feature
It would be helpful to have a max_time parameter for the run() and run_streamed() methods, allowing users to automatically terminate runs that exceed a specified duration.

While this functionality is straightforward for users to implement manually, it would be convenient to have it built into the SDK.

Proposed behavior:

  • If run_time > max_time, raise a TimeoutError (some relevant err).

  • For streaming runs: max_time counts seconds before the first token is received.

  • For runs: max_time counts seconds before the RunResult is returned.

I've noticed over the past several days that runs have generally been taking longer, and I had to implement my own timeout logic. A built-in option would be clutch! Just some thoughts...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions