Exclusive Content:

Haiper steps out of stealth mode, secures $13.8 million seed funding for video-generative AI

Haiper Emerges from Stealth Mode with $13.8 Million Seed...

Running Your ML Notebook on Databricks: A Step-by-Step Guide

A Step-by-Step Guide to Hosting Machine Learning Notebooks in...

“Revealing Weak Infosec Practices that Open the Door for Cyber Criminals in Your Organization” • The Register

Warning: Stolen ChatGPT Credentials a Hot Commodity on the...

Maintain Session State Using Filesystem Configuration and Execute Shell Commands

Enhancing AI Agent Capabilities: Overcoming Ephemeral Filesystems and Enabling Deterministic Operations

Introduction to Persistent Filesystems for AI Agents

The Evolution of AI Agents Beyond Chat

Challenges in Developing Production Agents

Amazon Bedrock AgentCore Runtime: A Solution to Persistent Filesystem Issues

Inside an AgentCore Runtime Session

Managed Session Storage: A Game-Changer for Persistent State

Configuring Persistent Storage

The Stop/Resume Experience

Controlling Data Lifespan

Execute Shell Command: Ensuring Deterministic Operations

Running Commands Seamlessly in the Agent’s Environment

Design Choices that Enhance Usability

Integrating Persistent Filesystems with Agent Workflows

Streamlining Development with Shared Context

Getting Started with Amazon Bedrock AgentCore Capabilities

Conclusion: The Future of Development Workflows with AI Agents

Unlocking the Future of AI with Amazon Bedrock AgentCore

AI agents have come a long way from their initial capabilities limited to simple chat interactions. Today, they can write code, persist filesystem state, execute shell commands, and efficiently manage their environment. As these agentic coding assistants continue to evolve, the filesystem has emerged as their primary working memory, expanding their functionality beyond traditional context windows. However, this innovation comes with its own set of challenges for teams building production agents.

The Challenges of Ephemeral Filesystems

The first challenge: Ephemeral Filesystems

The inherent issue with many AI agents is that their session data is temporary. Once an agent’s session stops, everything it created—installed dependencies, generated code, or even local git histories—vanishes. Imagine an agent that has spent valuable time scaffolding a project: when you return after a break, it’s as if the progress has been erased, forcing you to start over.

The second challenge: Deterministic Operations

The second challenge arises when your workflow requires deterministic operations, such as running tests or pushing code to a repository. Often, you’re required to funnel these operations through a Large Language Model (LLM) or build external tools, both of which can introduce complexity and inefficiency.

Amazon’s Bedrock AgentCore Runtime has recently introduced features aimed at tackling these challenges: managed session storage for persistent filesystem state and the execute command capability for running shell commands directly inside the agent’s microVM. Let’s delve into how these features redefine the agent development experience.

Inside an AgentCore Runtime Session

AgentCore Runtime isolates each session in a dedicated microVM, which provides strong security boundaries. However, because every session starts with a clean filesystem, any work done during an active session disappears upon termination. This limitation necessitates workarounds, such as uploading files to Amazon S3 before stopping a session, adding complexity to your coding workflow.

Addressing the First Challenge: Managed Session Storage

What is Managed Session Storage?

Managed session storage offers a persistent directory that retains data across stop/resume cycles. Once this is configured at the agent’s creation, it ensures that everything written to the designated directory remains intact, even if the compute environment is replaced.

Configuring Persistent Storage

To leverage this feature, simply add sessionStorage to the agent runtime’s filesystem configuration.

aws bedrock-agentcore create-agent-runtime \
  --agent-runtime-name "coding-agent" \
  --role-arn "arn:aws:iam::111122223333:role/AgentExecutionRole" \
  --agent-runtime-artifact '{"containerConfiguration": {
    "containerUri": "123456789012.dkr.ecr.us-west-2.amazonaws.com/my-agent:latest"
  }}' \
  --filesystem-configurations '[{
    "sessionStorage": {
      "mountPath": "/mnt/workspace"
    }
  }]'

This guide illustrates how to set this up easily, enabling the agent to maintain filesystem state effectively.

The Stop/Resume Experience

Once configured, the agent can seamlessly resume its tasks. Suppose it sets up a project and then the session stops. Upon resuming, it sees the filesystem unchanged, ready to continue work without needing to re-install dependencies or regenerate files.

Addressing the Second Challenge: Execute Commands

What is Execute Command?

The InvokeAgentRuntimeCommand feature allows shell commands to be executed directly within a running AgentCore Runtime session, removing the need to channel operations through the LLM.

