Skip to content
HIPS
Sign inContact HIPSJoin early access
Docs menuContainer deployments

Queue deployments

Send jobs to a queue deployment on api.hips.run: run and runsync, the status object, waits, streams, cancel, retry and purge, webhooks, limits, how long inputs and results are kept, and health.

On this page13 sections
  1. Create a queue deployment
  2. Call the queue
  3. The routes
  4. The job's body
  5. The status object
  6. How long jobs, inputs and results are kept
  7. Waiting: runsync and status-sync
  8. Streams
  9. Cancel, retry, purge and list
  10. Webhooks
  11. Limits
  12. Answers
  13. Health

A queue deployment takes jobs rather than HTTP requests. You submit a job's input to the deployment's queue on `api.hips.run`, one of its workers runs it, and you read the result, wait for it, stream it, or receive it at a webhook. The routes, the bodies and the job states keep the names existing serverless queue clients already use.

Create a queue deployment

Create it as any container deployment, with type QUEUE (Deployment settings). It has no host of its own: its jobs go through api.hips.run. The deployment's timeout is each job's execution timeout and its jobTtl each job's time to live unless a job sets its own. A deployment that is stopped, or whose workers.max is 0, queues no job.

Call the queue

POST https://api.hips.run/v2/<deployment>/runAuthorization: Bearer $HIPS_API_KEYContent-Type: application/json{"input": {"prompt": "A lighthouse at dusk"}}
Reads from the environmentHIPS_API_KEY

<deployment> is the deployment's dep_ id, or the same 26 characters after dep- or dep, as in its host name. Send an inference_only or full API key of the deployment's workspace as the bearer. A job's id is a UUID; a runsync job's id starts with sync-.

The routes

On https://api.hips.run, each under the deployment's id.

POST/v2/{id}/runserved

Queue a job; answers {"id", "status": "IN_QUEUE"} at once.

POST/v2/{id}/runsyncserved

Queue a job and wait for its end, up to ?wait=; answers the status object.

GET/v2/{id}/status/{job}served

The job's status object, with an ended job's result. ?ttl= sets the job's time to live first.

GET/v2/{id}/status-sync/{job}served

The status object after waiting for the job's end, up to ?wait=.

GET/v2/{id}/stream/{job}served

The parts the job's handler streamed since the last read, each once.

POST/v2/{id}/cancel/{job}served

Cancel a waiting or running job.

POST/v2/{id}/retry/{job}served

Queue a FAILED or TIMED_OUT job again with its own input.

POST/v2/{id}/purge-queueserved

Remove every waiting job; running jobs go on.

GET/v2/{id}/requestsserved

The deployment's newest jobs, at most 100.

GET/v2/{id}/healthserved

Any container deployment's job and worker counts, a load-balanced one's included.

The job's body

run and runsync take one JSON object. A body is at most 10 MiB on run and 20 MiB on runsync; a larger one answers 400 before the rest is read. Members not listed here are ignored.

inputAny JSON value but nullRequired
Your handler's input, kept byte for byte: strings, escapes, key order and the text of numbers reach the worker as sent. A body without input, or with input null, answers 400.
s3ConfigJSON objectOptional
Handed to the worker beside input, byte for byte. Anything but an object answers 400.
webhookStringOptional
An https URL on port 443, at most 2,048 bytes, that receives the job's status object when it ends (Webhooks). Another scheme or port answers 400 when the job is submitted.
policy.executionTimeoutInteger millisecondsDefaults to the deployment's timeout
5,000 to 604,800,000. A job that runs longer ends TIMED_OUT. With neither set, a job has no execution timeout.
policy.ttlInteger millisecondsDefaults to the deployment's jobTtl
10,000 to 604,800,000: the job's whole life from its submission, waiting and running included. At its end the job is stopped and removed, its result with it. ?ttl= on the URL sets the same value; policy.ttl wins when both are sent.
policy.lowPriorityBooleanDefault false
A low-priority job does not count when the deployment scales up: it runs when one of the deployment's workers is free and starts none itself.
?wait=Integer milliseconds, runsync onlyDefault 90,000
1,000 to 570,000: how long runsync waits for the job's end before it answers the job as it stands.

The status object

status, status-sync, runsync and a webhook answer the same object. Each member is there only where it applies; output, and an error your handler posted, are its bytes as it posted them.

