Work with your GitHub repos
Connect GitHub once. From then on you, your teammates and your agents can start a sandbox or a run from any repo you picked, work on it, and send the changes back as a branch or a pull request, from the web app, the CLI, the SDKs, the API or MCP. Nobody pastes a token, and the sandbox never holds a GitHub token: git in the sandbox goes through kosa8's git proxy, which adds the token on kosa8's side.
1. Connect GitHub once#
An owner or admin of your kosa8 organization connects the kosa8 GitHub App to a GitHub account or organization. It does not matter how you signed in to kosa8; signing in with GitHub does not give kosa8 access to your repos, this step does.
- Web app: app.kosa8.com/auth/github/connect, or Settings, GitHub, Connect GitHub. You come back to Settings, GitHub with the installation linked to your organization.
- CLI:
kosa8 github connectopens the same page in your browser and waits until the connection is made.kosa8 githubshows what is connected.
GitHub asks where to install the app and which repos it may see: All repositories, or
Only select repositories and a list. We recommend All repositories: every repo you
have, and every new one, is then ready in kosa8 with nothing more to do. With a list, the web app and
GET /v1/github show the installation's add_repos_url with a reminder, and
the repo list carries selected_installations with the same link. You can change the
choice on GitHub at any time; kosa8 sees the change within a minute. Connect more than one GitHub
account or organization by repeating the step.
The permissions the app asks for#
| Permission | Why kosa8 needs it |
|---|---|
| Contents: Read and write | Clone a repo into a sandbox, and push a branch with the sandbox's changes |
| Pull requests: Read and write | Open a pull request for that branch |
| Metadata: Read-only | List your repos and branches (GitHub requires it for every app) |
| Checks: Read and write | Show a pipeline's or run's result on the commit and its pull request, with a link back to kosa8 |
| Commit statuses: Read and write | The same as a commit status, where checks are not accepted |
| Issues: Read and write | Only for @kosa8 comments on issues: react with 👀 and post one reply, updated in place (on pull requests the reply uses Pull requests: Read and write, but GitHub sends comment events only to apps with Issues). kosa8 never edits, closes or labels your issues |
| Administration: Read and write | Only for GitHub Actions runners: GitHub requires it to register a just-in-time runner on a repository (generate-jitconfig) and to remove one. Repos, pull requests, pipelines and @kosa8 comments never use it. |
| Workflows: Read and write | Only for Move my workflows to kosa8: when an admin asks, one pull request from kosa8/runners that changes runs-on: ubuntu-* to a kosa8 runner in .github/workflows/, with one token for that one repo (workflows: write and contents: write, plus pull_requests: write to open it), revoked right after. You merge it; kosa8 never does. Sandbox pushes, pipelines and @kosa8 never use it, so they cannot change your CI. |
| Actions: Read-only | Only so GitHub sends the workflow_job event that tells kosa8 a runs-on: kosa8 job is waiting. No kosa8 token names it. |
| Email addresses (account): Read-only | Sign in with GitHub: your verified email address, read once to find your kosa8 account |
The GitHub App permissions page has each permission's
"used for" and "never used for", the exact token every operation asks for, the webhook events, and how
to check it all yourself. Every token kosa8 asks GitHub for names exactly the permissions of its step from this table, for
one repo where the step has one, and each is in the audit log as github.token. A
permission the app holds but no step names is never in any token. If GitHub's page for the app shows
more permissions than this table, kosa8 does not use them. Without Checks and
Commit statuses everything still works; results just do not show on GitHub, and the run's
github.missing_permissions says what to accept. If you installed the
app before it asked for these, GitHub shows a banner on the installation's page saying the app
requests new permissions. Open Settings, GitHub in the web app (or run
kosa8 github): any missing permission is listed with a link straight to that page,
where you press Review request and Accept new permissions. Until you do, cloning
works but pushing or opening a pull request answers github_permissions with the same
link.
2. Pick a repo#
Everyone in the organization who can create sandboxes can use the connected repos; connecting and disconnecting stays with admins. The repo picker in the web app (on Run, New sandbox, Pipelines and the RL and eval job forms) shows the most recently pushed repos first, with search and a branch list.
kosa8 github repos # recent first kosa8 github repos api # search by name
A repo is owner/name, optionally with a branch, tag or commit after
@: acme/api@main, acme/api@v2.1.0,
acme/api@3f2c9e1. Without one, kosa8 uses the repo's default branch. In a git checkout
on your machine, --repo . means this checkout's GitHub remote and current branch.
3. Start from a repo, then open a pull request#
The repo is cloned into /workspace/<name> (a shallow clone; set
path or depth to change that). A one-call run runs its command in the
checkout. When the work is done, one call commits everything that changed, pushes it to a new branch
(kosa8/<sandbox id> unless you name one) and opens a pull request, a draft unless
you say otherwise.
kosa8 github connect # once: opens GitHub, waits until connected kosa8 github repos api # repos you can use, recent first kosa8 run --cloud --repo acme/api "npm ci && npm test" # runs in the checkout kosa8 cloud sandbox create --repo acme/api@main # cloned into /workspace/api kosa8 cloud sandbox exec sbx_… -- sh -c 'cd /workspace/api && make fix' kosa8 cloud sandbox pr sbx_… --title "Fix flaky test" # push a branch, open a draft PR
# Start a sandbox from a repo (a branch, tag or sha after @) curl -s https://api.kosa8.com/v1/sandboxes \ -H "Authorization: Bearer $KOSA8_API_KEY" -H 'Content-Type: application/json' \ -d '{"repo": "acme/api@main"}' # "repo":{"full_name":"acme/api","ref":"main","sha":"3f2c…","path":"/workspace/api","status":"cloned"} # ... change files with exec, then push a branch and open a draft pull request curl -s -X POST https://api.kosa8.com/v1/sandboxes/sbx_…/github/pull-request \ -H "Authorization: Bearer $KOSA8_API_KEY" -H 'Content-Type: application/json' \ -d '{"title": "Fix flaky test"}' # {"number":42,"url":"https://github.com/acme/api/pull/42","branch":"kosa8/…","sha":"9b1e…"}
from kosa8 import Kosa8Cloud cloud = Kosa8Cloud() # reads KOSA8_API_KEY repos = cloud.github.repos("api") # recent first with cloud.sandboxes.create(repo="acme/api@main") as box: # cloned into /workspace/api box.exec(["sh", "-c", "cd /workspace/api && pip install -e . && pytest -q"]) pr = box.pull_request(title="Fix flaky test") # a draft PR print(pr["url"]) run = cloud.run(command="pytest -q", repo="acme/api") # one call, runs in the checkout
import { Kosa8Cloud } from '@kosa8/sdk'; const cloud = new Kosa8Cloud(); // reads KOSA8_API_KEY const repos = await cloud.github.repos('api'); // recent first const box = await cloud.sandboxes.create({ repo: 'acme/api@main' }); // cloned into /workspace/api try { await box.exec('cd /workspace/api && npm ci && npm test'); const pr = await box.pullRequest({ title: 'Fix flaky test' }); // a draft PR console.log(pr.url); } finally { await box.delete(); } const run = await cloud.run({ command: 'npm test', repo: 'acme/api' }); // one call, runs in the checkout
package main import ( "context" "fmt" "log" kosa8 "github.com/kosa8ai/kosa8-go" ) func main() { ctx := context.Background() cloud, err := kosa8.NewCloud(kosa8.CloudOptions{}) // reads KOSA8_API_KEY if err != nil { log.Fatal(err) } repos, err := cloud.GitHub.Repos(ctx, "api") // recent first if err != nil { log.Fatal(err) } fmt.Println(len(repos), "repos") box, err := cloud.Sandboxes.Create(ctx, kosa8.CloudCreateOptions{Repo: kosa8.Repo("acme/api@main")}) // cloned into /workspace/api if err != nil { log.Fatal(err) } defer box.Delete(ctx) if _, err := box.Exec(ctx, []string{"sh", "-c", "cd /workspace/api && go test ./..."}, nil); err != nil { log.Fatal(err) } pr, err := box.PullRequest(ctx, &kosa8.CloudPullRequestOptions{Title: "Fix flaky test"}) // a draft PR if err != nil { log.Fatal(err) } fmt.Println(pr.URL) }
require "kosa8" cloud = Kosa8::Cloud.new # reads KOSA8_API_KEY repos = cloud.github.repos("api") # recent first box = cloud.sandboxes.create(repo: "acme/api@main") # cloned into /workspace/api begin box.exec(["sh", "-c", "cd /workspace/api && bundle install && bundle exec rake test"]) pr = box.pull_request(title: "Fix flaky test") # a draft PR puts pr["url"] ensure box.delete end
import com.kosa8.*; public class Main { public static void main(String[] args) throws Exception { Kosa8Cloud cloud = Kosa8Cloud.builder().build(); // reads KOSA8_API_KEY var repos = cloud.github().repos("api"); // recent first CloudSandbox box = cloud.sandboxes().create( new CloudOptions.Create().repo("acme/api@main")); // cloned into /workspace/api try { box.exec("cd /workspace/api && ./gradlew test"); var pr = box.pullRequest(new CloudOptions.PullRequest().title("Fix flaky test")); // a draft PR System.out.println(pr.get("url")); } finally { box.delete(); } } }
repo, github, push and pull request) come with
the next release of each SDK, after Python and JavaScript 0.8.0 and Go, Ruby and Java 0.7.0. Until
then use the API, the CLI, MCP or the web app.In the web app, a sandbox started from a repo has a Repo panel: the repo and branch, the commit, how many files changed, and Push branch and Open pull request buttons that link to the result on GitHub. The command palette (⌘K) has Open repo in sandbox.
From your AI agent (MCP)#
The kosa8 Cloud MCP server has the same abilities as tools, so Claude, Cursor, Codex or any MCP client can do it for you:
github_reposlists or searches the repos it may use;sandbox_createtakesrepo("acme/api@main");open_pull_requesttakes asandbox_idand an optionaltitleandbody, and answers with the pull request's link.
Ask it something like "start a sandbox from acme/api, fix the failing test and open a pull request".
The API#
| Call | What it does |
|---|---|
GET /v1/github | Whether GitHub is connected, the installations, the permissions each one lacks, and (admins) install_url |
GET /v1/github/repos?q=&page= | Every repo you can use (all pages from GitHub, up to 2,000 per installation; past that truncated), most recently pushed first; next_page for more; q searches all of them |
GET /v1/github/repos/{owner}/{repo}/branches | The default branch and the first 100 branches |
POST /v1/sandboxes, POST /v1/run with repo | "owner/name", "owner/name@ref" or {"name", "ref", "path", "depth"}. The answer's repo block has full_name, ref, sha, path and status: cloned, pending (a sandbox still booting; the clone finishes when it is ready) or failed with error |
GET /v1/sandboxes/{id}/repo | The repo block plus changes (files changed, insertions, deletions); retries a pending clone |
POST /v1/sandboxes/{id}/github/push | {"branch", "message", "path"}, all optional. Commits everything and pushes; answers branch, sha, compare_url, files_changed |
POST /v1/sandboxes/{id}/github/pull-request | {"title", "body", "base", "branch", "draft"}, all optional (draft defaults to true). Pushes, then opens the pull request; answers number, url, branch, sha |
The commit's author is kosa8 <bot@kosa8.com>, with a
Co-authored-by line for you when kosa8 knows your email, so the pull request shows
who asked for it. The full schemas are in the API reference.
When something is not right#
| Code | What it means and what to do |
|---|---|
409 github_not_connected | No GitHub is connected to this organization. An admin opens connect_url (or runs kosa8 github connect). |
404 repo_not_found | None of the organization's installations can see that repo. Check the name, or add the repo to the installation's list on GitHub. |
409 github_permissions | The installation lacks the permissions in missing. Accept them at settings_url. |
409 no_changes | Nothing changed in the checkout, so there is nothing to push. |
502 github_unavailable | GitHub did not answer or is rate limiting; try again after retry_after_s. |
| SDK | Errors (with the links on them) |
|---|---|
| Python | Kosa8GitHubNotConnectedError, Kosa8GitHubPermissionsError, Kosa8NoChangesError, Kosa8RepoNotFoundError, Kosa8GitHubUnavailableError; e.connect_url, e.settings_url, e.missing_permissions |
| JavaScript | Kosa8GitHubNotConnectedError, Kosa8GitHubPermissionsError, Kosa8NoChangesError, Kosa8RepoNotFoundError, Kosa8GitHubUnavailableError; e.connectUrl, e.settingsUrl, e.missingPermissions |
| Go | errors.Is(err, kosa8.ErrGitHubNotConnected) (also ErrGitHubPermissions, ErrNoChanges, ErrRepoNotFound, ErrGitHubUnavailable); *kosa8.Error has ConnectURL, SettingsURL, MissingPermissions |
| Ruby | Kosa8::GitHubNotConnectedError, GitHubPermissionsError, NoChangesError, RepoNotFoundError, GitHubUnavailableError; e.connect_url, e.settings_url, e.missing_permissions |
| Java | Kosa8Exception.GitHubNotConnectedException, GitHubPermissionsException, NoChangesException, RepoNotFoundException, GitHubUnavailableException; connectUrl(), settingsUrl(), missingPermissions() |
The 409 errors are still each SDK's conflict error and repo_not_found its not-found
error, so code that already catches those keeps working. Go, Ruby and Java take repo
on sandbox create; the one-call run with repo is in Python, JavaScript, the CLI and the
API.
4. Use your repos everywhere in kosa8#
The same connection works for every kosa8 feature that takes code. Give repo where
you would give a URL, a token or the code itself.
Pipelines: no token, no webhook#
Connect a pipeline to a repo and it runs on every push and pull request. There is no webhook to add on GitHub and no token secret: the kosa8 GitHub App already receives the repo's pushes and pull requests and clones it with a read-only token for each run.
# connect (an admin): runs on push and on pull request curl -X POST https://api.kosa8.com/v1/pipelines/hooks -H "Authorization: Bearer $KOSA8_API_KEY" \ -d '{"repo": "acme/api", "events": ["push", "pull_request"]}' # or run once now, at the default branch or any ref curl -X POST https://api.kosa8.com/v1/pipelines/runs -H "Authorization: Bearer $KOSA8_API_KEY" \ -d '{"repo": "acme/api@feature-x"}'
events is optional (both by default); workflow, size,
secrets, timeout_s and cron work as for any pipeline. The
answer's hook has connection: "github_app" and no URL. Pull requests from forks never
run, because their code would get the pipeline's secrets. kosa8 ci and
pipeline_run (MCP) take repo too.
Results on your commits and pull requests#
Every pipeline run of a connected repo shows on GitHub as a check run named
kosa8/pipelines: in progress while it runs, then passed or failed, with
Details linking to the run in kosa8. The run's github field says how it was
reported (check_run or commit_status). A one-call run can do the same:
add "github_check": true (or a name such as "kosa8/tests") to
POST /v1/run with repo, and its result goes on the commit it cloned, so a
pull request from that branch shows it.
curl -X POST https://api.kosa8.com/v1/run -H "Authorization: Bearer $KOSA8_API_KEY" \ -d '{"repo": "acme/api@feature-x", "command": "npm test", "github_check": "kosa8/tests"}'
Work from GitHub: @kosa8 comments#
Comment on a pull request or an issue of a connected repo (the full guide:
@kosa8 in issues and pull requests):
| Comment | What happens |
|---|---|
@kosa8 run npm test | A fresh sandbox clones the pull request's head commit (on an issue: the default branch) and runs the command there. One reply shows the status, the sandbox, how long it ran, what it cost and its egress (packets allowed and refused), then ✅ or ❌ with the last lines of output. On a pull request a check run named kosa8 carries the same evidence. |
@kosa8 agent fix the flaky login test | Your organization's coding agent (Claude Code, Codex or Gemini CLI) makes the change in a sandbox, and kosa8 opens a draft pull request from a kosa8/agent-… branch, with the kosa8 check run on its commit. kosa8 never pushes to your default branch, never marks a pull request ready, approves or merges. Not on pull requests from forks. |
Who can trigger. Only people GitHub says have write, maintain or admin permission on the
repo. Comments by bots and apps (kosa8's own included) never trigger, edited comments never do, and
quoted lines, code and hidden HTML comments are ignored, so text a reader cannot see never reaches a
sandbox or an agent. Anyone else's @kosa8 is ignored without a reply.
Turn it on. Comment triggers are off until an admin turns them on, in one call:
curl -X PUT https://api.kosa8.com/v1/github/automation -H "Authorization: Bearer $KOSA8_API_KEY" \ -d '{"triggers": true}'
Other settings, all optional: commands (any, allowlist with
allowed_commands such as ["npm test*", "make check"], or off),
agent ({"kit": "claude", "secret": "anthropic"}: the model key is a kosa8
secret held at the sandbox's egress broker, never inside the sandbox), max_runtime_s
(default 1800), budget_usd per trigger (default 2: the run stops there),
size (default 2x4), egress (registries, the default: package
registries and GitHub only; or open) and check_runs (default on). Each
trigger is billed as sandbox time like any sandbox; an agent's model use is on your own key. At most
5 triggers run at once per organization, 30 per repo an hour, and 5 agent runs per repo an hour.
GET /v1/github/triggers lists recent ones. On an issue, kosa8 needs the Issues
permission above; until the installation accepts it, @kosa8 on issues is ignored and
GET /v1/github/automation lists issues:write under
missing_permissions.
A sandbox's own pull request (POST /v1/sandboxes/{id}/github/pull-request, the Open
pull request button, kosa8 cloud sandbox pr) gets the kosa8 check run too:
the sandbox's last commands and their exit codes, how long it ran, what it cost so far and its
egress counts.
Functions, templates and RL or eval jobs#
For these kosa8 reads the code from GitHub itself, at one commit, and records which:
| Feature | Request | What it takes |
|---|---|---|
| Function | PUT /v1/functions/{name} {"runtime": "python3.12", "repo": {"name": "acme/api", "path": "fn/handler.py"}} | That file as the code (up to 1 MiB). The function's source names the commit. |
| Template | POST /v1/templates {"name": "api-env", "repo": "acme/api"} | The repo's Dockerfile (or path). Template builds have no build context yet, so a Dockerfile that copies files from the repo (COPY ., ADD) is refused with dockerfile_needs_context; for those, start a sandbox from the repo instead. |
| RL or eval job | POST /v1/jobs with "solver": {"cmd": "...", "repo": {"name": "acme/agent", "path": "agent"}} (and grader.repo) | Every file of that folder (default the whole repo) at one commit, under to (default /workspace/<repo name>) in every task's sandbox, within the job's file limits (256 KiB for the solver, 1 MiB for the grader, 64 files a side). The grader's stay sealed from the solver. |
The security model, in plain words#
- One repo per token. For every clone, push or pull request kosa8 asks GitHub for a new token that works on that one repo only, with only the permission that step needs: read for a clone or to read code, write for a push, write plus pull requests for a pull request, checks or commit statuses to show a result. Each one is revoked as soon as its step is done.
- An hour at most. GitHub makes these tokens expire within an hour. kosa8 does not keep them: they are not stored, not logged, and no API call returns one.
- Never inside the sandbox. No GitHub token ever enters a sandbox: not its files, its
environment, its git config or any command's arguments. For a clone or a push, git in the sandbox
talks to kosa8's git proxy (
https://api.kosa8.com/git/…), and the proxy adds the token on kosa8's side, on the way to GitHub. For functions, templates and jobs kosa8 reads the code itself, and no sandbox is involved. The checkout's remote is the plainhttps://github.com/owner/name.git. - What the sandbox gets instead. For one clone or one push, kosa8 makes a random
capability: a link that works only through kosa8's proxy, only for that sandbox and that
one repo, only for reading (a clone or a pipeline checkout) or only for pushing, and for minutes
at most. kosa8 deletes it as soon as that git command ends. It is handed to that one command (not
written to disk or to
.git/config), kept only as a hash, and never logged. - Pushes go to kosa8's own branches. Before a push reaches GitHub, the proxy reads which
refs it updates and refuses the whole push unless every one is a branch under
kosa8/or the one branch you named for that push. Tags, other branches, other refs and branch deletes are refused, and git shows the reason (! [remote rejected] main -> main (kosa8 pushes only to branches kosa8/*, not main)). - What is left, stated plainly. While the clone or push command runs, other code in the
same sandbox (an agent that has gone wrong, say) could read that command's capability and use it
itself until kosa8 deletes it: for a clone, to read the same repo; for a push, to push to
kosa8/*branches (or the branch you named) of the same repo. It can never get a GitHub token, reach another repo, push a tag, delete a branch, or keep access after the command ends. - Your organization only. A member can use only repos of the GitHub installations linked to their own kosa8 organization.
- Audited. Every token kosa8 asks for is written to the
audit log (
github.token, with the repo, the permission, what it was for and the sandbox), and so is every request through the git proxy (github.git, withopupload or receive and, for a push, the refs it updated or was refused), every clone (github.clone), push (github.push) and pull request (github.pr).
For each 2025 and 2026 GitHub agent incident pattern, step by step, and where this design does and does not break it, read What if kosa8 were breached?
Your own egress rules still apply to the code in the sandbox, and the sandbox never needs
github.com for a clone or a push: only kosa8's API host. If the sandbox's policy does not reach it,
kosa8 adds api.kosa8.com (nothing else) to its allow-list for the clone or push command
alone, and puts your policy back as soon as that command ends. If your organization's enforced
egress policy denies github.com by name, kosa8 refuses instead of going around it. Pull requests go
through GitHub's normal review and branch protection, so nothing reaches your main branch unless a
person merges it.
Limits#
- Clones and fetches stream through the proxy, so the proxy sets no size limit on them. The clone
command in a sandbox has 85 seconds; a shallow clone (the default,
depth: 1) of most repos takes a few seconds. For a very large repo, keepdepthat 1. - One push can send at most 100 MB (Cloudflare's upload limit for the kosa8 API). A bigger push
fails with
push_too_large: push less at once, and keep large binaries in Git LFS or a release. - Signed pushes (push certificates) are not supported.
Disconnect#
An admin can disconnect at any time: Settings, GitHub, Disconnect in the web app,
or kosa8 github disconnect INSTALLATION_ID (the id is in kosa8 github).
That unlinks the installation from your kosa8 organization at once. To remove the app from GitHub
too, uninstall it from the installation's page on GitHub
(Settings, Applications, Installed GitHub Apps, or your GitHub organization's settings), which
also revokes any token still alive.
See also#
- GitHub App permissions: used for, never used for, and every token.
- What if kosa8 were breached?
@kosa8in issues and pull requests.- Move your GitHub Actions to kosa8 runners.
- One-call run, which takes
repotoo. - Pipelines: connect a repo with
{"repo": "owner/name"}; no token secret, no webhook. - MCP server and Connect Claude, Cursor, Codex.
- The audit log and Security Center.
Something wrong or missing? Write to contact@kosa8.com.