Create pull
Opens the pull request for the branch a coding run pushed, as the run's person and with no agent run, and answers its number and address.
POST /v1/agent/coding/{session}/pull
| Address | https://api.hanzo.ai/v1/agent/coding/{session}/pull |
| Method | POST |
| Operation | post_agent_coding_by_session_pull |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Opens the pull request for the branch a coding run pushed, as the run's person and with no agent run, and answers its number and address.
A run pushes its branch and stops; the pull request is the step after, taken when the work is ready. A run that already has an open pull request, or a branch that has one on its host, answers with that one, so asking twice is safe. Title, body, base and draft are optional: the title and body come from the run's task, the base is the branch the run started from, and draft opens it as one a reviewer cannot merge yet. The run's branch must be on its host: a run that pushed nothing, or has not pushed yet, is 409. Who may is who may read the run, and the pull request is read back at GET /v1/agent/coding/{session}/changes.
Request
6 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
session | path | string | yes | Session is the run's handle, from the path. |
base | body | string | — | Base is the branch to propose into. |
body | body | string | — | Body is its description. |
draft | body | boolean | — | Draft opens it as a draft, which a reviewer cannot merge until it is ready. |
session | body | string | — | Session is the run's handle, from the path. |
title | body | string | — | Title is the pull request's title. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | agent.CodingPulled | ok |
default | problem-details | refused |
200 body — 3 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
base | body | string | — | Base is the branch it proposes into. |
number | body | integer (int64) | — | Number is the pull request's number in its repository. |
url | body | string | — | URL is where it is read. |
Failure carries the platform error shape — see Errors.
Examples
hanzo agent coding pull <session>import { Configuration, AgentApi } from 'hanzoai';
const api = new AgentApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postAgentCodingBySessionPull({ session: 'session', base: "<base>", body: "<body>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AgentApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AgentApi(client).post_agent_coding_by_session_pull(session='session', base="<base>", body="<body>")cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.AgentAPI.PostAgentCodingBySessionPull(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, agent_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = agent_api::post_agent_coding_by_session_pull(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AgentApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new AgentApi(client).postAgentCodingBySessionPull();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl -X POST https://api.hanzo.ai/v1/agent/coding/<session>/pull \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"base": "<base>",
"body": "<body>"
}'MCP reaches agent through the agent tool, which names its 51 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_agents"
}
}
}'