A completed job
{"delayTime":824,"executionTime":3120,"id":"3f2b8c1e-5a7d-4c9b-8e2f-1a6d4b7c9e05","output":{"image_url":"https://example.com/lighthouse.png"},"status":"COMPLETED"}
idString
The job's id, the same on every read.
statusIN_QUEUE, IN_PROGRESS, COMPLETED, FAILED, CANCELLED or TIMED_OUT
Waiting, running, or how it ended.
delayTimeInteger milliseconds
From the submission to the moment a worker last took the job, once one has.
executionTimeInteger milliseconds
From that moment to the job's end, once it ended after running.
outputJSON
On COMPLETED, and on FAILED where the handler posted one.
errorJSON
On FAILED: the handler's error, or HIPS's own text: job timed out after 1 retries when the job lost its worker twice, output too large for a result over 20,000,000 bytes, output invalid for a result that is not a JSON object.
retriesInteger
On FAILED, when the job was queued again before: how many times.

A job whose worker is lost while it runs goes back to the queue once. Lost a second time, it ends FAILED with job timed out after 1 retries.

How long jobs, inputs and results are kept

Never past the job's time to live. Once either is over, every read of the job answers 404.

  • run

    Result readable after the job ends
    30 minutes
  • runsync

    Result readable after the job ends
    1 minute
  • runsync with ?wait=

    Result readable after the job ends
    5 minutes
  • A job lives for its time to live from its submission, waiting and running included. status with ?ttl= (10,000 to 604,800,000 ms) sets it again, counted from the submission, longer or shorter; a time to live already over removes the job.
  • A job's input is kept encrypted while the job waits or runs. It is deleted once the job completes or is cancelled; a FAILED or TIMED_OUT job's input is kept until its result expires, so retry can run it again. Never past the job's time to live.
  • A result is kept encrypted, readable by the deployment's workspace alone, until exactly its expiry, and deleted after.
  • HIPS writes no input, output or webhook address to its logs.

Waiting: runsync and status-sync

runsync queues the job and holds the request until the job ends or ?wait= passes. An ended job is answered whole; one still waiting or running is answered as it stands, with no result, and you read it again with status or status-sync. status-sync waits the same way for a job already queued, with the same ?wait= (1,000 to 570,000 ms, 90,000 by default).

Streams

A handler that yields parts streams them. GET .../stream/<job> answers {"status": "IN_PROGRESS", "stream": [...]} with every part not read yet, each once and oldest first, each the JSON your handler yielded. Read again until status is an ended state and stream is empty. Up to 32 MiB of unread parts are kept for a job, the oldest unread part dropped past it, and unread parts are kept until the job's result expires.

Cancel, retry, purge and list

  • POST .../cancel/<job> ends a waiting or running job CANCELLED, stops it on its worker, and answers {"id", "status": "CANCELLED"}. A job that is not waiting or running answers 404.
  • POST .../retry/<job> queues a FAILED or TIMED_OUT job again before its result expires, with the same id, input, policy and webhook, discards its earlier result, and answers {"id", "status": "IN_QUEUE"}. It takes no body. A job in another state answers 400; a job whose input is no longer kept answers 400, and you submit it again with run.
  • POST .../purge-queue removes every waiting job, which then reads as gone, and answers {"removed": <count>, "status": "completed"}. Running jobs are not touched.
  • GET .../requests lists the deployment's jobs that can still be read, newest first, at most 100, each as its status object without output.

Webhooks

  • A job submitted with webhook is posted there when it ends COMPLETED, FAILED or TIMED_OUT: a POST with Content-Type: application/json whose body is the status object, its result included. A cancelled job posts nothing.
  • Any 2xx answer is delivery. Otherwise HIPS tries twice more, each try 10 seconds after the one before ended, and each try has 10 seconds for the whole exchange.
  • HIPS calls only public addresses, on 443: an address that is private, loopback, link-local or a cloud metadata service, or a name that resolves to one, is never called, and that try fails.

Limits

Per deployment and route. Past either limit the route answers 429 with `Retry-After` in seconds.

  • run, retry

    Requests per 10 seconds
    1,000
    Requests at once
    200
  • runsync, status, status-sync, stream

    Requests per 10 seconds
    2,000
    Requests at once
    400
  • cancel

    Requests per 10 seconds
    100
    Requests at once
    20
  • purge-queue

    Requests per 10 seconds
    2
    Requests at once
    No limit
  • requests

    Requests per 10 seconds
    10
    Requests at once
    2
  • health

    Requests per 10 seconds
    2,000
    Requests at once
    No limit

