Add Google ADK agent sample#504
Draft
DABH wants to merge 3 commits into
Draft
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
reviewed
Jul 8, 2026
brianstrauch
left a comment
Member
There was a problem hiding this comment.
Can you add @temporalio/ai-sdk to CODEOWNERS for this one?
brianstrauch
reviewed
Jul 8, 2026
Comment on lines
+40
to
+50
| if err := c.SignalWorkflow(context.Background(), workflowID, "", chat.UserMessageSignalName, m); err != nil { | ||
| log.Fatalln("Unable to send message signal", err) | ||
| } | ||
| log.Printf("Sent message: %q", m) | ||
| // Give the agent time to answer before querying. | ||
| time.Sleep(2 * time.Second) | ||
|
|
||
| resp, err := c.QueryWorkflow(context.Background(), workflowID, "", chat.LatestAnswerQueryType) | ||
| if err != nil { | ||
| log.Fatalln("Unable to query latest answer", err) | ||
| } |
Member
There was a problem hiding this comment.
Updates are the better pattern for agent turns than signal + query since we can avoid polling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Google ADK agent sample demonstrating the new
go.temporal.io/sdk/contrib/googleadkintegration: a native ADK (
adk-go) agent runs durably on Temporal.googleadk/workflow.go—AgentWorkflowbuilds a native ADKllmagentwhose model isgoogleadk.NewModel(...)(model calls run as theInvokeModelActivity) and exposes aget_weatherTemporal activity to the agent viagoogleadk.ActivityAsTool(the tool runs as adurable Activity). The agent loop runs in-workflow via
NewContext(ctx).googleadk/worker/main.go— worker registering the workflow, theget_weatheractivity, and thegoogleadkmodel Activity (real Gemini client, API key read worker-side).googleadk/starter/main.go— starts the workflow with a question and prints the answer.googleadk/workflow_test.go— drives the workflow through a scriptedFakeModel, so it passeswith no API key or network.
README.md— sample index entry + a per-sample README.Structure mirrors the existing contrib-plugin samples (e.g.
workflowstreams,opentelemetry):root workflow file +
worker/andstarter/mains.go.temporal.io/sdk/contrib/googleadkis not yet a tagged release (it lands intemporalio/sdk-go#2439). Until it is tagged,
go.moduses a temporary localreplaceto asibling
../sdk-go/contrib/googleadkcheckout (annotated ingo.mod). Consequences:temporalio/sdk-go(branchadd-google-adk-agents-contrib-v2) checked out as a sibling,the sample builds and
go test ./googleadk/...passes locally.replaceis removed and a realcontrib/googleadk/vX.Y.Zis pinned.Before marking ready for review: drop the
replace, pin the releasedcontrib/googleadk, and rungo mod tidy.