Coding agents
A coding agent works in a real GitHub repo: clone, install, run the repo's tests, push under m8tes/…, open a PR, watch CI. Same sandbox as every other run, plus a short-lived GitHub credential narrowed to the repos your install can see.
API first. Setup is on
/api/v2+ the Python SDK. The Platform Apps page and mate Configure row call the same APIs.
Setup (API / SDK)
Account-scoped, not per user_id. Check status, then pick a path:
from m8tes import M8tes
client = M8tes(api_key="m8_...")
print(client.github_app.status())Install the m8tes GitHub App
url = client.github_app.install_url()
# Open url. Pick **selected repositories only**. After GitHub redirects with a ticket:
client.github_app.claim(ticket="…")Create your GitHub App
Use this when the m8tes GitHub App is gated, or you want your own branding / allowlists.
status = client.github_app.status()
url = client.github_app.setup_url(cancel_epoch=status.manifest_epoch) # optional: org="acme", name="Acme Code"
print(url)Open that URL. GitHub creates the App and sends you back with a ticket:
install_url = client.github_app.complete_setup(ticket="…")
# Open install_url. Pick **selected repositories only**. After GitHub:
client.github_app.claim(ticket="…")Already have an App? client.channels.upsert_identity(channel="github", …). After disconnect, client.github_app.clear_identity() goes back to the m8tes GitHub App.
Bind repos to an agent (optional. Once connected, empty agents inherit the install's repos automatically):
# Repo bindings are account-scoped: end-user agents never get repo-write credentials.
# Personal development only: this disables strict user_id checks account-wide.
# This persists. For customer-facing apps, keep strict mode on and pass user_id.
client.settings.update(require_end_user_id=False)
agent = client.agents.create(name="coder")
client.agents.configure_repo(agent.id, repo_full_name="acme/api", mode="trusted")
print(client.agents.list_repos(agent.id).data)Trusted is local-Claude-Code parity for your own repos (push/merge gated by the agent's permission mode). Guarded never merges, requires branch protection, and keeps setup/test/lint commands inert until you approve them via approve_repo_commands.
Repo secrets (the run's .env)
Most test suites need what a developer's .env holds: a test database URL, a sandbox API key. Store them per repo binding. Values are write-only and encrypted at rest; every read returns key names and rotation times only.
repo = client.agents.list_repos(agent.id).data[0]
client.agents.set_repo_env(agent.id, repo.id, env={
"DATABASE_URL": "postgres://localhost/app_test",
"STRIPE_KEY": "sk_test_…",
})
print([k.key for k in client.agents.get_repo_env(agent.id, repo.id).keys])
client.agents.delete_repo_env_key(agent.id, repo.id, "STRIPE_KEY")set_repo_env replaces the whole set (a key you omit is removed). Values must be 8-8192 characters; shorter ones are refused because the sandbox could not redact them from run output. At run start the sandbox writes the set to a 0600 file and points $CODING_REPO_ENV_FILE at it; the agent sources it before the repo's setup/test commands. The values never enter the model's context, the CLI environment, or the run output.
In guarded mode the repository's own code runs as the same user and can read that file. Store only what you would put in that repo's CI secrets.
Setup (Platform)
In the browser, open Apps → GitHub:
The default install lets you choose your organization or personal account on GitHub. Select Only select repositories.
Custom setup opens GitHub in a new tab, with a checklist kept on Apps. Organization ownership is the default; personal ownership requires an explicit choice. Private apps can only be installed on their owner's account. For example, a repository URL like https://github.com/acme/api identifies acme as the organization, not an enterprise.
If a custom app was created under the wrong account, choose Switch to m8tes to clear its connection here. Then install m8tes or create a new custom app under the right organization. This does not transfer the existing app on GitHub.
How access works
To revoke GitHub for the whole account: client.github_app.disconnect() or disconnect under Apps.
Multi-tenant user_id
Installs and MateRepo bindings are account-scoped. Runs created with user_id (end-user isolation) do not receive the account's repo-write credential (prepare_coding_run skips them). Per-tenant coding installs are not shipped yet.
White-label / own App: setup_url() or channels.upsert_identity(channel="github") stores your GitHub App credentials; coding installs then use YOUR App (JWT, webhook, install URL) instead of the m8tes GitHub App. Same L1–L4 safety model.
What to run
Open a PR that bumps <dependency> and keeps the suite green.Skills the agent loads when a repo is available: setting-up-a-repo (first-run toolchain) and working-in-a-repo (fix → test → push → PR).
Ask from GitHub
A comment that mentions @m8tes-ai starts a run.
@m8tes-ai the null check on line 12 is still missingOn a pull request the agent pushes to that pull request's branch. It opens no second pull request and does not merge.
- Who can ask. The repository's owner, members of its organization, and collaborators. A mention from anyone else starts nothing.
- What counts. The handle in the running text of a new comment, where GitHub shows it as a link. Inside backticks, a code block, a link, or a quote it does not count, so quoting an earlier request is safe. A pull request or issue description does not count. Neither does editing a comment to add the handle: post a new one.
- One run per thread. While a run is working on that pull request or issue, another mention goes to the same run. Later reviews and CI results on the pull request reach it too.
- Approvals. The run uses that agent's permission mode, so a push can wait for approval in the app.
- Pull requests from a fork. The App cannot push to a fork's branch. A review or a comment on a line starts nothing there. A plain comment starts a run that answers with review comments instead of pushing.
- Nothing started? On a pull request the comment reaches the agent named Reviewer, or exactly one other coding agent bound to that repository. Only the Lead mate, or two or more and none is named Reviewer, starts nothing. Name one
Reviewer. On an issue: the account has no Lead mate. - Your own GitHub App. Mention that App's handle instead of
@m8tes-ai.
GitHub's comment box suggests people and teams, never a GitHub App. Type the handle in full.
Related
- Computer use: desktop/browser in the same sandbox
- Agents: creating and running agents
- Users:
user_idisolation - Human-in-the-loop: permission modes that gate merges and shell
- API reference:
github-appandagents/{id}/repos