Skip to content

Give Google ADK TypeScript model and MCP Activities a 10-second default heartbeat timeout - #506

Merged
campoy merged 1 commit into
mainfrom
feat/google-adk-ts-default-heartbeat-timeout
Nov 13, 2026
Merged

campoy merged 1 commit into
mainfrom
feat/google-adk-ts-default-heartbeat-timeout

Conversation

@campoy

@campoy campoy commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

What was changed

TemporalModel and TemporalMCPToolset now give their Activities a 10-second heartbeatTimeout when you don't set one. That's the model calls (adk-invokeModel and adk-invokeModelStreaming) and the MCP calls (<name>-listTools, -callTool, -listResources and -readResource).

  • These Activities already heartbeat on a timer at half the timeout (startAdaptiveHeartbeat), so they don't change.
  • A timeout you set wins, and heartbeatTimeout: 0 turns the timer off. The default goes in with ??, so a 0 passes through, and the SDK schedules it as no heartbeat timeout.
  • A raw model string (model: 'gemini-2.5-flash') runs through TemporalModel with its default options, so it gets the default too.
  • activityAsTool and activityNode run your own Activities, which may never heartbeat, so they stay as they are. They share an options helper with the MCP calls, so the default lives in a second helper that only the model and MCP calls use.
  • The TemporalModelOptions.activity doc said the model Activities heartbeat "not at all without" a heartbeat timeout. That was already wrong for streaming, which heartbeats after each chunk. It now says what the default does and how to turn it off, and so do the TemporalMCPToolsetOptions.activity doc and the README.

Why?

Without a heartbeat timeout, the MCP calls and the model calls that don't stream never heartbeat. So a cancel never reaches a running call: a cancelled Workflow, or a failing sibling node in a graph, leaves it running to the end. A lost worker also goes unnoticed until the one-minute start-to-close timeout. A streaming call does heartbeat after each chunk, but nothing goes out while the model is quiet.

Why 10 seconds? #491 has the measurements.

Does this break anything? Not replay: when core replays a scheduled Activity, it only compares its ID and type, and the replay tests over the recorded histories pass. But a call that didn't set heartbeatTimeout now heartbeats, which in Temporal Cloud is at most one Action every 8 seconds of a running call. And a Worker whose event loop blocks for about 10 seconds now fails the call with a heartbeat timeout, and retries it.

Checklist

  1. Closes [Feature Request] Give Google ADK TypeScript model and MCP Activities a 10-second default heartbeat timeout #505

  2. How was this tested:

    • A new test helper, getScheduledHeartbeatTimeouts, reads each scheduled Activity's heartbeat timeout from History. Four existing tests now use it:
      • dispatchesModelToolCallToActivity: both model calls get 10 seconds, and the activityAsTool Activity gets none.
      • callToolRoutesToActivity: listTools and callTool get 10 seconds.
      • listResources and readResource route through the resource Activities: both get 10 seconds.
      • appliesActivityTimeout: its model call now sets heartbeatTimeout: 0, and gets no heartbeat timeout.
    • Without the change, the first three fail. For example:
      tools › dispatchesModelToolCallToActivity
      
      Difference (- actual, + expected):
      
        [
      -   undefined,
      -   undefined,
      +   10,
      +   10,
        ]
      
    • I also checked once, with a temporary assertion in the auto-route test, that a raw model string gets 10 seconds.
    • Locally, make test (253 passed), make lint and the conventions check pass, on Node 24 with Temporal CLI 1.10.0.
  3. Any docs updates needed?
    The docs and the README are updated here. Release notes should mention the new default, and how to turn it off.

…lt heartbeat timeout

TemporalModel and TemporalMCPToolset left heartbeatTimeout unset, and their
Activities heartbeat on a timer only when it's set. So a cancel never reached
a running model or MCP call, and a lost worker went unnoticed until the
start-to-close timeout.

Default it to 10 seconds. The Activities already heartbeat on a timer at half
the timeout. Setting it to 0 turns the timer off. activityAsTool and
activityNode run the user's own Activities, so they get no default.

Part of #491.
@campoy
campoy marked this pull request as ready for review November 13, 2026 00:55
@campoy
campoy requested a review from a team as a code owner November 13, 2026 00:55
@campoy
campoy merged commit 591c7ee into main Nov 13, 2026
15 checks passed
@campoy
campoy deleted the feat/google-adk-ts-default-heartbeat-timeout branch November 13, 2026 01:25
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.

[Feature Request] Give Google ADK TypeScript model and MCP Activities a 10-second default heartbeat timeout

2 participants