Add Google ADK agent samples#504
Conversation
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.
…; one confirmation per pass
brianstrauch
left a comment
There was a problem hiding this comment.
Can you add @temporalio/ai-sdk to CODEOWNERS for this one?
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.
# Conflicts: # go.mod
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.
|
Thanks @brianstrauch — addressed the feedback and rebased:
Still a draft pending the |
There was a problem hiding this comment.
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/googleadkmodule.
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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
Conflicts are resolved with merge commit |
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.
|
Updates now that temporalio/sdk-go#2439 has merged:
|
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.
|
CI note: |
What
Adds Google ADK agent samples under
googleadk/, demonstrating the newgo.temporal.io/sdk/contrib/googleadkintegration: native ADK (
adk-go) agents run durably on Temporal — the agent loop runs ina Workflow, each model call runs as the
InvokeModelActivity, and tools that do I/O run asdurable Activities.
Four scenarios, each with a
worker/+starter/main, a README, and aFakeModel-driventest that passes with no API key or network:
googleadk/— basic agent:AgentWorkflowbuilds a native ADKllmagentwithgoogleadk.NewModel(...), exposes aget_weatherTemporal activity to the agent viagoogleadk.ActivityAsTool, and drives the loop in-workflow withNewContext(ctx).googleadk/multiagent/— a coordinator agent delegates to weather/jokes specialistSubAgentsvia ADK'stransfer_to_agent; the whole tree runs in-workflow.googleadk/humanintheloop/— a sensitive tool callsctx.RequestConfirmation; theworkflow 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 ADKsession; 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-sdkCODEOWNERS entry, and@@@SNIPSTARTmarkers so the Go integration docs pagecan source its snippets from these samples.
Structure mirrors the existing contrib-plugin samples (e.g.
workflowstreams): a rootworkflow file +
worker/andstarter/mains, plus per-scenario subdirectories.go.temporal.io/sdk/contrib/googleadkis not yet a tagged release (it lands intemporalio/sdk-go#2439). Until it is,
go.moduses a temporary localreplaceto asibling
../sdk-go/contrib/googleadkcheckout. CI will fail until thereplaceisremoved and a real
contrib/googleadk/vX.Y.Zis pinned.Before marking ready for review: drop the
replace, pin the releasedcontrib/googleadk,and run
go mod tidy.