@shinyaz

AgentCore Runtime InvokeAgentRuntimeCommand says Stateless but the filesystem persists within a session

1 min read

The AgentCore Runtime docs for InvokeAgentRuntimeCommand say "Stateless between commands: No shell history or environment persistence." I assumed each command was fully isolated and file passing would need && chaining. Though the docs also state "Commands execute within the same container, filesystem."

Testing with /tmp/, files created in one API call were visible to subsequent calls in the same session.

# API call 1
run_command('/bin/bash -c "echo hello > /tmp/test.txt"')
 
# API call 2 (same session ID, separate request)
run_command('/bin/bash -c "cat /tmp/test.txt"')
# → hello (file persists)

Sessions map to microVMs — each command gets a new bash process but sees the same filesystem. A different session ID sees nothing: completely isolated.

"Stateless" refers only to shell process state (history, env vars). The filesystem is stateful within a session.

Share this post

Shinya Tahara

Shinya Tahara

Solutions Architect @ AWS

I'm a Solutions Architect at AWS, providing technical guidance primarily to financial industry customers. I share learnings about cloud architecture and AI/ML on this site.The views and opinions expressed on this site are my own and do not represent the official positions of my employer.