Create merge
Merges a coding run's pull request into the branch it proposes into, on the forge the run pushed to, and answers the pull request after.
POST /v1/agent/coding/{session}/merge
| Address | https://api.hanzo.ai/v1/agent/coding/{session}/merge |
| Method | POST |
| Operation | post_agent_coding_by_session_merge |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Merges a coding run's pull request into the branch it proposes into, on the forge the run pushed to, and answers the pull request after.
The caller must be able to read the run: its person, or an admin of its org. What lands is the run's branch at the commit the forge holds when this asks — a push after that is refused, not merged unseen — and nothing is forced: a pull request that conflicts, was closed, or that a rule on its base keeps from merging is 409 with the forge's reason. One already merged answers as it is.
Request
1 field.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
session | path | string | yes | Session is the run's handle — the sessionId POST /v1/agent/coding answered with — from the path. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | agent.CodingMerged | ok |
default | problem-details | refused |
200 body — 4 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
base | body | string | — | Base is the branch it was merged into. |
number | body | integer (int64) | — | Number is the pull request's number in its repository. |
state | body | string | — | State is merged. |
url | body | string | — | URL is where it is read. |
Failure carries the platform error shape — see Errors.
Examples
hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.
import { Configuration, AgentApi } from 'hanzoai';
const api = new AgentApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postAgentCodingBySessionMerge({ session: 'session' });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_merge(session='session')cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.AgentAPI.PostAgentCodingBySessionMerge(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_merge(&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).postAgentCodingBySessionMerge();curl -X POST https://api.hanzo.ai/v1/agent/coding/<session>/merge \
-H "Authorization: Bearer $HANZO_API_KEY"MCP reaches agent through the agent tool, which names its 38 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"
}
}
}'