Skip to content

An open-source, faster Devin alternative

TypeScript

docs: document github_publish_pull_request runtime tool

Igor Zalutski090c494cc0cd
diff --git a/docs/agent-sessions/repos.mdx b/docs/agent-sessions/repos.mdx
index 3c856c32..f953bd5e 100644
--- a/docs/agent-sessions/repos.mdx
+++ b/docs/agent-sessions/repos.mdx
@@ -10,9 +10,10 @@ token behind a proxy does not narrow that authority.
Repos make GitHub access operation-scoped. A **Repo** records owner/repo plus policy; a
**Source** pins `ref` and `sha`. OpenComputer checks out the exact commit in a short-lived
**Git operations sandbox**, copies only files into `/workspace/sources/<name>`, and
-destroys the token. For writes, the agent supplies files and a requested outcome;
-OpenComputer enforces repo and operation policy, then calls GitHub outside the agent
-sandbox.
+destroys the token. For writes, the agent edits files and calls the
+[`github_publish_pull_request`](/agent-sessions/runtime-tools#github-tools) runtime tool;
+OpenComputer enforces repo and operation policy, then commits and opens the PR outside the
+agent sandbox.
<Note>**Preview** — APIs may change before general availability.</Note>
@@ -222,6 +223,15 @@ After checkout, the agent works with ordinary files. It can inspect, edit, test,
make local commits. Anything needing GitHub credentials runs outside the agent sandbox, so
the agent never runs authenticated `git`/`gh` and never sees a token.
+To open a pull request, the agent calls the
+[`github_publish_pull_request`](/agent-sessions/runtime-tools#github-tools) runtime tool —
+it is **not** an SDK method; the agent invokes it from inside the sandbox. It takes the
+source's local `name` as `source`, a `title`, and optional `body`, `base` (defaults to the
+source's checked-out ref), and `draft`, and returns the PR URL. OpenComputer commits the
+agent's edits to an `oc/<session>/<source>-<id>` branch and opens the PR with a
+just-in-time, write-scoped token. This requires a **configured GitHub App** — the inline
+`risky_short_lived_token` path is checkout-only and **cannot** open PRs.
+
## Guarantees
- **GitHub App-backed tokens are never stored** — OpenComputer obtains short-lived,
diff --git a/docs/agent-sessions/runtime-tools.mdx b/docs/agent-sessions/runtime-tools.mdx
index d6ddab3c..2c5bc553 100644
--- a/docs/agent-sessions/runtime-tools.mdx
+++ b/docs/agent-sessions/runtime-tools.mdx
@@ -30,16 +30,45 @@ To work on a **public** repo, the agent `git clone`s it via `bash` — the sandb
The agent's final `say` is the session result. `ask` ends the turn with `yield_reason: "needs_input"`; answer by [steering](/agent-sessions/messaging) a reply, which wakes the session.
+## GitHub tools
+
+| Tool | What it does |
+| --- | --- |
+| `github_publish_pull_request` | Open a pull request from a checked-out [Repo](/agent-sessions/repos) source. |
+
+`github_publish_pull_request` lets the agent open a PR **without ever holding a GitHub
+credential**. The agent edits files in `/workspace/sources/<source>` and makes local
+commits as usual; calling the tool hands the requested outcome to the platform, which
+commits the agent's edits to an `oc/<session>/<source>-<id>` branch and opens the PR with a
+just-in-time, write-scoped token — outside the agent sandbox. It returns the PR URL.
+
+| Argument | Required | What it is |
+| --- | --- | --- |
+| `source` | yes | The checked-out source's local name (its directory under `/workspace/sources`). |
+| `title` | yes | PR title. |
+| `body` | no | PR description. |
+| `base` | no | PR base branch. Defaults to the source's checked-out ref. |
+| `draft` | no | Open the PR as a draft. |
+
+<Note>
+`github_publish_pull_request` requires a **configured GitHub App** (the OpenComputer App or
+a [bring-your-own App](/agent-sessions/repos#github-app-modes)). It does **not** work with
+inline (`risky_short_lived_token`) auth, which is **checkout-only** — see
+[Repos & GitHub](/agent-sessions/repos#inline-short-lived-token).
+</Note>
+
## External systems
-The tools above do not give the agent credentials for GitHub, Slack, Jira, or other
-external systems. To move a session's output into your product, register a
-[webhook destination](/agent-sessions/webhooks) and handle the delivered events in your
-backend.
+These tools never hand the agent raw credentials for GitHub, Slack, Jira, or other external
+systems — the agent opens PRs through `github_publish_pull_request` above (platform-mediated,
+no token in the sandbox), and other actions go through the platform too. To move a session's
+output into your product, register a [webhook destination](/agent-sessions/webhooks) and
+handle the delivered events in your backend.
## Prompt guidance
- Tell the agent to do all work in the sandbox via `bash`/`read`/`write` — it can't touch your machine.
- **Public repo:** include the URL + branch/commit in the task text and have the agent `git clone` it with `bash`. **Private repo:** register a [Repo](/agent-sessions/repos) and list it in the session's `sources` — checked out before the first turn, no credential in the sandbox.
+- **Opening a PR:** have the agent edit a source under `/workspace/sources/<name>` and call `github_publish_pull_request` with that `source` and a `title` — the platform commits and opens the PR (requires a configured GitHub App; inline tokens are checkout-only).
- Have it `say` a clear final result — that's what `GET /sessions/:id/result` returns.
- Have it `ask` only when it genuinely needs a decision; otherwise it should proceed.