Skip to content

Commit 6b83d77

Browse files
committed
better naming
1 parent abea6e6 commit 6b83d77

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/google/adk/integrations/temporal/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ This package provides the integration layer between the Google ADK and Temporal.
44

55
## Core Concepts
66

7-
### 1. Interception Flow (`TemporalPlugin`)
7+
### 1. Interception Flow (`AgentPlugin`)
88

9-
The `TemporalPlugin` acts as a middleware that intercepts model calls (e.g., `agent.generate_content`) *before* they execute.
9+
The `AgentPlugin` acts as a middleware that intercepts model calls (e.g., `agent.generate_content`) *before* they execute.
1010

1111
**Workflow Interception:**
1212
1. **Intercept**: The ADK invokes `before_model_callback` when an agent attempts to call a model.
@@ -32,12 +32,12 @@ When the workflow executes an activity with an unknown name (e.g., `MyAgent.gene
3232
The integration requires setup on both the Agent (Workflow) side and the Worker side.
3333

3434
#### Agent Setup (Workflow Side)
35-
Attach the `TemporalPlugin` to your ADK agent. This safely routes model calls through Temporal activities. You **must** provide activity options (e.g., timeouts) as there are no defaults.
35+
Attach the `AgentPlugin` to your ADK agent. This safely routes model calls through Temporal activities. You **must** provide activity options (e.g., timeouts) as there are no defaults.
3636

3737
```python
3838
from datetime import timedelta
3939
from temporalio.common import RetryPolicy
40-
from google.adk.integrations.temporal import TemporalPlugin
40+
from google.adk.integrations.temporal import AgentPlugin
4141

4242
# 1. Define Temporal Activity Options
4343
activity_options = {
@@ -50,7 +50,7 @@ agent = Agent(
5050
model="gemini-2.5-pro",
5151
plugins=[
5252
# Routes model calls to Temporal Activities
53-
TemporalPlugin(activity_options=activity_options)
53+
AgentPlugin(activity_options=activity_options)
5454
]
5555
)
5656

@@ -59,23 +59,23 @@ agent = Agent(
5959
```
6060

6161
#### Worker Setup
62-
Install the `AdkWorkerPlugin` on your Temporal Worker. This handles serialization and runtime determinism.
62+
Install the `WorkerPlugin` on your Temporal Worker. This handles serialization and runtime determinism.
6363

6464
```python
6565
from temporalio.worker import Worker
66-
from google.adk.integrations.temporal import AdkWorkerPlugin
66+
from google.adk.integrations.temporal import WorkerPlugin
6767

6868
async def main():
6969
worker = Worker(
7070
client,
7171
task_queue="my-queue",
7272
# Configures ADK Runtime & Pydantic Support
73-
plugins=[AdkWorkerPlugin()]
73+
plugins=[WorkerPlugin()]
7474
)
7575
await worker.run()
7676
```
7777

78-
**What `AdkWorkerPlugin` Does:**
78+
**What `WorkerPlugin` Does:**
7979
* **Data Converter**: Enables Pydantic serialization for ADK objects.
8080
* **Interceptors**: Sets up specific ADK runtime hooks for determinism (replacing `time.time`, `uuid.uuid4`) before workflow execution.
8181
* TODO: is this enough . **Unsandboxed Workflow Runner**: Configures the worker to use the `UnsandboxedWorkflowRunner`, allowing standard imports in ADK agents.

src/google/adk/integrations/temporal/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def workflow_interceptor_class(
9191
) -> type[WorkflowInboundInterceptor] | None:
9292
return AdkWorkflowInboundInterceptor
9393

94-
class TemporalPlugin(BasePlugin):
94+
class AgentPlugin(BasePlugin):
9595
"""ADK Plugin for Temporal integration.
9696
9797
This plugin automatically configures the ADK runtime to be deterministic when running
@@ -167,7 +167,7 @@ async def before_model_callback(
167167

168168

169169

170-
class AdkWorkerPlugin(SimplePlugin):
170+
class WorkerPlugin(SimplePlugin):
171171
"""A Temporal Worker Plugin configured for ADK.
172172
173173
This plugin configures:
@@ -192,7 +192,7 @@ async def dynamic_activity(args: Sequence[RawValue]) -> Any:
192192

193193
# Check if this is a generate_content call
194194
if activity_type.endswith(".generate_content") or activity_type == "google.adk.generate_content":
195-
return await AdkWorkerPlugin._handle_generate_content(args)
195+
return await WorkerPlugin._handle_generate_content(args)
196196

197197
raise ValueError(f"Unknown dynamic activity: {activity_type}")
198198

tests/integration/manual_test_temporal_integration.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from google.adk.sessions import InMemorySessionService
4040
from google.adk.utils.context_utils import Aclosing
4141
from google.adk.events import Event
42-
from google.adk.integrations.temporal import AdkWorkerPlugin, TemporalPlugin
42+
from google.adk.integrations.temporal import WorkerPlugin, AgentPlugin
4343

4444
# Required Environment Variables for this test:
4545
# in this folder update .env.example to be .env and have the following vars:
@@ -68,11 +68,11 @@ async def run(self, prompt: str) -> Event | None:
6868
logger.info("Workflow started.")
6969

7070
# 1. Define Agent using Temporal Helpers
71-
# Note: TemporalPlugin in the Runner automatically handles Runtime setup
71+
# Note: AgentPlugin in the Runner automatically handles Runtime setup
7272
# and Model Activity interception. We use standard ADK models now.
7373

7474
# Wraps 'get_weather' activity as a Tool
75-
weather_tool = TemporalPlugin.activity_tool(
75+
weather_tool = AgentPlugin.activity_tool(
7676
get_weather,
7777
start_to_close_timeout=timedelta(seconds=60)
7878
)
@@ -90,12 +90,12 @@ async def run(self, prompt: str) -> Event | None:
9090

9191
logger.info(f"Session created with ID: {session.id}")
9292

93-
# 3. Run Agent with TemporalPlugin
93+
# 3. Run Agent with AgentPlugin
9494
runner = Runner(
9595
agent=agent,
9696
app_name='test_app',
9797
session_service=session_service,
98-
plugins=[TemporalPlugin(activity_options={'start_to_close_timeout': timedelta(minutes=2)})]
98+
plugins=[AgentPlugin(activity_options={'start_to_close_timeout': timedelta(minutes=2)})]
9999
)
100100

101101
logger.info("Starting runner.")
@@ -154,7 +154,7 @@ async def run(self, topic: str) -> str:
154154
agent=coordinator,
155155
app_name="multi_agent_app",
156156
session_service=session_service,
157-
plugins=[TemporalPlugin(activity_options={'start_to_close_timeout': timedelta(minutes=2)})]
157+
plugins=[AgentPlugin(activity_options={'start_to_close_timeout': timedelta(minutes=2)})]
158158
)
159159

160160
# 4. Run
@@ -198,7 +198,7 @@ async def test_temporal_integration():
198198
get_weather,
199199
],
200200
workflows=[WeatherAgent, MultiAgentWorkflow],
201-
plugins=[AdkWorkerPlugin()]
201+
plugins=[WorkerPlugin()]
202202
):
203203
print("Worker started.")
204204
# Test Weather Agent

tests/unittests/integrations/test_temporal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async def my_activity(arg: str) -> str:
9696
return f"Hello {arg}"
9797

9898
# Wrap it
99-
tool = temporal.TemporalPlugin.activity_tool(
99+
tool = temporal.AgentPlugin.activity_tool(
100100
my_activity,
101101
start_to_close_timeout=100
102102
)
@@ -122,7 +122,7 @@ async def my_activity(arg: str) -> str:
122122

123123

124124
def test_temporal_plugin_before_model(self):
125-
plugin = temporal.TemporalPlugin(activity_options={"start_to_close_timeout": 60})
125+
plugin = temporal.AgentPlugin(activity_options={"start_to_close_timeout": 60})
126126

127127
# Setup mocks
128128
mock_workflow.reset_mock()

0 commit comments

Comments
 (0)