Deploying from GitHub¶
The ADK repo template is a GitHub repository set up for ADK projects. Pull requests are linted, tested and pushed to an Agent Studio branch. Merging deploys them to Agent Studio. Changes published in Agent Studio come back into git.
Use the template ยท Template repository
How a change moves¶
Each git branch maps to an Agent Studio branch with the same name. The workflows keep the two in step.
sequenceDiagram
box GitHub
participant PR as Pull request
participant Main as main
end
box Agent Studio
participant Branch as Branch
participant ASMain as main
end
PR->>Branch: CI pushes on every PR push
Note over PR,ASMain: Merge queue or /poly-merge
Branch->>ASMain: Deploy merges the branch, which deploys to sandbox
PR->>Main: The PR is squashed onto main
Note over Main,ASMain: Later, in Agent Studio
ASMain->>Main: Publish or rollback: Sync Projects commits the change
| Step | In GitHub | In Agent Studio |
|---|---|---|
| 1. Branch | Create a git branch. | Point the ADK at the Agent Studio branch with the same name, creating it if needed. |
| 2. Pull request | CI lints, type-checks and tests the projects the PR changes. | CI pushes each changed project to its branch. |
| 3. Try it | Test the branch with poly chat or in Agent Studio. |
|
| 4. Merge | The merge queue, or a /poly-merge comment, squashes the PR onto main. |
Each project's branch merges into main, which deploys to sandbox. |
| 5. Edits in Agent Studio | Sync Projects commits the change to main. |
A publish or rollback tells the repo through a webhook. |
What's in a repo¶
agents/
<account>/
<project>/ # One Agent Studio project, as pulled by the ADK
.github/
workflows/ # CI, Deploy (merge queue), /poly-merge, Sync Projects, branch cleanup
scripts/ # Shared scripts the workflows and git hooks use
pyproject.toml # Pins the polyai-adk version the workflows use
.pre-commit-config.yaml # Git hooks that format projects the way a sync does
Working on a project¶
Set up once per machine, from the repo:
Then, for each change:
-
Create a git branch. From the project directory, switch the ADK to the Agent Studio branch with the same name. This creates the branch from
mainif it doesn't exist yet, and keeps your files:The ADK tracks its Agent Studio branch separately from git, so run this again after every
git switch. See branches. -
Make your changes and commit them. The git hooks format each project the way a sync from Agent Studio would, so CI and the merge queue accept it. If a hook reformats files, add them and commit again.
- Open a pull request. CI runs lint and tests, then pushes your changes to the Agent Studio branch.
- Merge through the merge queue, or comment
/poly-mergeif the repo uses it.
Keeping Agent Studio and git in step¶
Before a merge, Deploy checks that Agent Studio's main matches git's main for each project. If Agent Studio has changes the repo doesn't, the PR fails with AS branch main is not in sync with git main: run Sync Projects for that project, then add the PR to the queue again or comment /poly-merge again. To merge anyway and overwrite the Agent Studio changes, add the skip-as-sync-check label to the PR first.
After a change in Agent Studio, the Sync Projects workflow pulls it into the repo and pushes it to main. It runs:
- when a project's webhook reports a publish or rollback;
- nightly;
- when the
polyai-adkversion inpyproject.tomlchanges, to re-sync every project; - manually, from the repo's Actions tab.
Setting up a repo¶
The template's SETUP.md covers each step. In outline:
- Create a repo from the template.
- Create a GitHub App, which Sync Projects uses to push to
main. - Add your ADK API keys as repo secrets.
- Protect
mainwith a ruleset that requires the CI check, and either the merge queue or/poly-merge's check. - Add a webhook to each project, so publishes and rollbacks start Sync Projects.
Merging with /poly-merge¶
GitHub offers merge queues on public repos, and on private repos only in organisations on GitHub Enterprise Cloud. Without one, or instead of one, a repo can merge with a comment. Comment /poly-merge on a pull request that is approved and passing its checks. It then:
- checks the PR's approvals, required checks and conflicts with
main; - waits for any earlier
/poly-mergeon the same projects, while PRs on other projects go ahead at the same time; - lints and tests the PR merged into
main; - pushes each changed project to its Agent Studio branch, then merges each into Agent Studio's
main; - squash-merges the PR, and posts the result on it.
Each PR gets a poly/deploy check, which passes once its projects are deployed, so a PR that changes a project can only merge through /poly-merge. To turn it on, see the template's SETUP.md.
Keeping a repo up to date¶
- The ADK version: change the
polyai-adkpin inpyproject.tomland merge it. Sync Projects then re-syncs every project with the new version. Check the release notes first. - The workflows: pull changes from the template with
.github/scripts/sync-from-template.sh, which previews by default; add--applyto commit them.
Next steps¶
-
Branches, push, and pull
How Agent Studio branches work with the ADK. Open branches, push, and pull
-
Environments and deployment
Promote merged changes from sandbox to pre-release and live. Open environments and deployment
-
Webhooks
Send deployment events from Agent Studio to your repo. Open the webhooks reference