Skip to content

feat: add receive_timeout parameter to Connection class#84

Open
birdg0 wants to merge 1 commit intoagentclientprotocol:mainfrom
birdg0:feat-add-receive-timeout
Open

feat: add receive_timeout parameter to Connection class#84
birdg0 wants to merge 1 commit intoagentclientprotocol:mainfrom
birdg0:feat-add-receive-timeout

Conversation

@birdg0
Copy link

@birdg0 birdg0 commented Mar 26, 2026

Summary

Adds receive_timeout parameter to Connection class to prevent indefinite hangs when agents become unresponsive.

Related issues

None

Testing

Ran the following checks:

make check

Output:

  • ✓ Lock file consistency check passed
  • ✓ All pre-commit hooks passed (case conflicts, merge conflicts, toml, yaml, json, formatting, ruff check/format)
  • ✓ Static type checking passed (ty)
  • ✓ No dependency issues (deptry)
make test

Output:

  • ✓ 102 tests passed, 1 skipped in 1.39s
  • All existing tests continue to pass with the new optional parameter

Docs & screenshots

No documentation updates included in this PR. The parameter is optional and defaults to None, preserving existing behavior. Documentation can be added in a follow-up PR if needed.

Checklist

  • Conventional Commit title (e.g. feat:, fix:).
  • Tests cover the change or are not required (explain above).
  • Docs/examples updated when behaviour is user-facing.
  • Schema regenerations (make gen-all) are called out if applicable.

- Add optional receive_timeout parameter to Connection.__init__
- Implement timeout handling in _receive_loop using asyncio.wait_for
- Raise RequestError.internal_error on timeout for graceful error handling

This allows users to configure a timeout for receiving messages from
agents, preventing indefinite hangs when an agent becomes unresponsive.
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.

1 participant