Skip to content

Add Google ADK agent sample#504

Draft
DABH wants to merge 3 commits into
mainfrom
googleadk-sample
Draft

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

Conversation

@DABH

@DABH DABH commented Jul 7, 2026

Copy link
Copy Markdown

What

Adds a Google ADK agent sample demonstrating the new
go.temporal.io/sdk/contrib/googleadk
integration: a native ADK (adk-go) agent runs durably on Temporal.

  • googleadk/workflow.goAgentWorkflow builds a native ADK llmagent whose model is
    googleadk.NewModel(...) (model calls run as the InvokeModel Activity) and exposes a
    get_weather Temporal activity to the agent via googleadk.ActivityAsTool (the tool runs as a
    durable Activity). The agent loop runs in-workflow via NewContext(ctx).
  • googleadk/worker/main.go — worker registering the workflow, the get_weather activity, and the
    googleadk model 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 scripted FakeModel, so it passes
    with 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/ and starter/ mains.

⚠️ 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 tagged, go.mod uses a temporary local replace to a
sibling ../sdk-go/contrib/googleadk checkout (annotated in go.mod). Consequences:

  • With temporalio/sdk-go (branch add-google-adk-agents-contrib-v2) checked out as a sibling,
    the sample builds and go test ./googleadk/... passes locally.
  • 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 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)
}

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.

Updates are the better pattern for agent turns than signal + query since we can avoid polling

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.

2 participants