|
6 | 6 |
|
7 | 7 | This guide walks you through building a custom **engine** — a program that receives a coding task from the Copilot platform, runs an agentic loop against a repository, and streams progress back to users in real time. |
8 | 8 |
|
9 | | -> **📦 Reference Implementation** — See [`github/agent-platform-engine-example`](https://github.com/github/agent-platform-engine-example) for a complete working engine built with this SDK. |
10 | | -
|
11 | 9 | ## What Is an Engine? |
12 | 10 |
|
13 | 11 | An engine is a program that the platform executes when a user triggers a coding task — such as assigning Copilot to an issue, requesting changes on a PR, or invoking a task via the API. The platform creates a **job**, launches your engine in a secure runner environment, and your engine does the work. |
@@ -896,6 +894,69 @@ async function main() { |
896 | 894 | } |
897 | 895 | ``` |
898 | 896 |
|
| 897 | +## Releasing Your Engine |
| 898 | + |
| 899 | +Engines are consumed via **GitHub Releases** rather than by cloning and building the source repository. Each release should contain a self-contained tarball with everything the platform needs to run your engine: the `engine.yaml` definition and your compiled build output. |
| 900 | + |
| 901 | +### Creating a Release |
| 902 | + |
| 903 | +Tag your commit and push the tag — a GitHub Actions workflow builds the project and publishes the release automatically: |
| 904 | + |
| 905 | +```bash |
| 906 | +git tag v1.0.0 |
| 907 | +git push origin v1.0.0 |
| 908 | +``` |
| 909 | + |
| 910 | +### Release Workflow |
| 911 | + |
| 912 | +Add a workflow that triggers on version tags, builds your engine, and attaches the artifact to a GitHub Release. |
| 913 | + |
| 914 | +> **Note:** The example below is for a Node.js/TypeScript engine. If your engine uses a different runtime (Python, Go, Rust, etc.), substitute the appropriate setup, dependency installation, and build steps, and adjust the artifact paths to match your compiled output. |
| 915 | +
|
| 916 | +```yaml |
| 917 | +# .github/workflows/release.yml |
| 918 | +name: Release |
| 919 | + |
| 920 | +on: |
| 921 | + push: |
| 922 | + tags: |
| 923 | + - 'v*' |
| 924 | + |
| 925 | +permissions: |
| 926 | + contents: write |
| 927 | + |
| 928 | +jobs: |
| 929 | + release: |
| 930 | + runs-on: ubuntu-latest |
| 931 | + steps: |
| 932 | + - uses: actions/checkout@v4 |
| 933 | + |
| 934 | + - uses: actions/setup-node@v4 |
| 935 | + with: |
| 936 | + node-version: 20 |
| 937 | + cache: npm |
| 938 | + |
| 939 | + - run: npm ci |
| 940 | + |
| 941 | + - run: npm run build |
| 942 | + |
| 943 | + - name: Create release tarball |
| 944 | + run: tar -czf engine.tar.gz engine.yaml dist/ |
| 945 | + |
| 946 | + - name: Create GitHub Release |
| 947 | + uses: softprops/action-gh-release@v2 |
| 948 | + with: |
| 949 | + files: engine.tar.gz |
| 950 | + generate_release_notes: true |
| 951 | +``` |
| 952 | +
|
| 953 | +### What to Include in the Release |
| 954 | +
|
| 955 | +Your release artifact must include `engine.yaml` and everything it references. The `entrypoint` in `engine.yaml` is resolved as a relative path, so any files or directories it points to need to be in the tarball alongside it. For example, if your entrypoint is `node dist/index.js`, then `dist/index.js` (and any of its runtime dependencies) must be present. |
| 956 | + |
| 957 | +The release should be self-contained — the platform should be able to extract it and run the entrypoint without cloning the repo, installing dependencies, or building from source. This means your build output must include all runtime dependencies. For Node.js engines, either use a bundler (e.g., esbuild, webpack, or ncc) to produce a single self-contained file, or include the `node_modules` directory in the tarball. Other runtimes should follow their equivalent strategy — for example, Go and Rust engines can compile to a static binary, while Python engines might vendor dependencies or include a virtual environment. |
| 958 | + |
| 959 | + |
899 | 960 | ## Architecture Notes |
900 | 961 |
|
901 | 962 | ### Tokens |
|
0 commit comments