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

Addresshttps://api.hanzo.ai/v1/agent/coding/{session}/pull
MethodPOST
Operationpost_agent_coding_by_session_pull
AuthAuthorization: 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).

FieldInTypeRequiredDescription
sessionpathstringyesSession is the run's handle, from the path.
basebodystring—Base is the branch to propose into.
bodybodystring—Body is its description.
draftbodyboolean—Draft opens it as a draft, which a reviewer cannot merge until it is ready.
sessionbodystring—Session is the run's handle, from the path.
titlebodystring—Title is the pull request's title.

Response

StatusBodyMeaning
200agent.CodingPulledok
defaultproblem-detailsrefused

200 body — 3 fields.

FieldInTypeAlwaysDescription
basebodystring—Base is the branch it proposes into.
numberbodyinteger (int64)—Number is the pull request's number in its repository.
urlbodystring—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"
         }
       }
     }'

Agent API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.