canonical: https://jentic.com/apis/googleapis.com/batch

# Google Batch API

The Google Cloud Batch API runs batch compute jobs on managed Compute Engine and GKE infrastructure without requiring users to operate their own scheduler. It exposes operations to submit jobs that bundle one or more tasks, list and cancel running jobs, and report task state from inside the job. Batch handles VM provisioning, retries, and result collection so HPC, genomics, simulation, and rendering workloads can be expressed as a single API call. The API is the orchestration surface only and does not store result artifacts.

## For AI agents

Submit, list, and cancel Google Cloud Batch jobs that run containerised or script-based tasks on managed Compute Engine and GKE.

## Scope

Does not store task results, manage long-running services, or run interactive workloads - use for submitting and monitoring batch jobs on managed Compute Engine and GKE only.

## Capabilities

- Submit a Batch job that runs one or more tasks via POST /v1/{+parent}/jobs
- List jobs in a project and location with GET /v1/{+parent}/jobs and filter by state
- Cancel a running job via /v1/{+name}:cancel to stop further task execution
- Report task state from inside a running task via /v1/{+parent}/state:report for custom task progress
- Delete completed jobs with DELETE /v1/{+name} to clean up history
- List long-running operations and Batch locations available to a project

## Use cases

### HPC and Simulation Workloads

Run high-performance computing, simulation, or rendering jobs as a single submission against a managed scheduler that handles VM provisioning, retries, and task coordination. Submit a job with the desired task count and resource shape; Batch boots the right machines, runs each task, and tears the fleet down on completion.

Example prompt: POST a Batch job spec to /v1/{parent}/jobs with taskCount=1024 and the desired machine type, then poll the operation until done.

### Genomics and Scientific Pipelines

Express genomics or scientific pipelines as Batch jobs that fan out across many input samples, with each task running the same container against a different input. Suitable for sequencing variant calling, image processing pipelines, and large-scale data preprocessing without operating a Slurm or Kubernetes cluster directly.

Example prompt: Submit a Batch job whose runnable is a genomics container, with one task per sample listed in a Cloud Storage manifest.

### Cost-Aware Job Cancellation

Watch a running job and cancel it once enough samples have produced acceptable results, capping cost on long-tail tasks. The API exposes both job listing and a cancel endpoint, so a controller running on a separate node can drive cost-aware execution policies.

Example prompt: POST to /v1/{name}:cancel once a downstream signal indicates enough successful task outputs have been collected.

### AI Agent-Driven Batch Submission via Jentic

Use an AI agent to translate a high-level analysis request into a Batch job spec, submit it, and monitor it to completion. Through Jentic the agent finds Batch operations by intent and runs them with project credentials supplied at execute time, avoiding manual SDK setup in the agent runtime.

Example prompt: Use Jentic search for 'submit a Google Batch job', load the schema for POST /v1/{parent}/jobs, and execute it with the constructed job spec.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v1/{+parent}/jobs | Create a Batch job with task definitions |
| GET | /v1/{+parent}/jobs | List Batch jobs in a project and location |
| GET | /v1/{+name} | Get a Batch job by resource name |
| DELETE | /v1/{+name} | Delete a Batch job |
| POST | /v1/{+name}:cancel | Cancel a running Batch job |
| POST | /v1/{+parent}/state:report | Report task state from inside a running task |
| GET | /v1/{+name}/locations | List Batch locations available to the project |

## Key resources

- **jobs** — Batch job submissions with task definitions, machine specs, and state
- **tasks** — Individual units of work within a job
- **operations** — Long-running operations representing job submission and deletion progress
- **locations** — Regions in which Batch can run jobs

## Why Jentic

- **Setup:** Wiring the Batch API by hand means setting up Google OAuth2, scoping a service account for batch access, and minting short-lived access tokens for each job call yourself. Through Jentic you install once, import the Batch API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** This API puts the project and job name in the URL path (/v1/{parent}/jobs, /v1/{name}), so a rule can pin your agent to one project or job: it can submit and list jobs there and nothing else. You choose the operations it may call, so actions like canceling or deleting a job are not included unless you add them.
- **Credential handling:** Your Google Cloud OAuth credential is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'submit a Google Batch job' or 'cancel a running job', and Jentic returns the matching Batch operation with its input schema so the agent calls the right endpoint without reading the discovery document.

## Related APIs

- **Compute Engine API** — Backs Batch with the underlying VMs that run jobs
- **Dataflow API** — Streaming and batch data processing as managed pipelines
- **Kubernetes Engine API** — Run batch workloads on a self-managed GKE cluster with custom controllers

## FAQ

### What authentication does the Batch API use?

The API uses Google OAuth 2.0 with cloud-platform scope. Service accounts must hold the roles/batch.* IAM role and have permission to act as the runner service account used by the job's VMs. Through Jentic the credential lives in the encrypted vault and the agent only sees a short-lived access token.

### Can I cancel a Batch job that is no longer needed?

Yes. POST to /v1/{name}:cancel where name is the job resource path. Tasks already running are terminated and the job transitions to a cancelled state.

### How do I submit a Batch job through Jentic?

Search Jentic for 'submit a Google Batch job'. Jentic returns POST /v1/{parent}/jobs with its full schema; build a job spec referencing your container image and task count, then execute. The credential is supplied from your Jentic One instance.

### What are the rate limits for the Batch API?

Numeric limits are not declared in the spec; quotas are enforced per project on batch.googleapis.com along with the underlying Compute Engine quotas the job consumes. Check the project's quotas before scaling up tasks per job.

### Where do Batch job results go?

The API does not store task outputs itself. Tasks typically write results to Cloud Storage, BigQuery, or another service of the user's choosing; the job spec defines the runnable that produces those outputs.

### Can a running task report custom progress?

Yes. From inside a task, POST to /v1/{parent}/state:report with the task identifier and progress payload. This is useful when stages within a single task need observable progress.

### Can I limit what my agent is allowed to do with the Google Cloud Batch API?

Yes. Because you run Jentic One yourself, your own rules decide which Batch operations and credentials the agent may use, and the API puts the project and job name in the URL path (/v1/{parent}/jobs, /v1/{name}), so a rule can pin the agent to a single project or job. You choose the operations it may call, so you can let it submit and list jobs while withholding destructive actions like canceling (/v1/{name}:cancel) or deleting (DELETE /v1/{name}) a job unless you explicitly add them. The Google Cloud OAuth credential is held by your own instance and injected only at execution, so the agent never controls scope beyond what you grant.
