Skip to content

Can AWS DevOps Agent autonomously create a fix branch and raise a GitHub PR after RCA without a separate Lambda?

1

We have built a working CI/CD auto-remediation pipeline using AWS DevOps Agent and the GitHub MCP Server, based on the blog "Automate CI/CD troubleshooting with AWS DevOps Agent and GitHub".

Our current architecture uses 3 Lambda functions:

  1. webhook-executor – triggered by EventBridge on CodePipeline failure, calls create_backlog_task (taskType=INVESTIGATION) with instructions to investigate the failure AND create a fix branch + PR via GitHub MCP Server
  2. rca-generator – polls every 2 minutes until the agent task reaches COMPLETED, extracts the RCA, stores to S3, sends SNS email
  3. pr-automation – starts a NEW DevOps Agent chat session, passes the RCA output, and instructs the agent to create a fix branch and raise a PR

The problem: Even though the create_backlog_task description explicitly instructs the agent to create a fix branch and raise a PR, the agent completes the INVESTIGATION task with a full RCA but does NOT create the branch or PR. The GitHub MCP Server tools during the investigation appear to be read-only (browse, diff, commit history only). So we had to build the separate pr-automation Lambda as a workaround, which adds ~90 seconds and extra complexity.

Our questions:

  1. Can the DevOps Agent autonomously execute GitHub write operations (create branch, commit file, open PR) as part of a backlog INVESTIGATION task — or are write tools intentionally restricted to interactive chat sessions only?
  2. If write tools can be enabled, which specific GitHub MCP Server tools need to be allowlisted in the Agent Space (create_branch, create_or_update_file, create_pull_request)? And are any additional GitHub App permission scopes required?
  3. If autonomous write is not supported today, is there a native post-investigation hook or a different taskType that triggers PR creation automatically after RCA completes — so we can retire the pr-automation Lambda entirely?

Our goal is to collapse the 3-Lambda chain into a single agent task that investigates the failure AND raises the fix PR end-to-end.

2 Answers
1

Yes, AWS DevOps Agent can autonomously create a fix branch and raise a GitHub PR after root cause analysis without requiring a separate Lambda function. The agent is designed to use the GitHub MCP Server to push fix pull requests directly back into the repository as part of its autonomous investigation workflow.

Based on the documented capabilities, when you provide a prompt like 'Based on this investigation and root cause analysis use Github MCP server to push a fix and create a PR,' the agent can prepare a fix PR ready for review within minutes of the failure. The GitHub MCP Server integration specifically enables the agent to act by pushing fix pull requests directly, not just performing read-only operations.

To enable this capability, you need to ensure your Agent Space has the GitHub MCP Server properly registered with appropriate permissions. The GitHub integration should provide the agent with write access to push fixes, not just read access for investigation. When configuring the GitHub integration in your Agent Space through the Capabilities tab, the registration process should grant the necessary permissions for write operations.

The key is in how you structure your investigation request. The agent should be instructed within the same backlog task to both investigate the failure AND create the fix PR using the GitHub MCP Server. This is a single autonomous workflow, not separate read and write phases. The agent maintains context throughout the investigation and can transition from analysis to remediation action within the same task.

If your current setup shows only read-only GitHub tools during investigation, this suggests the GitHub MCP Server may not be fully configured with write permissions in your Agent Space. Review your GitHub App permissions and ensure the MCP Server registration includes the scopes necessary for branch creation, file commits, and pull request creation. The agent's ability to perform these write operations is part of its governed autonomy model, where you control what the agent can access and how it operates through the Agent Space configuration.

You should be able to collapse your three-Lambda architecture into a single webhook-triggered investigation that delivers both the RCA and the fix PR, eliminating the polling and separate PR automation steps entirely.
Sources
Automate CI/CD troubleshooting with AWS DevOps Agent and GitHub | AWS Cloud Operations Blog
Leverage Agentic AI for Autonomous Incident Response with AWS DevOps Agent | AWS DevOps & Developer Productivity Blog
Streamline your GitHub journey with AWS CodePipeline and AWS DevOps Agent | AWS DevOps & Developer Productivity Blog

answered a month ago

EXPERT

reviewed a month ago

0
Accepted Answer

By design, AWS DevOps Agent cannot autonomously execute GitHub write operations (such as creating a branch or opening a PR) as part of a taskType=INVESTIGATION backlog task.

This is an intentional safety boundary. Autonomous incident response tasks are strictly restricted to read-only tool access to prevent unintended infrastructure mutations or code changes during the root cause analysis phase.

To directly address your specific questions:

  1. Are write tools intentionally restricted to interactive chat sessions only? Yes. Even if your GitHub App is configured with Read & Write permissions and your create_backlog_task prompt explicitly requests a PR, the DevOps Agent backend enforces read-only access during INVESTIGATION tasks. Write operations require a human-in-the-loop and can only be invoked through interactive chat sessions, custom agents, or explicit remediation proposals.

  2. Which specific GitHub MCP Server tools need to be allowlisted? Because the restriction is enforced server-side at the taskType level for investigations, allowlisting tools like create_branch or create_pull_request will not bypass the constraint for an autonomous RCA task. (Note: The GitHub App write permissions you configure during registration are primarily used for interactive chat remediation and release readiness code reviews).

  3. Is there a native post-investigation hook or a different taskType? AWS DevOps Agent currently supports INVESTIGATION, EVALUATION, RELEASE_READINESS_REVIEW, and RELEASE_TESTING. There is no native REMEDIATION task type or built-in auto-approve hook that seamlessly transitions an autonomous investigation into an autonomous code commit.

Recommended Architecture Optimization While you cannot currently achieve an end-to-end RCA and PR creation in a single create_backlog_task, you can significantly streamline your 3-Lambda architecture by eliminating the polling phase (rca-generator).

AWS DevOps Agent natively emits state change events to Amazon EventBridge. You can collapse your workflow into a clean, 2-Lambda event-driven pattern:

Trigger Lambda: Triggered by CodePipeline failure → Calls create_backlog_task (taskType=INVESTIGATION).

EventBridge Rule: Listens for the investigation to finish on the default event bus.

JSON { "source": ["aws.aidevops"], "detail-type": ["Investigation Completed"] }

PR Automation Lambda: EventBridge triggers this Lambda natively as soon as the investigation finishes. This Lambda extracts the RCA context from the event payload and programmatically starts the interactive chat session to execute the GitHub MCP write tools.

This approach respects the agent's built-in safety boundaries while removing the ~90-second polling overhead and the complexity of your rca-generator Lambda.

answered a month ago

  • @Pablo Luis Martinez Guzman Thanks! I’ve completed the automated RCA report generation and automatic PR creation by following your recommendations. I reduced the execution time by almost 2 minutes, eliminated one Lambda function, and simplified the overall architecture.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.