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

# Google Cloud TPU API

Cloud TPU API provisions and manages Tensor Processing Unit nodes used for training and serving large machine-learning models. Through it teams allocate single nodes or queued resources, list available accelerator types and TensorFlow runtime versions per zone, manage device guest attributes, and stop or reset nodes when jobs finish. The API is the control plane behind every TPU VM that PyTorch, JAX, and TensorFlow workloads run on in Google Cloud.

## For AI agents

Provision, list, reset, and tear down Cloud TPU nodes and queued resources, and discover available accelerator types and runtime versions per zone.

## Scope

Does not handle GPU provisioning, model training framework configuration, or dataset storage - use for managing Cloud TPU nodes, queued resources, and operations only.

## Capabilities

- Provision TPU VM nodes in a specified zone with a chosen accelerator type
- List active nodes, accelerator types, and supported runtime versions per zone
- Reset, stop, and start TPU nodes during long-running training jobs
- Read guest attributes from a TPU node for debugging and monitoring
- Cancel long-running TPU operations
- Manage queued-resource allocations for TPU pod slices

## Use cases

### On-Demand Training Cluster Provisioning

ML platform teams use the Cloud TPU API to spin up a TPU pod slice for a scheduled training run, attach the cluster to their JAX or PyTorch script, and tear it down when training completes. The API is called from a CI pipeline that allocates a v4-128 slice, waits until READY, runs the training script, then deletes the node - keeping spend tightly bound to actual training time rather than leaving an idle slice running.

Example prompt: POST a node-create request via /v2/{parent}/nodes with acceleratorType=v4-128 and runtimeVersion=tpu-vm-v4-base, poll until state=READY, run the training job, then DELETE the node.

### Queued Resource Allocation for Spiky Demand

Research teams that can wait for capacity use queued resources to request TPUs in higher-demand regions without holding capacity. The API submits a queued-resource request for a target slice size; Google fulfils the request when capacity is available, transitioning to ACTIVE state. This pattern is essential for accessing scarce v5p slices.

Example prompt: Submit a queued-resource POST under /v2/{parent}/queuedResources targeting a v5p-512 slice in us-east5, then poll the queued resource until state=ACTIVE.

### Capacity Discovery Across Zones

Before scheduling a training job, an MLOps service queries available TPU types and runtime versions in each candidate zone to build a routing decision. Listing accelerator types under /v2/{parent}/acceleratorTypes and runtime versions under /v2/{parent}/runtimeVersions for each zone lets the orchestrator pick the cheapest viable region without trial-and-error provisioning failures.

Example prompt: GET /v2/projects/{project}/locations/{zone}/acceleratorTypes for each zone in a candidate list and intersect with the runtime versions supported.

### Agent-Managed Training Lifecycle via Jentic

An ML training agent receives a 'fine-tune Llama on this dataset' instruction, allocates a TPU through Jentic, monitors the training job, and tears down the TPU on completion. Jentic isolates the GCP credential, exposes the start/poll/stop operations as discrete tool calls, and keeps the lifecycle state across long polls.

Example prompt: Through Jentic, search 'create a cloud tpu node', execute the create operation with the requested accelerator type, poll node status, and execute the delete operation when the training callback signals completion.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /v2/{+name}/locations | List zones where Cloud TPU is available for the project |
| GET | /v2/{+name}/operations | List long-running TPU operations in a zone |
| POST | /v2/{+name}:cancel | Cancel a long-running operation |
| POST | /v2/{+name}:reset | Reset a TPU node |
| GET | /v2/{+name}:getGuestAttributes | Read guest attributes from a TPU node |

## Key resources

- **Node** — TPU VM instance running a chosen accelerator type and runtime version
- **QueuedResource** — Queued allocation request that becomes a node when capacity is available
- **AcceleratorType** — Catalog of TPU hardware variants available in a zone (v3, v4, v5e, v5p)
- **RuntimeVersion** — Catalog of TPU VM software images compatible with each accelerator
- **Operation** — Long-running operation tracking provisioning, reset, or deletion

## Why Jentic

- **Setup:** Wiring the Cloud TPU API by hand means setting up a Google service account, granting the cloud-platform scope, building the project and location resource names, and polling long-running node operations yourself. Through Jentic you install once, import the Cloud TPU API from the API Directory, store the service-account credential once, and your agent calls it.
- **Permission scoping:** Cloud TPU carries the project and location resource name in the URL path (/v2/{name}/locations), so a rule can pin your agent to one project or location: it can list and inspect TPU nodes there and nothing else. You choose the operations it may call, so a node reset is not included unless you add it.
- **Credential handling:** Your Cloud TPU service-account 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 'list cloud tpu locations' or 'get tpu guest attributes', and Jentic returns the matching Cloud TPU v2 operation with its path-template input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Google Compute Engine API** — Provisions the surrounding VMs, networks, and disks that TPU nodes attach to
- **Google Kubernetes Engine API** — GKE node pools can attach TPUs as an alternative to direct TPU API provisioning
- **Google Cloud Storage API** — Stores training datasets and model checkpoints read by TPU workloads

## FAQ

### What authentication does the Cloud TPU API use?

OAuth 2.0 with the cloud-platform scope is required. Production usage is via service-account credentials with the tpu.admin role on the project. Through Jentic, the service-account JSON is stored encrypted in the vault and Jentic mints scoped tokens per call so the agent never holds the raw credential.

### Can I provision a TPU pod slice with the Cloud TPU API?

Yes. Submit a node-create request under /v2/projects/{project}/locations/{zone}/nodes specifying the acceleratorType (e.g. v4-128 for a 128-chip slice) and runtimeVersion. The request returns a long-running operation; poll it until done, then GET the node to confirm state=READY before connecting your training framework.

### What are the rate limits for the Cloud TPU API?

Control-plane operations allow several requests per second per project; the binding constraint is the per-project TPU quota (chip count by accelerator family) which must be raised through Cloud Console quota request for production workloads. Use queued resources rather than hot-looping create requests when capacity is scarce.

### How do I allocate a TPU through Jentic?

Search Jentic for 'create a cloud tpu node', load the create operation under /v2/{parent}/nodes, and execute it with parent=projects/PROJECT/locations/ZONE plus acceleratorType and runtimeVersion. Poll GET on the resulting operation name until done. Get started with Jentic One, the self-hosted execution layer.

### Does the Cloud TPU API support v5e and v5p chips?

Yes. The acceleratorTypes endpoint lists v5e and v5p variants per zone where they are available - typically a small set of regions for v5p and broader availability for v5e. Use the runtimeVersions endpoint to confirm which TPU VM images support the chosen accelerator type.

### Is the Cloud TPU API free?

The API itself is free; you pay for the TPU node-hours consumed at the published per-chip-hour rate that varies by accelerator type. Stopping or deleting a node ends billing immediately, so always tear down nodes when training completes.

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

Yes. Because you run Jentic One yourself, your own rules decide which Cloud TPU operations and credentials the agent may use. Since every request carries the project and location in the resource path (/v2/{name}/locations), you can pin the agent to a single project or zone, letting it list and inspect nodes there and nothing else. You also choose which operations it may call, so a node reset or a delete is not available to the agent unless you explicitly add it.
