Just lately, AWS introduced Amazon Bedrock AgentCore, a versatile service that helps builders seamlessly create and handle AI brokers throughout completely different frameworks and fashions, whether or not hosted on Amazon Bedrock or different environments. Particularly, AgentCore Runtime gives a safe, serverless, and purpose-built internet hosting surroundings for deploying and working AI brokers or instruments. AgentCore Runtime is framework agnostic, working seamlessly with in style frameworks like LangGraph, Strands, and CrewAI for deploying your AI brokers and instruments with computerized scaling and built-in safety.
On this submit, we exhibit the way to use a GitHub Actions workflow to automate the deployment of AI brokers on AgentCore Runtime. This strategy delivers a scalable resolution with enterprise-level safety controls, offering full steady integration and supply (CI/CD) automation. By implementing a complete pipeline, we allow seamless agent deployment with AWS greatest practices, together with OpenID Join (OIDC) authentication, least-privilege entry controls, and surroundings separation. Our resolution facilitates environment friendly updates for current brokers and integrates steady safety scans and rigorous code high quality checks. The end result is a strong deployment technique that helps decrease operational complexity, improve safety, and speed up AI agent improvement throughout enterprise environments.
Advantages of Amazon Bedrock AgentCore Runtime
AgentCore Runtime is the perfect service for manufacturing agent deployments:
- Supplies a framework agnostic surroundings to run your brokers
- Works with massive language fashions (LLMs) equivalent to fashions supplied by Amazon Bedrock and Anthropic Claude
- Supplies session isolation by working every consumer session in a devoted microVM with remoted CPU, reminiscence, and file system sources
- Helps each real-time interactions and long-running workloads as much as 8 hours
- Presents built-in capabilities for authentication and observability
Resolution overview
We’ve developed a complete CI/CD pipeline with GitHub Actions that streamlines the deployment of Brokers in compliance with safety commonplace. The pipeline is obtainable as a ready-to-use resolution that may combine seamlessly together with your current improvement workflow.The answer consists of the next key elements:
The next diagram illustrates the structure for the answer.
The info circulate consists of the next steps:
- A developer commits code modifications from their native repository to the GitHub repository. On this resolution, the GitHub Motion is triggered manually, however this may be automated.
- The GitHub Motion triggers the construct stage.
- GitHub’s OIDC makes use of tokens to authenticate with AWS and entry sources.
- GitHub Actions invokes the command to construct and push the agent container picture to Amazon ECR immediately from the Dockerfile.
- AWS Inspector triggers a sophisticated safety scan when the picture is uploaded.
- An AgentCore Runtime occasion is created utilizing the container picture.
- The agent can additional question the Amazon Bedrock mannequin and invoke instruments in keeping with its configuration.
Within the following sections, we stroll by means of the steps to deploy the answer:
- Obtain the supply code from the GitHub repo.
- Create your agent code.
- Arrange GitHub secrets and techniques.
- Create an IAM function and insurance policies.
- Create the GitHub Actions workflow.
- Set off and monitor the pipeline.
- Confirm the deployment.
Conditions
Earlier than you should use our safe CI/CD pipeline for deploying brokers to AgentCore Runtime, confirm you might have the next stipulations in place:
Obtain supply code
Clone the supply code repository: bedrock-agentcore-runtime-cicd
git clone https://github.com/aws-samples/sample-bedrock-agentcore-runtime-cicd.git
The repository folder consists of the next construction:
Create agent code
Create your agent with the framework of your alternative utilizing the AgentCore Runtime toolkit. The toolkit makes use of BedrockAgentCoreApp to create an utility that gives a standardized technique to package deal your AI agent code right into a container that may run on AgentCore Runtime managed infrastructure. It additionally makes use of app.entrypoint, a Python decorator that marks a operate as the primary entry level. When the Amazon Bedrock agent receives the incoming API request, this operate receives and processes the consumer’s request. On this pattern agent code, when somebody calls your Amazon Bedrock agent utilizing an API, AgentCore Runtime will mechanically name the strands_agent_bedrock(payload) operate.
On this submit, we use the brokers/strands_agent.py file to create an agent utilizing the Strands Brokers framework:
Arrange GitHub secrets and techniques
The GitHub Actions workflow should entry sources in your AWS account. On this submit, we use an IAM OpenID Join identification supplier and IAM roles with IAM insurance policies to entry AWS sources. OIDC lets your GitHub Actions workflows entry sources in AWS with no need to retailer the AWS credentials as long-lived GitHub secrets and techniques. These credentials are saved as GitHub secrets and techniques inside your GitHub repository Settings beneath Secrets and techniques possibility. For extra data, see Utilizing secrets and techniques in GitHub Actions.
Create IAM roles and insurance policies
To run brokers or instruments in AgentCore Runtime, you want an IAM execution function. For details about creating an IAM function, see IAM function creation.
On this submit, we create the required belief coverage and execution function for AgentCore Runtime. See IAM Permissions for AgentCore Runtime for extra particulars.
The next code is for the AgentCore Runtime belief coverage:
The next code is for the AgentCore Runtime execution function:
Create the GitHub Actions workflow
Refer the CI/CD workflow file at .github/workflows/deploy-agentcore.yml for particulars to create the workflow.The next steps shall be carried out by the workflow:
- It makes use of the default Ubuntu Github Runner for the duty supplied within the pipeline.
- The workflow installs the required dependencies talked about within the
requirement.txtfile. - It builds the Docker picture and deploys it on the ECR repository.
- The picture is scanned with Amazon Inspector to establish potential vulnerabilities.
- AgentCore Runtime deploys the agent as an endpoint.
- The workflow exams the agent endpoint to confirm performance.
Set off and monitor pipeline
This pipeline may be triggered both by altering a code within the brokers folder or manually utilizing the workflow dispatch possibility. This may additional change in keeping with your group’s branching technique. Replace the code in .github/workflows/deploy-agentcore.yml to vary this set off habits.
Check agent
After the agent is deployed, we are going to confirm its performance by triggering the Check Agent workflow manually through workflow dispatch possibility.
AgentCore Runtime versioning and endpoints
Amazon Bedrock AgentCore implements computerized versioning for AgentCore Runtime and allows you to handle completely different configurations utilizing endpoints. Endpoints present a technique to reference particular variations of AgentCore Runtime. For extra particulars and pattern code, see AgentCore Runtime versioning and endpoints.
Clear up
To keep away from incurring future costs, full the next steps:
- Delete the ECR photos from the Amazon ECR console created by means of the deployment utilizing GitHub Actions.
- Delete the agent deployed in AgentCore Runtime.
Conclusion
On this submit, we demonstrated a complete strategy to utilizing GitHub Actions for a safer and scalable deployment of AI brokers on AgentCore Runtime. Our resolution gives a sturdy, automated, and managed surroundings for generative AI functions, addressing important enterprise deployment challenges by automating dependency administration, implementing steady code high quality checks, performing complete vulnerability scanning, and facilitating constant deployment processes. By abstracting infrastructure complexities, this pipeline helps builders deal with agent logic and performance, whereas offering a framework-agnostic strategy that helps seamless administration of a number of AI brokers at scale. As AI brokers proceed to rework enterprise capabilities, this resolution represents a big step in direction of streamlining AI agent improvement and operational administration, providing a standardized, safe, and environment friendly deployment mechanism for contemporary generative AI functions.
As a subsequent step, you should use Amazon Q to intelligently improve and customise your AI agent deployment pipeline, reworking your CI/CD processes with superior, context-aware automation.
Concerning the authors
Prafful Gupta is an Assoc. Supply Marketing consultant at AWS primarily based in Gurugram, India. Having began his skilled journey with Amazon a yr in the past, he makes a speciality of DevOps and Generative AI options, serving to prospects navigate their cloud transformation journeys. Past work, he enjoys networking with fellow professionals and spending high quality time with household. Join on LinkedIn at: linkedin.com/in/praffulgupta11/
Anshu Bathla is a Lead Marketing consultant – SRC at AWS, primarily based in Gurugram, India. He works with prospects throughout various verticals to assist strengthen their safety infrastructure and obtain their safety targets. Exterior of labor, Anshu enjoys studying books and gardening at his residence backyard. Join on LinkedIn at: linkedin.com/in/anshu-bathla/







