File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import asyncio
4- from datetime import timedelta
54
65from temporalio .client import Client
7- from temporalio .contrib .google_adk_agents import GoogleAdkPlugin , ModelActivityParameters
6+ from temporalio .contrib .google_adk_agents import GoogleAdkPlugin
87from temporalio .worker import Worker
98
109from google_adk .basic .activities .get_weather_activity import get_weather
1615async def main ():
1716 client = await Client .connect (
1817 "localhost:7233" ,
19- plugins = [
20- GoogleAdkPlugin (
21- model_params = ModelActivityParameters (
22- start_to_close_timeout = timedelta (seconds = 30 )
23- )
24- ),
25- ],
18+ plugins = [GoogleAdkPlugin ()],
2619 )
2720
2821 worker = Worker (
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ async def main():
5252
5353 # Show pending approval and approve it
5454 for call in pending :
55- print (f "\n Pending approval:" )
55+ print ("\n Pending approval:" )
5656 print (f" Tool: { call .tool_name } " )
5757 print (f" Arguments: { call .arguments } " )
5858 print (f" Approving call { call .call_id } ..." )
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import asyncio
4- from datetime import timedelta
54
65from temporalio .client import Client
7- from temporalio .contrib .google_adk_agents import GoogleAdkPlugin , ModelActivityParameters
6+ from temporalio .contrib .google_adk_agents import GoogleAdkPlugin
87from temporalio .worker import Worker
98
109from google_adk .human_in_the_loop .activities .sensitive_actions import (
1918async def main ():
2019 client = await Client .connect (
2120 "localhost:7233" ,
22- plugins = [
23- GoogleAdkPlugin (
24- model_params = ModelActivityParameters (
25- start_to_close_timeout = timedelta (seconds = 30 )
26- )
27- ),
28- ],
21+ plugins = [GoogleAdkPlugin ()],
2922 )
3023
3124 worker = Worker (
Original file line number Diff line number Diff line change @@ -81,9 +81,10 @@ async def before_tool_callback(
8181 )
8282
8383 # Pause until approval signal arrives
84- await workflow .wait_condition (
85- lambda cid = call_id : cid in wf_self ._approval_results
86- )
84+ def _is_approved (cid : str = call_id ) -> bool :
85+ return cid in wf_self ._approval_results
86+
87+ await workflow .wait_condition (_is_approved )
8788
8889 # Process approval
8990 approval = wf_self ._approval_results .pop (call_id )
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import asyncio
4- from datetime import timedelta
54
65from temporalio .client import Client
7- from temporalio .contrib .google_adk_agents import GoogleAdkPlugin , ModelActivityParameters
6+ from temporalio .contrib .google_adk_agents import GoogleAdkPlugin
87from temporalio .worker import Worker
98
109from google_adk .orchestration .workflows .loop_workflow import LoopWorkflow
1514async def main ():
1615 client = await Client .connect (
1716 "localhost:7233" ,
18- plugins = [
19- GoogleAdkPlugin (
20- model_params = ModelActivityParameters (
21- start_to_close_timeout = timedelta (seconds = 60 )
22- )
23- ),
24- ],
17+ plugins = [GoogleAdkPlugin ()],
2518 )
2619
2720 worker = Worker (
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33from contextlib import aclosing
4- from dataclasses import dataclass
4+ from dataclasses import dataclass , field
55
66from temporalio import workflow
77from temporalio .contrib .google_adk_agents import TemporalModel
@@ -35,14 +35,10 @@ class LoopInput:
3535class OrchestrationOutput :
3636 """Output from an orchestration workflow."""
3737
38- responses : list [str ] | None = None
38+ responses : list [str ] = field ( default_factory = list )
3939 final_response : str = ""
4040 iterations : int = 0
4141
42- def __post_init__ (self ):
43- if self .responses is None :
44- self .responses = []
45-
4642
4743@workflow .defn
4844class LoopWorkflow :
Original file line number Diff line number Diff line change 22
33from contextlib import aclosing
44from dataclasses import dataclass , field
5- from typing import Any
65
76from temporalio import workflow
87from temporalio .contrib .google_adk_agents import TemporalModel
You can’t perform that action at this time.
0 commit comments