Create task

Hands the runner a job to execute, if its pool has one, and answers immediately either way.

POST /v1/runner/task

Addresshttps://api.hanzo.ai/v1/runner/task
MethodPOST
Operationpost_runner_task
AuthAuthorization: Bearer $HANZO_API_KEY

Hands the runner a job to execute, if its pool has one, and answers immediately either way. A runner sends the queue version it last saw; when it matches, nothing has been queued since and no lease transaction is opened.

Request

3 fields, body application/json (required).

FieldInTypeRequiredDescription
x-runner-uuidheaderstring—
x-runner-tokenheaderstring—
queuebodyinteger (int64)—Queue is the queue version the runner last saw.

Response

StatusBodyMeaning
200runner.TaskOutok
defaultproblem-detailsrefused

200 body — 38 fields.

FieldInTypeAlwaysDescription
queuebodyinteger (int64)—Queue is the forge's current queue version, to ask against next time.
taskbodyrunner.Task—
task.contextbodyrunner.Context—
task.context.actions_urlbodystring—ActionsURL is where act fetches an action repository from when a step names one.
task.context.actorbodystring—Actor is who caused the run.
task.context.api_urlbodystring—APIURL is where the job reaches the forge's API.
task.context.base_refbodystring—BaseRef is the target branch of a pull request, empty otherwise.
task.context.eventbodystring—Event is the webhook payload that triggered the run, as opaque JSON.
task.context.event_namebodystring—EventName is what triggered the run, e.g. "push".
task.context.head_refbodystring—HeadRef is the source branch of a pull request, empty otherwise.
task.context.jobbodystring—Job is which job of the workflow document this task is.
task.context.refbodystring—Ref is the full ref the run is for, e.g. "refs/heads/main".
task.context.ref_namebodystring—RefName is that ref without its refs/heads/ or refs/tags/ prefix.
task.context.ref_typebodystring—RefType is "branch" or "tag".
task.context.repositorybodystring—Repository is "<owner>/<name>".
task.context.repository_ownerbodystring—RepositoryOwner is the owner half of it.
task.context.retention_daysbodystring—RetentionDays is how long the run's artifacts are kept, as a number in a string because that is what an expression reads.
task.context.run_attemptbodystring—RunAttempt is which attempt of that run this is, counting from 1.
task.context.run_idbodystring—RunID identifies the run this task belongs to.
task.context.run_numberbodystring—RunNumber is the run's position in its repository, counting from 1.
task.context.runtime_tokenbodystring—RuntimeToken authorizes the job against the actions runtime: artifacts, the cache.
task.context.server_urlbodystring—ServerURL is the forge's own origin, as a link in a log points at it.
task.context.shabodystring—Sha is the commit being run, in full.
task.context.tokenbodystring—Token is the job's credential against the forge's own API — github.token in an expression.
task.idbodyinteger (int64)—ID identifies this task on every later state and log report.
task.needsbodyrunner.Need[]—Needs is what the jobs this one depends on produced.
task.needs[].jobbodystring—Job is the depended-on job's id in the workflow.
task.needs[].outputsbodyrunner.Pair[]—Outputs are the values it published.
task.needs[].outputs[].namebodystring—Name is what the value is filed under.
task.needs[].outputs[].valuebodystring—Value is the value itself, always a string on this wire.
task.needs[].resultbodystring—Result is how it finished.
task.secretsbodyrunner.Pair[]—Secrets are the values masked out of the log and exposed as secrets.*.
task.secrets[].namebodystring—Name is what the value is filed under.
task.secrets[].valuebodystring—Value is the value itself, always a string on this wire.
task.varsbodyrunner.Pair[]—Vars are the values exposed as vars.*.
task.vars[].namebodystring—Name is what the value is filed under.
task.vars[].valuebodystring—Value is the value itself, always a string on this wire.
task.workflowbodystring—Workflow is the workflow document verbatim.

Failure carries the platform error shape — see Errors.

Examples

hanzo runner task
import { Configuration, GitApi } from 'hanzoai';

const api = new GitApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postRunnerTask({ queue: 0 });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import GitApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = GitApi(client).post_runner_task(queue=0)
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

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

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

let result = git_api::post_runner_task(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.GitApi;

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

var result = new GitApi(client).postRunnerTask();
curl -X POST https://api.hanzo.ai/v1/runner/task \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "queue": 0
     }'

MCP reaches git through the git 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_git_keys"
         }
       }
     }'

Git API · All Hanzo APIs · Interactive reference

Was this page useful?