Skip to content

AgentCore Runtime - Specify a maximum loop limit for agents to prevent potential infinite loops #1308

@knziiy

Description

@knziiy

v5.1.2

When using AgentCore Runtime in an enabled state, it entered an infinite loop.
Specifically, when a CodeInterpreter-related instruction was issued to Amazon Nova Pro, Nova Pro failed to acquire the CodeInterpreter session properly and kept retrying indefinitely.
Currently, AgentCore Runtime does not provide an API to stop the runtime itself, which means there is a risk of it continuing the infinite loop for up to 8 hours. In this case, we forcibly terminated it by revoking permissions via IAM.

With the current implementation, even if you specify the Amazon Nova series, it cannot be used due to a lack of support for tools caching. However, it becomes available if you disable cache_prompt and cache_tools.

lib/app/src/agent.py

            bedrock_model = BedrockModel(
                model_id=model_id,
                boto_session=session,
                # cache_prompt="default",
                # cache_tools="default",
            )

It is unlikely that this issue would occur with Claude-based models (likely due to differences in model capabilities), but it would still be safer to allow setting an upper limit on the number of agent loop iterations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions