Skip to content

Add Google ADK agent samples#504

Open
DABH wants to merge 13 commits into
mainfrom
googleadk-sample
Open

Add Google ADK agent samples#504
DABH wants to merge 13 commits into
mainfrom
googleadk-sample

Conversation

@DABH

@DABH DABH commented Jul 7, 2026

Copy link
Copy Markdown

What

Adds Google ADK agent samples under googleadk/, demonstrating the new
go.temporal.io/sdk/contrib/googleadk
integration: native ADK (adk-go) agents run durably on Temporal — the agent loop runs in
a Workflow, each model call runs as the InvokeModel Activity, and tools that do I/O run as
durable Activities.

Four scenarios, each with a worker/ + starter/ main, a README, and a FakeModel-driven
test that passes with no API key or network:

  • googleadk/ — basic agent: AgentWorkflow builds a native ADK llmagent with
    googleadk.NewModel(...), exposes a get_weather Temporal activity to the agent via
    googleadk.ActivityAsTool, and drives the loop in-workflow with NewContext(ctx).
  • googleadk/multiagent/ — a coordinator agent delegates to weather/jokes specialist
    SubAgents via ADK's transfer_to_agent; the whole tree runs in-workflow.
  • googleadk/humanintheloop/ — a sensitive tool calls ctx.RequestConfirmation; the
    workflow durably waits on a signal for the human decision, then resumes the agent with
    googleadk.ConfirmationResponse.
  • googleadk/chat/ — a long-lived chat: each user message is a Workflow Update
    (send-message) that returns the answer directly (no polling), running on one shared ADK
    session; the workflow continues-as-new to bound history, carrying the session across the
    boundary via googleadk.ExportSession / ImportSession.

Also adds a /googleadk/ @temporalio/sdk @temporalio/ai-sdk CODEOWNERS entry, and
@@@SNIPSTART markers so the Go integration docs page
can source its snippets from these samples.

Structure mirrors the existing contrib-plugin samples (e.g. workflowstreams): a root
workflow file + worker/ and starter/ mains, plus per-scenario subdirectories.

⚠️ Draft — blocked on the contrib release

