Create events

An executor's report for the task it holds: status changes, the lead's coordinator address, metrics, log lines, stored artifacts and, last, the lead's result.

POST /v1/train/jobs/{id}/events

Addresshttps://api.hanzo.ai/v1/train/jobs/{id}/events
MethodPOST
Operationpost_train_jobs_by_id_events
AuthAuthorization: Bearer $HANZO_API_KEY

An executor's report for the task it holds: status changes, the lead's coordinator address, metrics, log lines, stored artifacts and, last, the lead's result. It must carry the task's lease; a report under any other is 409 lease_lost and the executor stops. A report with no events is a heartbeat, due at least every report seconds the claim answered — a task silent for the lease's life is lost, and a lost lead fails its job. Each report meters the task by the clock: its devices times the seconds since it was claimed, no more than is held, charged to the job's payer for a job Hanzo runs. The answer says how many device-seconds are held now. When the next window cannot be held and what is held runs low, the job ends stopped and the answer says cancel: kill the trainer and report nothing more. Once the job has ended a report records nothing and answers the job's status; cancel says it was cancelled or stopped.

Request

5 fields, body application/json (required).

FieldInTypeRequiredDescription
idpathstringyesID names the job, from the path.
eventsbodyany[]—Events are the task's new events, in order.
idbodystring—ID names the job, from the path.
leasebodystring—Lease is the task's lease, as the claim answered it.
taskbodystring—Task is the reporting task.

Response

StatusBodyMeaning
200train.reportOutok
defaultproblem-detailsrefused

200 body — 4 fields.

FieldInTypeAlwaysDescription
cancelbodyboolean—Cancel says the job was cancelled, or stopped at what its payer or its own bounds could hold: kill the trainer, report nothing more.
heldbodyinteger (int64)—Held is the device-seconds held for the task now.
seqbodyinteger (int64)—Seq is the job's last event seq.
statusbodystring—Status is the job's status after this report.

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, TrainApi } from 'hanzoai';

const api = new TrainApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postTrainJobsByIdEvents({ id: 'id', events: ["<events>"], id: "<id>" });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import TrainApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = TrainApi(client).post_train_jobs_by_id_events(id='id', events=["<events>"], id="<id>")
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.TrainAPI.PostTrainJobsByIdEvents(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, train_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = train_api::post_train_jobs_by_id_events(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.TrainApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new TrainApi(client).postTrainJobsByIdEvents();
curl -X POST https://api.hanzo.ai/v1/train/jobs/<id>/events \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "events": [
         "<events>"
       ],
       "id": "<id>"
     }'

MCP declares no tool for train — tools/list on https://api.hanzo.ai/v1/mcp names the products it does reach. Use HTTP or an SDK.


Train API · All Hanzo APIs · Interactive reference

Was this page useful?