- Newest
- Most votes
- Most comments
This issue with your multi-agent system using Strands on Amazon Bedrock AgentCore sounds like a session timeout problem. Amazon Bedrock AgentCore automatically terminates sessions after 15 minutes of inactivity, which can cause your complex, multi-turn agent workflows to stop silently without returning specific error codes.
For long-running agent operations, you should implement ping handlers to keep the session alive. Here's how to address this:
- Implement ping handlers with HEALTHY_BUSY status for your async tasks. This tells AgentCore that your agent is still working and prevents automatic termination:
import asyncio from bedrock_agentcore.runtime import BedrockAgentCoreApp app = BedrockAgentCoreApp() @app.entrypoint async def long_running_agent(payload, context): # For long-running tasks, create async task with ping handler async def ping_handler(): while task_running: await context.ping(status="HEALTHY_BUSY") await asyncio.sleep(30) # Ping every 30 seconds # Start ping handler ping_task = asyncio.create_task(ping_handler()) # Your long-running work here result = await perform_long_task() # Clean up ping_task.cancel() return result
-
Implement proper timeout mechanisms on your agentic workflows. Set timeouts on external infrastructure calls and functions to prevent indefinite waiting.
-
Use the StopRuntimeSession operation to properly terminate sessions when needed, especially for error handling and timeout scenarios.
-
Leverage AgentCore Observability to monitor your agent performance. Set up CloudWatch monitoring for metrics like session count, latency, duration, token usage, and error rates to help identify where and why your agents are stopping.
The occasional throttling you're seeing in Bedrock model invocation logs could be contributing to the issue, especially for complex queries that might be hitting token limits. Consider implementing retry logic with exponential backoff to handle these throttling exceptions automatically, and potentially making your prompts more concise to reduce token usage.
Sources
Troubleshoot AgentCore Runtime - Amazon Bedrock AgentCore
Stop a running session - Amazon Bedrock AgentCore
Building Agentic AI app with Strands Agents & MCP | AWS re:Post
GENREL03-BP02 Implement timeout mechanisms on agentic workflows - Generative AI Lens
Observe your agent applications on Amazon Bedrock AgentCore Observability - Amazon Bedrock AgentCore
answered a year ago
The detail that the AgentCore session remains running is important: it means session termination has not yet been demonstrated as the cause. I would instrument each swarm handoff, model request and tool call with start/end events and a correlation ID, then identify the last operation that started without finishing. Record the model stream's terminal event or exception, cancellation, retry attempts and tool duration separately.
Put bounded timeouts around external tools and an overall turn/time budget around the swarm. If a model call finishes but no handoff follows, investigate the orchestration path; if a tool never finishes, isolate that tool; if the stream ends with throttling, check the actual retry policy rather than treating all silent stops as throttling.
Also verify that long operations do not block /ping. AWS's long-running agents guide describes HealthyBusy and task tracking. A small reproducible run with one agent and one tool is a useful baseline before restoring the full swarm. Prepared with AI assistance; no root cause is confirmed from the information provided.
answered a month ago
Relevant content
asked a year ago