go.temporal.io/sdk/contrib/googleadk is not yet a tagged release (it lands in
temporalio/sdk-go#2439). Until it is, go.mod uses a temporary local replace to a
sibling ../sdk-go/contrib/googleadk checkout. CI will fail until the replace is
removed and a real contrib/googleadk/vX.Y.Z is pinned.

Before marking ready for review: drop the replace, pin the released contrib/googleadk,
and run go mod tidy.

DABH added 3 commits July 7, 2026 18:16
Demonstrates running a Google ADK (adk-go) agent durably with the
go.temporal.io/sdk/contrib/googleadk integration: the agent loop runs in a
Workflow, the model call runs as a Temporal Activity via googleadk.NewModel, and
a get_weather tool is exposed as a durable Activity via googleadk.ActivityAsTool.
Includes a worker, starter, README, and a FakeModel-driven test that needs no
live LLM.

The contrib/googleadk package is not yet a tagged release, so go.mod uses a
temporary local replace to a sibling temporalio/sdk-go checkout; this must be
swapped for a real release before merge (see the comment in go.mod).
Three scenario subdirectories under googleadk/, each with a workflow, worker,
starter, README, and a FakeModel-driven test (no live LLM):

- multiagent: a coordinator agent that delegates to weather/jokes SubAgents via
  ADK's in-workflow transfer_to_agent.
- humanintheloop: a sensitive delete_resource tool whose workflow durably blocks
  on a Temporal signal for the human's approve/deny decision before the tool runs.
- chat: a long-lived, signal-driven conversation on one ADK session that
  continues-as-new (exporting/importing the session) to keep history bounded.

Also turns googleadk/README.md into an index of the basic agent plus the three
scenarios.

@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.

Can you add @temporalio/ai-sdk to CODEOWNERS for this one?

Comment thread googleadk/chat/starter/main.go Outdated
Wrap the worker wiring, agent workflow, weather tool, starter, and the
multi-agent / human-in-the-loop / continue-as-new workflow funcs with
@@@SNIPSTART markers so the Google ADK Go integration docs page can source
snippets via snipsync. Comment-only; no behavior change. Also add a CODEOWNERS
entry for the googleadk samples.
DABH added 2 commits July 15, 2026 16:18
Address review feedback on the chat scenario: it delivered each user message as
a signal and read the answer via a polled query. Switch to a `send-message`
Update that runs one agent turn on the shared ADK session and returns the answer
on the same call — no polling. Turns are serialized so concurrent Updates can't
interleave on the session, and continue-as-new drains in-flight turns via
AllHandlersFinished before exporting the session. Starter and test drive Updates.
@DABH DABH changed the title Add Google ADK agent sample Add Google ADK agent samples Jul 15, 2026
@DABH

DABH commented Jul 15, 2026

Copy link
Copy Markdown
Author

Thanks @brianstrauch — addressed the feedback and rebased:

  • Conflicts: merged latest main (only go.mod conflicted; resolved + go mod tidy). PR is mergeable again.
  • CODEOWNERS: added /googleadk/ @temporalio/sdk @temporalio/ai-sdk.
  • Agent turns → Updates: the chat scenario now uses a send-message Workflow Update that returns the answer directly (no signal + query polling), with serialized turns and an AllHandlersFinished drain before continue-as-new. (85e66de)
  • Title/description: updated to cover all four scenarios (basic, multi-agent, human-in-the-loop, chat), not just the first.

Still a draft pending the contrib/googleadk tagged release — the go.mod replace + version pin get dropped then.

Copilot AI 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.

Pull request overview

Adds a new googleadk/ sample suite showing how to run Google ADK (adk-go) agents durably on Temporal using the go.temporal.io/sdk/contrib/googleadk integration, including worker/starter mains, scenario READMEs, and FakeModel-driven tests.

Changes:

  • Introduces four Google ADK scenarios (basic, multi-agent, human-in-the-loop, long-lived chat w/ continue-as-new) with workflows, workers/starters, and tests.
  • Wires docs/snippet discovery and ownership (root README link + CODEOWNERS entry).
  • Updates dependencies to include ADK/GenAI + the (currently placeholder + locally replaced) contrib/googleadk module.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Adds a top-level link/description for the new Google ADK samples.
googleadk/workflow.go Basic ADK agent workflow + get_weather activity exposed as a tool.
googleadk/workflow_test.go FakeModel-driven test for the basic agent/tool path.
googleadk/worker/main.go Worker wiring for basic sample (workflow, tool activity, InvokeModel activity).
googleadk/starter/main.go Starter for running the basic sample end-to-end.
googleadk/README.md Root documentation for the Google ADK samples and how to run/test them.
googleadk/multiagent/workflow.go Multi-agent (coordinator + specialists) workflow sample.
googleadk/multiagent/workflow_test.go FakeModel-driven test proving transfer + tool execution.
googleadk/multiagent/worker/main.go Worker wiring for multi-agent scenario.
googleadk/multiagent/starter/main.go Starter for multi-agent scenario.
googleadk/multiagent/README.md Documentation for running/testing the multi-agent scenario.
googleadk/humanintheloop/workflow.go HITL workflow that durably waits on a confirmation signal before proceeding.
googleadk/humanintheloop/workflow_test.go Tests for approval and denial flows using real workflow signals in the test env.
googleadk/humanintheloop/worker/main.go Worker wiring for HITL scenario (workflow + InvokeModel activity).
googleadk/humanintheloop/starter/main.go Starter that signals approval after a delay to demonstrate resume.
googleadk/humanintheloop/README.md Documentation for running/testing the HITL scenario.
googleadk/chat/workflow.go Update-driven chat workflow with bounded history via continue-as-new + session export/import.
googleadk/chat/workflow_test.go Tests for per-turn history carryover and continue-as-new behavior.
googleadk/chat/worker/main.go Worker wiring for chat scenario (workflow + InvokeModel activity).
googleadk/chat/starter/main.go Starter that sends chat messages via Workflow Updates.
googleadk/chat/README.md Documentation for running/testing the chat scenario.
go.mod Adds new dependencies (ADK/GenAI + contrib/googleadk) and a temporary local replace.
go.sum Updates dependency checksums to match new modules pulled in by samples.
.github/CODEOWNERS Adds /googleadk/ ownership entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread googleadk/chat/workflow_test.go
Comment thread go.mod Outdated
Comment thread go.mod Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@brianstrauch

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

Comment thread .github/CODEOWNERS Outdated
Comment thread googleadk/chat/starter/main.go Outdated

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Conflicts are resolved with merge commit f72da96 (merged origin/main into this branch and resolved go.mod/go.sum).

@CLAassistant

CLAassistant commented Jul 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@DABH
DABH marked this pull request as ready for review July 17, 2026 18:24
@DABH
DABH requested a review from a team as a code owner July 17, 2026 18:24
temporalio/sdk-go#2439 merged, so drop the local sibling-checkout replace.
The go.temporal.io vanity server does not serve the new module path yet
(temporalio/vanity-imports#23), so until that deploys the module is
consumed via its GitHub path, pinned at the merged commit; the require
line already carries the real version, so removing the replace is the
only cleanup left once the vanity page is up.
… contrib docs

The chat package is already named chat, so the alias was a no-op. The
HITL sample already resumed one decision per pass; its README and
workflow comments however suggested batching decisions via
ConfirmationResponse(decisions...), which the merged contrib docs now
recommend against for Activity-backed tools (batch resume order is not
replay-stable) — reword both to the one-decision-per-pass guidance.
@DABH
DABH force-pushed the googleadk-sample branch from e3c5a2c to 7c243c7 Compare July 17, 2026 23:16
@DABH

DABH commented Jul 17, 2026

Copy link
Copy Markdown
Author

Updates now that temporalio/sdk-go#2439 has merged:

  • Real dependency: dropped the local sibling-checkout replace; go.mod now requires go.temporal.io/sdk/contrib/googleadk v0.0.0-20260717224236-b77dd17ed4ce (sdk-go main, includes the crypto bump). One caveat: the go.temporal.io vanity server doesn't serve the new module path yet (fix: temporalio/vanity-imports#23), so until that deploys there's a versioned replace to the GitHub path pinned at the same commit — buildable by CI and anyone, no local checkout needed. Once the vanity page is up (or a contrib/googleadk tag exists), deleting the replace is the only cleanup left.
  • HITL guidance: the sample already resumed one decision per pass, but its README/comments suggested batching via ConfirmationResponse(decisions...) — the merged contrib docs now recommend against that for Activity-backed tools (batch resume order isn't replay-stable; upstream fix: fix(llminternal): resume confirmed tool calls in request order google/adk-go#1169), so both are reworded to the one-decision-per-pass pattern.
  • CLA: the two Copilot-authored conflict-resolution commits were recreated with identical trees under my authorship, so the CLA check should pass now.
  • All googleadk sample tests pass against the real merged module; full repo builds clean.

Now that the googleadk packages build in CI (the local sibling-checkout
replace previously made them unresolvable), workflowcheck flags the ADK
runner internals (channels, map iteration, reflection) reached from the
sample workflows. Those are deterministic by construction under the
contrib googleadk bridge and replay-tested there, so mark the specific
entry points deterministic via the checker's config file rather than
block-level inline ignores, which would also mask future genuine
non-determinism in the loop bodies.
@DABH

DABH commented Jul 18, 2026

Copy link
Copy Markdown
Author

CI note: build-and-test newly reached workflowcheck on the googleadk packages — previously the local-checkout replace made them unbuildable in CI, so the analyzer never saw them. It flags ADK runner internals (channels/map-iteration/reflection) that are deterministic by construction under the contrib bridge (Temporal-deterministic time/UUID/fan-out seams, model+I/O as Activities; replay-tested in contrib). Added workflowcheck.config.yaml marking those specific entry points (runner.Run, ExportSession, PendingConfirmations, functiontool.New) deterministic and wired -config into the Makefile target — chose the config over inline //workflowcheck:ignore blocks so only those functions are exempt, not whole loop bodies. workflowcheck ./... is clean repo-wide.

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.

5 participants