Skip to content

Commit 08d8812

Browse files
committed
refactor: remove TYPE_CHECKING dependency for circular imports
- Remove typing.TYPE_CHECKING import and usage - Use runtime import only where needed (in toAgent method) - Remove return type annotation to avoid forward reference issues - Cleaner approach without typing module dependencies - All tests continue to pass 🤖 Assisted by Amazon Q Developer
1 parent 2753513 commit 08d8812

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/strands/experimental/agent_config.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
"""Experimental agent configuration with enhanced instantiation patterns."""
44

55
import json
6-
from typing import TYPE_CHECKING
7-
8-
# Avoid circular import: experimental/agent_config.py -> agent.agent ->
9-
# event_loop.event_loop -> experimental.hooks -> experimental.__init__.py -> AgentConfig
10-
if TYPE_CHECKING:
11-
from ..agent.agent import Agent
126

137

148
class AgentConfig:
@@ -45,7 +39,7 @@ def tool_pool(self) -> "ToolPool":
4539
"""
4640
return self._tool_pool
4741

48-
def toAgent(self, tools: "ToolPool | None" = None, **kwargs: any) -> "Agent":
42+
def toAgent(self, tools: "ToolPool | None" = None, **kwargs: any):
4943
"""Create an Agent instance from this configuration.
5044
5145
Args:

0 commit comments

Comments
 (0)