Skip to content

Commit 71375d8

Browse files
fix linting
1 parent 139be1d commit 71375d8

File tree

7 files changed

+37
-37
lines changed

7 files changed

+37
-37
lines changed

examples/tutorials/10_async/10_temporal/090_claude_agents_sdk_mvp/project/run_worker.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@
99
- Standard AgentEx activities (messages, streaming, tracing)
1010
"""
1111

12-
import asyncio
1312
import os
14-
from agentex.lib.core.temporal.workers.worker import AgentexWorker
15-
from agentex.lib.core.temporal.activities import get_all_activities
16-
from agentex.lib.environment_variables import EnvironmentVariables
13+
import asyncio
14+
15+
# Import workflow and workspace activity
16+
from project.workflow import ClaudeMvpWorkflow, create_workspace_directory
17+
1718
from agentex.lib.utils.logging import make_logger
19+
from agentex.lib.environment_variables import EnvironmentVariables
20+
from agentex.lib.core.temporal.activities import get_all_activities
21+
from agentex.lib.core.temporal.workers.worker import AgentexWorker
1822

1923
# Import Claude components
2024
from agentex.lib.core.temporal.plugins.claude_agents import (
21-
run_claude_agent_activity,
2225
ContextInterceptor, # Reuse from OpenAI!
26+
run_claude_agent_activity,
2327
)
2428

25-
# Import workflow and workspace activity
26-
from project.workflow import ClaudeMvpWorkflow, create_workspace_directory
27-
2829
logger = make_logger(__name__)
2930

3031

examples/tutorials/10_async/10_temporal/090_claude_agents_sdk_mvp/project/workflow.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,24 @@
1616
- Subagents
1717
- Tracing
1818
"""
19+
from __future__ import annotations
1920

20-
from claude_agent_sdk.types import AgentDefinition
2121
import os
2222
from pathlib import Path
23-
from temporalio import workflow
24-
from temporalio import activity
25-
from temporalio.common import RetryPolicy
2623
from datetime import timedelta
2724

25+
from temporalio import activity, workflow
26+
from temporalio.common import RetryPolicy
27+
from claude_agent_sdk.types import AgentDefinition
28+
2829
from agentex.lib import adk
2930
from agentex.lib.types.acp import SendEventParams, CreateTaskParams
30-
from agentex.lib.core.temporal.types.workflow import SignalName
31-
from agentex.lib.core.temporal.workflows.workflow import BaseWorkflow
32-
from agentex.lib.environment_variables import EnvironmentVariables
33-
from agentex.types.text_content import TextContent
3431
from agentex.lib.utils.logging import make_logger
32+
from agentex.types.text_content import TextContent
3533
from agentex.lib.utils.model_utils import BaseModel
34+
from agentex.lib.environment_variables import EnvironmentVariables
35+
from agentex.lib.core.temporal.types.workflow import SignalName
36+
from agentex.lib.core.temporal.workflows.workflow import BaseWorkflow
3637

3738
# Import Claude activity
3839
from agentex.lib.core.temporal.plugins.claude_agents import run_claude_agent_activity

src/agentex/lib/core/temporal/plugins/claude_agents/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,18 @@
3535
await worker.run(activities=activities, workflow=YourWorkflow)
3636
"""
3737

38+
from agentex.lib.core.temporal.plugins.claude_agents.hooks import (
39+
TemporalStreamingHooks,
40+
create_streaming_hooks,
41+
)
3842
from agentex.lib.core.temporal.plugins.claude_agents.activities import (
3943
run_claude_agent_activity,
4044
create_workspace_directory,
4145
)
42-
4346
from agentex.lib.core.temporal.plugins.claude_agents.message_handler import (
4447
ClaudeMessageHandler,
4548
)
4649

47-
from agentex.lib.core.temporal.plugins.claude_agents.hooks import (
48-
create_streaming_hooks,
49-
TemporalStreamingHooks,
50-
)
51-
5250
# Reuse OpenAI's context threading - this is the key to streaming!
5351
from agentex.lib.core.temporal.plugins.openai_agents.interceptors.context_interceptor import (
5452
ContextInterceptor,

src/agentex/lib/core/temporal/plugins/claude_agents/activities.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
from __future__ import annotations
44

55
import os
6-
from pathlib import Path
76
from typing import Any
7+
from pathlib import Path
88

99
from temporalio import activity
10-
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions, AgentDefinition
10+
from claude_agent_sdk import AgentDefinition, ClaudeSDKClient, ClaudeAgentOptions
1111

1212
from agentex.lib.utils.logging import make_logger
13+
from agentex.lib.core.temporal.plugins.claude_agents.hooks import create_streaming_hooks
14+
from agentex.lib.core.temporal.plugins.claude_agents.message_handler import ClaudeMessageHandler
1315
from agentex.lib.core.temporal.plugins.openai_agents.interceptors.context_interceptor import (
1416
streaming_task_id,
1517
streaming_trace_id,
1618
streaming_parent_span_id,
1719
)
18-
from agentex.lib.core.temporal.plugins.claude_agents.message_handler import ClaudeMessageHandler
19-
from agentex.lib.core.temporal.plugins.claude_agents.hooks import create_streaming_hooks
2020

2121
logger = make_logger(__name__)
2222

src/agentex/lib/core/temporal/plugins/claude_agents/hooks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Claude SDK hooks for streaming lifecycle events to AgentEx UI."""
22

