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

Revolutionize Retail Using AWS Generative AI Solutions

Transforming Online Retail with Virtual Try-On Solutions: A Complete...

OpenAI Refocuses on Business Users in Response to Growing Demands

The Shift Towards Business-Oriented AI: OpenAI's Strategic Moves and...

UK Conducts Tests on Robotic Systems for CBR Cleanup

Advancements in Uncrewed Systems for CBR Detection and Decontamination:...

Bias Linked to Negative Language in SCD Clinical Notes

Study Examines Bias in Electronic Health Records for Sickle...

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...

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,...

VOXI UK Launches First AI Chatbot to Support Customers

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

Affordable Custom Text-to-SQL Solutions with Amazon Nova Micro and On-Demand Inference...

Optimizing Text-to-SQL Generation with Amazon Bedrock and SageMaker AI Achieving Cost-Effective Custom SQL Dialect Capabilities Through Fine-Tuning Introduction Understanding the challenges of text-to-SQL generation, particularly in enterprise...

Live Nation-Ticketmaster: Convicted of Operating an Illegal Monopoly

Landmark Jury Verdict Challenges Ticketmaster's Monopoly in Live Entertainment How We Got Here What the States Actually Proved The Breakup Question Why This Matters Beyond Concert Tickets The Verdict...

Creating Effective Reward Functions with AWS Lambda for Customizing Amazon Nova...

Customizing Amazon Nova Models: Leveraging AWS Lambda for Effective Reward Functions Building Code-Based Rewards Using AWS Lambda How AWS Lambda-Based Rewards Work Choosing the Right Rewards Mechanism Reinforcement...