Skip to content

Fix activity_as_tool for an Activity with *args in Deep Agents and Google ADK - #486

Merged
brianstrauch merged 4 commits into
temporalio:mainfrom
sohom-cs:fix/activity-as-tool-var-args
Nov 15, 2026
Merged

brianstrauch merged 4 commits into
temporalio:mainfrom
sohom-cs:fix/activity-as-tool-var-args

Conversation

@sohom-cs

@sohom-cs sohom-cs commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #390

activity_as_tool in Deep Agents refused an Activity with *args, and in Google ADK it passed the empty *args tuple to the Activity as one more argument.

  • Deep Agents: the tool's signature keeps the Activity's *args, so LangChain builds the same schema as for the function itself: an array named after the parameter, default None, typed from its annotation. The call binds the list and spreads it into the Activity's arguments. Building such a tool failed before, so no recorded history changes.
  • Google ADK: the declaration stays ADK's own, which leaves *args out, so the model can't fill it. The tool now spreads the empty tuple instead of passing it, so the Activity's *args is empty, not ([],). That changes the arguments a new tool call records, so it is behind the patch google_adk.activity-as-tool-var-args: a Workflow started before it keeps the old arguments on replay. Only a tool for an Activity with *args checks the patch. Offering *args to the model is left to ADK.
  • The Deep Agents docstring notes that the SDK reads no argument types for an Activity with *args, so the Worker decodes its arguments without them, as in openai_agents today.

Tested:

  • Google ADK: test_activity_as_tool_passes_empty_var_positional (function and callable-class Activity, patch on and off) checks the declaration against ADK's declaration of the plain function, and the arguments the Activity is scheduled with. test_activity_as_tool_without_var_positional_checks_no_patch: a tool for an Activity without *args doesn't check the patch. test_activity_as_tool_var_positional_replays runs a Workflow on the dev server with and without the patch and replays both histories.
  • Deep Agents: test_activity_as_tool_spreads_var_positional checks the schema against LangChain's for the function with *more: str (function and callable class), *args: str, and an unannotated *more; the spread arguments; and that a string for the list is rejected before any Activity is scheduled.
  • With 25a2074's code, all of these tests fail except the no-patch check. With main e7303bb merged, make lint passes in both plugins; make test: Google ADK 266 passed; Deep Agents 262 passed.

…Google ADK

Deep Agents refused to build a tool for an Activity with *args, and Google
ADK left *args out of the declaration and passed the empty tuple as one
more argument. Both now offer *args to the model as a list, as
openai_agents does, and spread it into the Activity's arguments.

Fixes temporalio#390
@sohom-cs
sohom-cs requested a review from a team as a code owner November 11, 2026 12:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T13:01:31.818172Z 25a2074 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25a2074f1f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

ADK leaves *args out of a function's declaration, so the Google ADK tool
keeps that declaration and only stops passing the empty tuple as one more
argument. That changes the arguments new tool calls record, so it is
behind the patch google_adk.activity-as-tool-var-args, which only a tool
for an Activity with *args checks. Deep Agents' schema defaults *args to
None, as LangChain's own schema for the function does.
@sohom-cs sohom-cs changed the title Pass an Activity's *args through activity_as_tool in Deep Agents and Google ADK Fix activity_as_tool for an Activity with *args in Deep Agents and Google ADK Nov 13, 2026

@brianstrauch brianstrauch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep Agents fails for conventional *args signatures and loses array validation for unannotated variadic parameters. Both issues reproduce with the locked dependencies.

The tool's signature replaced *args with a list parameter. For *args
named args, LangChain then showed Pydantic's v__args field and every call
failed; an unannotated *args lost its array type. The signature now keeps
*args, so LangChain builds the schema it builds for the function, and only
the call binds the list.