33
from agentex.lib.core.temporal.plugins.claude_agents.hooks.hooks import (
4-
create_streaming_hooks,
54
TemporalStreamingHooks,
5+
create_streaming_hooks,
66
)
77

88
__all__ = [

src/agentex/lib/core/temporal/plugins/claude_agents/hooks/hooks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
from claude_agent_sdk import HookMatcher
1212

13-
from agentex.lib.utils.logging import make_logger
1413
from agentex.lib import adk
14+
from agentex.lib.utils.logging import make_logger
15+
from agentex.types.task_message_update import StreamTaskMessageFull
1516
from agentex.types.tool_request_content import ToolRequestContent
1617
from agentex.types.tool_response_content import ToolResponseContent
17-
from agentex.types.task_message_update import StreamTaskMessageFull
1818

1919
logger = make_logger(__name__)
2020

@@ -53,7 +53,7 @@ async def pre_tool_use(
5353
self,
5454
input_data: dict[str, Any],
5555
tool_use_id: str | None,
56-
context: Any,
56+
_context: Any,
5757
) -> dict[str, Any]:
5858
"""Hook called before tool execution.
5959
@@ -120,7 +120,7 @@ async def post_tool_use(
120120
self,
121121
input_data: dict[str, Any],
122122
tool_use_id: str | None,
123-
context: Any,
123+
_context: Any,
124124
) -> dict[str, Any]:
125125
"""Hook called after tool execution.
126126

src/agentex/lib/core/temporal/plugins/claude_agents/message_handler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
from typing import Any
1414

1515
from claude_agent_sdk import (
16-
AssistantMessage,
1716
TextBlock,
18-
SystemMessage,
1917
ResultMessage,
18+
SystemMessage,
19+
AssistantMessage,
2020
)
2121

22-
from agentex.lib.utils.logging import make_logger
2322
from agentex.lib import adk
23+
from agentex.lib.utils.logging import make_logger
2424
from agentex.types.text_content import TextContent
2525
from agentex.types.task_message_delta import TextDelta
2626
from agentex.types.task_message_update import StreamTaskMessageDelta
@@ -96,7 +96,7 @@ async def handle_message(self, message: Any):
9696
elif isinstance(message, ResultMessage):
9797
await self._handle_result_message(message)
9898

99-
async def _handle_assistant_message(self, message: AssistantMessage, msg_num: int):
99+
async def _handle_assistant_message(self, message: AssistantMessage, _msg_num: int):
100100
"""Handle AssistantMessage - contains text blocks.
101101
102102
Note: Tool calls (ToolUseBlock/ToolResultBlock) are handled by hooks, not here.
@@ -105,7 +105,7 @@ async def _handle_assistant_message(self, message: AssistantMessage, msg_num: in
105105
# Stream text blocks to UI
106106
for block in message.content:
107107
if isinstance(block, TextBlock):
108-
await self._handle_text_block(block, msg_num)
108+
await self._handle_text_block(block)
109109

110110
# Collect text for final response
111111
text_content = []
@@ -119,7 +119,7 @@ async def _handle_assistant_message(self, message: AssistantMessage, msg_num: in
119119
"content": "\n".join(text_content)
120120
})
121121

122-
async def _handle_text_block(self, block: TextBlock, msg_num: int):
122+
async def _handle_text_block(self, block: TextBlock):
123123
"""Handle text content block."""
124124
if not block.text or not self.streaming_ctx:
125125
return

0 commit comments

Comments
 (0)