Running Shell Commands

For example, running npm tests is now straightforward and can be executed using the AWS SDK for Python (Boto3):

import boto3

client = boto3.client('bedrock-agentcore', region_name="us-west-2")

response = client.invoke_agent_runtime_command(
    agentRuntimeArn='arn:aws:bedrock-agentcore:us-west-2:123456789012:runtime/my-agent',
    runtimeSessionId='session-id',
    body={
        'command': '/bin/bash -c "npm test"',
        'timeout': 60
    }
)

The command runs in the same environment, making results immediately relevant to the ongoing work.

Benefits of Execute Command

By executing commands this way, you bypass cost and latency that come with routing through the LLM, making your operations more efficient and deterministic. You get real-time output that can be streamed, allowing immediate reactions to failures—rather than waiting until the end of a long process.

The Synergy of Features

Better Together: A Cohesive Workflow

The integration of managed session storage with the execute command feature provides a unified environment where ongoing projects can be effectively managed. Both capabilities complement each other by ensuring that:

  1. The agent can write and manage files in the persistent directory.
  2. Deterministic operations can be executed in the same context.

Imagine a development environment where an agent can write code, run tests, and push to a repository—all without losing state and without intermediaries.

A Sample Workflow

Here’s a simple representation of what a day of coding could look like with these features:

  1. Day 1: The agent downloads a codebase, sets up the environment, and you take a break.
  2. Day 2: Upon re-invoking the session, the agent finds the environment intact, makes changes, runs tests, and if all passes, commits and pushes the changes seamlessly.

Getting Started

These new capabilities are now in public preview in Amazon Bedrock. The process is straightforward:

  1. Managed Session Storage: Add filesystemConfigurations with sessionStorage.
  2. Execute Command: Use InvokeAgentRuntimeCommand for commands that run in the agent’s environment.

Conclusion

The introduction of managed session storage and command execution in Amazon Bedrock AgentCore is a game-changer for AI agents. They enable a persistent, cohesive development environment that respects the complexities of modern workflows while streamlining tasks. As we venture into new territories with AI-assisted coding, the tenants of persistence and determinism become not just possible, but practical.

About the Authors

The post was written by a team of dedicated professionals at AWS who are pushing the boundaries of what’s possible with AI. They are passionate about leveraging technology to solve challenging problems and improve developer workflows.

Explore these new capabilities and let us know how they enhance your development processes!

Latest

Create a Scalable Test Suite with Dataset Management in Amazon Bedrock AgentCore

Optimizing Agent Performance: The Role of Versioned Datasets in...

Expedia Unveils ChatGPT-Enhanced Travel Planning: Here’s How to Get Started.

Revolutionizing Travel: Expedia Integrates ChatGPT for Personalized Trip Planning Let...

2 Leading AI Robotics Stocks to Consider Over Tesla

Exploring Robotics Stocks: Two Promising Alternatives to Tesla The Evolution...

Centre Introduces AI Voice Chatbot for Addressing Grievances

Launch of Samadhan Didi: AI Chatbot to Empower Citizens...

Don't miss

Haiper steps out of stealth mode, secures $13.8 million seed funding for video-generative AI

Haiper Emerges from Stealth Mode with $13.8 Million Seed...

Running Your ML Notebook on Databricks: A Step-by-Step Guide

A Step-by-Step Guide to Hosting Machine Learning Notebooks in...

VOXI UK Launches First AI Chatbot to Support Customers

VOXI Launches AI Chatbot to Revolutionize Customer Services in...

Investing in digital infrastructure key to realizing generative AI’s potential for driving economic growth | articles

Challenges Hindering the Widescale Deployment of Generative AI: Legal,...

Assessing Deep Agents with LangSmith on AWS

Evaluating AI Agents: A Comprehensive Guide to Reliable Assessment This post was co-authored with Karan Singh, Head of Partnerships at LangChain. Understanding the Challenges of...

Comprehensive Observability for Amazon SageMaker AI LLM Inference: Monitoring GPU Utilization...

Comprehensive Observability for Large Language Models in Production with Amazon SageMaker AI Inference Understanding the Importance of Observability in LLM Deployment Two Dimensions of LLM Observability:...

Training Azerbaijani Language Models Using Amazon SageMaker AI

Building an Azerbaijani Language Model: Optimizing Training with Open Source Tools and AWS Acknowledgments Introduction to the Challenge Solution Overview Stage 1: Tokenizer Development Stage 2: Continued Pre-training (CPT) Stage...