@brianstrauch brianstrauch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@brianstrauch
brianstrauch enabled auto-merge (squash) November 15, 2026 18:32
@brianstrauch
brianstrauch merged commit cd7c3eb into temporalio:main Nov 15, 2026
37 checks passed
campoy added a commit that referenced this pull request Nov 16, 2026
Replay is promised only within a major, and the next Google ADK Python
release is 1.0. The google_adk.activity-as-tool-var-args patch (#486) only
kept runs from before that fix passing an empty *args as one extra
argument, so it goes: activity_as_tool always spreads *args now.
campoy added a commit that referenced this pull request Nov 16, 2026
…before 1.0 (#585)

## What was changed

Google ADK Python ships 1.0 next, so its current major is 1, and replay
is promised only within a major (the rule #565 adds to AGENTS.md). The
`google_adk.activity-as-tool-var-args` patch from #486 only keeps runs
from before that fix passing an Activity's empty `*args` as one extra
argument, so let's remove it before 1.0.

`activity_as_tool` now always spreads an Activity's `*args`. The tests
stop checking the old path and the patch marker.

This PR doesn't need #565: no committed history reaches this gate.

## What will you notice? (Breaking)

Not much. A run that started before #486 now passes `*args` the new way
at its next such tool call, so its Activity gets no extra empty-tuple
argument. Its history still replays: replay doesn't compare Activity
arguments.

A run on a `main` build since #486 that called such a tool recorded the
marker, so it doesn't replay on this build. Its next Workflow Task fails
with `[TMPRL1100] Non-deprecated patch marker encountered`, and the run
stops making progress. No release wrote that marker.

### What should you do?

Never ran a `main` build of Google ADK Python since #486? Then nothing.

If you did, find the open runs that recorded the marker first. The
Python SDK adds every patch it records to the `TemporalChangeVersion`
search attribute, so this lists them:

```
temporal workflow list --query "TemporalChangeVersion = 'google_adk.activity-as-tool-var-args' AND ExecutionStatus = 'Running'"
```

No results? You're done. Otherwise, pick one:

1. **Let them finish, before you deploy.** Keep your current Workers
until those runs close, or pin them to the old Worker Deployment Version
with Worker Versioning. Then send new runs to this build.
2. **Reset them, after you deploy.** In each run's history, find the
first `MarkerRecorded` event for `google_adk.activity-as-tool-var-args`
and the `WorkflowTaskCompleted` event just before it. Reset to that
event:

   ```
temporal workflow reset --workflow-id <id> --event-id <that
WorkflowTaskCompleted event ID> --reason "drop google_adk var-args
marker"
   ```

The new run keeps everything before that point and runs the rest again
on this build. So the `*args` tool Activity that recorded the marker
runs again, and so does every Activity after it, model calls included.
Signals that arrived after that point are reapplied by default. Only
reset when those Activities are safe to run twice.

Reset only once this build is deployed: an older Worker would record the
marker again.

## Why?

We decided that replay is promised only within a major, and that a gate
that only protects an older major's runs is removed before the next
major ships. Google ADK Python's next release is 1.0, so this gate goes
before it.

## Checklist

1. No issue.

2. How was this tested:
- `make format`, `make lint` and `make test` for `python/google_adk` on
Python 3.12: 324 passed, 6 skipped.
- Replay, across builds. On Workers with no Workflow cache, I recorded a
tool call to an Activity with `*args` and one to an Activity without, on
`main` and on this PR. On `main` I also recorded the `*args` call with
`workflow.patched()` returning `False` for this gate, which is what a
run from before #486 does. Then I replayed every one on both builds,
along with a history with a renamed Activity.
- On this PR, only the `*args` run from `main`, which has the marker,
fails, with `[TMPRL1100] Non-deprecated patch marker encountered`, and
so does the renamed Activity. The old-path run replays.
   - Rollback to `main`: everything recorded on this PR replays.
- The reset steps above, on a local dev server with a small stand-in
Workflow (not `activity_as_tool`). A Worker that calls
`workflow.patched()` for this gate before its second Activity, like
`main`, recorded the marker. Then a Worker without that call, like this
PR, failed with TMPRL1100. The `TemporalChangeVersion` query found the
run. `temporal workflow reset` to the `WorkflowTaskCompleted` before the
marker finished it on the new Worker with no marker, and ran exactly one
Activity again: the one after the marker. After that, the query found
nothing. I didn't try the Worker Versioning option.

3. Any docs updates needed? No. The README doesn't mention the patch.
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.

[Bug] deepagents, google_adk: activity_as_tool can't pass an Activity's *args

2 participants