Step 3: Connect Source Code
10 min · Connect your GitHub or Azure DevOps repository. Your agent can now perform root cause analysis—correlating production issues to specific code.
What you'll accomplish
By the end of this step, your agent will:
- Analyze source code during investigations
- Provide file:line references for issues
- Create To-Do Plans showing investigation steps
- Correlate production symptoms to code changes
Prerequisites
| Requirement | Details |
|---|---|
| Agent created | Complete Step 1 first |
| GitHub or Azure DevOps account | Access to the repositories you want to connect |
Choose your authentication method
| Method | When to use |
|---|---|
| OAuth | Sign in with your GitHub account — no token needed, easiest setup |
| PAT | Provide a Personal Access Token with repo scope — works for orgs with SSO restrictions |
Connect your repository
Connect a GitHub repository so your agent indexes it as a knowledge source. The dialog shows a browsable list of your repositories — select from the dropdown instead of typing URLs manually.
Step 1: Open the Add Repository dialog
During onboarding, select the Add repository card in the Knowledge Base step.
For an existing agent, go to Builder → Knowledge settings and select the Add repository action card.
Step 2: Choose a platform
- Select GitHub or Azure DevOps.
- Choose your sign-in method:
| Method | When to use |
|---|---|
| Auth (OAuth) | Sign in with your GitHub or Azure DevOps account — no token needed |
| PAT | Provide a Personal Access Token with repo scope |
- Complete authentication:
- OAuth: Click Sign in to GitHub (or Sign in to Azure DevOps) and complete the authentication popup.
- PAT: Enter your token in the Provide PAT field and click Connect.
If the sign-in dialog doesn't appear, check that your browser isn't blocking popups from sre.azure.com.
-
On success, a Connected card appears showing your authenticated account.
-
Click Next.
Step 3: Select repositories
After authentication, the Repository URL field shows a dropdown of your repositories:
- GitHub repos appear as
org/repo-name, sorted by last updated (up to 100 repos) - Azure DevOps repos appear after selecting a project from the Azure DevOps Project dropdown
Select a repository from the dropdown — the Display name auto-fills with the repository name. You can also type any valid repository URL directly into the field.
To add multiple repositories, click Add to insert additional rows.
The dropdown allows freeform typing. If your repository doesn't appear in the list (for example, if you have more than 100 repos), type the full URL directly.
Step 4: Confirm and save
Click Add repository to save.
The system automatically creates the appropriate GitHub OAuth or Azure DevOps OAuth connector if one doesn't already exist.
Managing connected repositories
When you reopen the Add Repository dialog, existing connected repositories appear as read-only rows in the grid.
To remove a repository:
- Open Builder → Knowledge settings → click the Add repository action card
- Find the repository row in the grid
- Click the trash icon on the row to mark it for deletion
- Click Add repository to save changes
- A Confirm changes dialog appears listing the repositories that will be removed
- Click Confirm to proceed or Cancel to keep them
To update authentication: If your PAT expires or you need to switch accounts, re-open the Add Repository dialog and re-authenticate with new credentials.
Alternative: MCP + custom agent
For full GitHub API access — search code, read files, list commits across all repositories — connect GitHub as an MCP server with a dedicated custom agent.
This approach uses the Model Context Protocol (MCP) to connect GitHub tools to a custom agent. Follow the step-by-step tutorial:
→ Set Up MCP Connector — connects GitHub MCP, creates a custom agent, and tests it in chat (~10 minutes)
What you learned
- Your agent now analyzes source code during investigations
- It provides file and line references for issues
- It creates To-Do Plans showing investigation steps
- It correlates production symptoms to code changes
Related
| Resource | What you'll do |
|---|---|
| Root cause analysis | How your agent uses source code to find root causes |
| Deep investigation | Extended multi-hypothesis analysis using connected repos |
| Agent Playground | Test MCP tools and custom agents interactively |
| Custom agents | How custom agents extend your agent's capabilities |
| Connectors | All connector types and how they work |