Bedrock AgentCore Starter Toolkit

0.3.5 · active · verified Sun Apr 12

The Bedrock AgentCore Starter Toolkit is a Python CLI toolkit designed to simplify the deployment of AI agents to Amazon Bedrock AgentCore Runtime. It enables developers to take Python-based agent logic (e.g., built with Strands Agents or LangGraph) and deploy it to AWS with minimal infrastructure management. The library is currently at version 0.3.5 and undergoes rapid development with frequent patch releases. While still active for existing Python workflows, AWS now recommends using the `@aws/agentcore-cli` (an npm-based CLI) for new projects due to its broader framework support and features.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define a simple AI agent using `bedrock_agentcore.runtime.BedrockAgentCoreApp` and then deploy it using the `agentcore` command-line interface provided by the `bedrock-agentcore-starter-toolkit`. The Python code defines the agent's logic, which the CLI toolkit then containerizes and deploys to the AWS Bedrock AgentCore Runtime. Ensure your AWS credentials are configured (e.g., using `aws configure`) and you have the necessary IAM permissions to create roles, Lambda functions, and use Bedrock AgentCore services.

import os
from bedrock_agentcore.runtime import BedrockAgentCoreApp

def my_agent_logic(request):
    """
    Processes an incoming request for the AI agent.
    """
    prompt = request.get("prompt", "Hello from AgentCore!")
    # Simulate agent processing or integrate with an LLM
    response_content = f"The agent received your prompt: '{prompt}'."
    return {"response": response_content}

app = BedrockAgentCoreApp()

@app.entrypoint
def production_agent(request):
    """
    The entrypoint function for the Bedrock AgentCore Runtime.
    This function wraps your core agent logic.
    """
    return my_agent_logic(request)

if __name__ == "__main__":
    # This block allows local testing of the agent logic.
    # For deployment, the `agentcore` CLI interacts with this file.
    print("Starting local AgentCore development server...")
    print("Access at http://localhost:8080/invocations")
    app.run()

# To deploy and invoke via the CLI, run these commands in your terminal:
# 1. Save the above Python code to a file, e.g., `my_agent.py`.
# 2. Configure your agent: `agentcore configure --entrypoint my_agent.py --name my-bedrock-agent --region us-east-1`
#    (Ensure AWS credentials are configured, e.g., via `aws configure`)
# 3. Launch the agent: `agentcore launch`
# 4. Invoke the deployed agent: `agentcore invoke '{"prompt": "Tell me a fun fact about Python."}'`

view raw JSON →