A route past its limit answers with Retry-After alone. RateLimit-Policy and RateLimit are not sent here: they carry the management routes' quota (Requirements and headers), which these routes do not count against.

The workspace's own requests a minute apply first, answered as on every other route (Limits). Past 100,000 waiting and running jobs on a deployment, run and runsync answer 429 with Retry-After: 10.

Answers

The queue's own refusals are short problem documents (Content-Type: application/problem+json). A refusal by HIPS's account rules carries the error envelope of every other route.

  • 400

    Body
    {"title": "Bad Request", "detail": "<what was refused>", "status": 400}
    When
    A body that is not a JSON object or whose webhook or policy has the wrong type, a missing or null input, an s3Config that is not an object, a value outside its range (policy.executionTimeout, policy.ttl, ?ttl=, ?wait=), a webhook that is not https on 443 or is longer than 2,048 bytes, a body over its bound, or a retry the job's state or its input does not allow. detail says which, such as the body is not a JSON object, or its webhook or policy has the wrong type, webhook must be an https URL on port 443 or only a FAILED or TIMED_OUT job is retried.
  • 404

    Body
    {"title": "Not Found", "detail": "endpoint not found", "status": 404}
    When
    The one body for a deployment that does not exist, was deleted, is another workspace's or is not a queue deployment, and for a job that is unknown, another deployment's, purged, or past its time to live or its result's keep time. A key learns nothing of another workspace's deployments or jobs.
  • 409

    Body
    {"title": "Conflict", "detail": "...", "status": 409, "code": "ENDPOINT_PAUSED"}
    When
    run or runsync on a deployment that is stopped or has workers.max 0. No job is queued.
  • 429

    Body
    {"title": "Too Many Requests", "detail": "rate limit exceeded", "status": 429} with Retry-After
    When
    A route's limit, or the deployment's 100,000 waiting and running jobs.
  • 401, 402, 403, 429

    Body
    The error envelope
    When
    A missing or invalid key, a key that reaches no deployment, the workspace's state or plan, or its requests a minute.
  • 503

    Body
    The error envelope, overloaded, with Retry-After
    When
    HIPS could not reach the queue's store. Retry after the delay.

Requests to these routes that reach the deployment and their answers, and each webhook body that reaches your endpoint, count as the deployment's caller_in and caller_out transfer (Deployment billing); HIPS's own 5xx answers and health reads are not counted.

Health

GET https://api.hips.run/v2/<deployment>/health, with a key of the deployment's workspace, answers any container deployment's counts, at most a second old. A read starts no worker and never resets an idle timer. It answers the same 404 and 429 bodies as the queue.

Answer
{"jobs":{"completed":12,"failed":1,"inProgress":2,"inQueue":5,"retried":0},"workers":{"idle":1,"initializing":0,"ready":3,"running":2,"throttled":0,"unhealthy":0}}

Every member is always present. A load-balanced deployment's job counts are always zero.

jobs.inQueue, jobs.inProgressInteger
The jobs waiting and running now.
jobs.completed, jobs.failed, jobs.retriedInteger
The jobs that completed, failed, or were queued again, in the last 30 minutes.
workers.idle, workers.initializing, workers.running, workers.throttled, workers.unhealthyInteger
The workers in each worker state.
workers.readyInteger
The idle workers, and the running workers taking requests now.

For AI agents

The key is read from HIPS_API_KEY, never shown here.

Onboard your agent to HIPS

Paste one line into your coding agent. It reads HIPS's setup guide, connects your project to the API and checks the connection with a real request.

my-app, your coding agent

Set up HIPS for me: fetch https://hips.com/agent-setup.md and follow it.

Paste into any coding agent
  • Read this page as Markdown

    The page's text for an agent, without the site around it.

    Not yet. The HIPS MCP server is coming soon.
  • Search the Docs

    Each matching page's title, address and passages.

    Not yet. The HIPS MCP server is coming soon.
  • List the models

    Every model HIPS serves, with its id, modality and prices.

    Not yet. The HIPS MCP server is coming soon.