Commit e2de2ca
harness: SSE keepalive every 20s to survive long-running tool calls
Long tool calls (e.g. Exa deep_search_exa with type:"deep" and
numResults:50 can run 90-120s, plural in parallel) emit zero SSE events
during the wait. Without any bytes on the wire, the SDK's fetch GET to
/v1/sessions/:id/events idle-times-out and throws DOMException
TIMEOUT_ERR on the client side — Bun fetch and most intermediaries kill
sockets after ~5min of silence.
Fix: send `:keepalive\n\n` (SSE comment, ignored by spec-compliant
clients) every 20s while the response is open. Cleared in finally so
the response can still terminate cleanly when iterate() returns.
Validated live against github.com/shreyas-lyzr/exa-lead-gen-agent —
agent now completes a full pipeline (3 sequential deep_search_exa calls
+ Write + Bash) and emits real leads as a CSV.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b31b91c commit e2de2ca
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
39 | 48 | | |
40 | 49 | | |
41 | 50 | | |
| |||
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| 61 | + | |
52 | 62 | | |
53 | 63 | | |
54 | 64 | | |
| |||
0 commit comments