Skip to content

Commit 3eca68b

Browse files
committed
fix: apply ruff formatting to Python agent core runtime
1 parent 539441e commit 3eca68b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/cdk/lambda-python/generic-agent-core-runtime/src/agent.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99
from strands import Agent as StrandsAgent
1010
from strands.models import BedrockModel
1111

12-
from .config import extract_model_info, get_system_prompt, get_max_iterations
12+
from .config import extract_model_info, get_max_iterations, get_system_prompt
1313
from .tools import ToolManager
1414
from .types import Message, ModelInfo
1515
from .utils import process_messages, process_prompt
1616

1717
logger = logging.getLogger(__name__)
1818

19+
1920
class IterationLimitExceededError(Exception):
2021
"""Exception raised when iteration limit is exceeded"""
22+
2123
pass
2224

25+
2326
class AgentManager:
2427
"""Manages Strands agent creation and execution."""
2528

@@ -37,9 +40,8 @@ def iteration_limit_handler(self, **ev):
3740
if ev.get("start_event_loop"):
3841
self.iteration_count += 1
3942
if self.iteration_count > self.max_iterations:
40-
raise IterationLimitExceededError(
41-
f"Event loop reached maximum iteration count ({self.max_iterations}). Please contact the administrator."
42-
)
43+
raise IterationLimitExceededError(f"Event loop reached maximum iteration count ({self.max_iterations}). Please contact the administrator.")
44+
4345
async def process_request_streaming(
4446
self,
4547
messages: list[Message] | list[dict[str, Any]],

packages/cdk/lambda-python/generic-agent-core-runtime/src/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def extract_model_info(model_info: Any) -> tuple[str, str]:
7474

7575
return model_id, region
7676

77+
7778
def get_max_iterations() -> int:
7879
"""Get maximum iterations from environment or default to {DEFAULT_MAX_ITERATIONS}"""
7980
try:

0 commit comments

Comments
 (0)