Bedrock AgentCore Starter Toolkit
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
- gotcha For all new Bedrock AgentCore projects, AWS now officially recommends using the `@aws/agentcore-cli` (an npm-based CLI) instead of this Python toolkit. This Python starter toolkit is primarily intended for existing Python-based workflows. The `@aws/agentcore-cli` offers broader framework support and features for local development.
- gotcha The Bedrock AgentCore Starter Toolkit is currently in 'public preview' status. This means that APIs and functionalities may change as the SDK is refined, potentially leading to breaking changes in future minor or patch releases.
- gotcha Successful deployment and invocation of agents require correctly configured AWS credentials and appropriate IAM permissions for creating roles, ECR repositories, and Bedrock AgentCore runtimes. Common issues arise from insufficient permissions or incorrectly set AWS regions.
Install
-
pip install bedrock-agentcore-starter-toolkit==0.3.5
Imports
- BedrockAgentCoreApp
from bedrock_agentcore.runtime import BedrockAgentCoreApp
Quickstart
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."}'`