Service

A Service is a long-running, resilient entry point (such as an API or UI) that exposes a stable, permanent URL. Behind the scenes, a Service automatically runs and manages a Job that handles incoming requests.

The Service guarantees:

  • A stable URL the users or applications can call

  • Automatic creation or reuse of a Job on first request/after a period of inactivity

  • Automatic recovery from failures

  • Automatic stopping of idle Jobs to save resources

Think of a Service as the controller/manager and the Job as the worker process.

Service vs Job

Understanding the difference is important:

Service

  • Persistent, long-running entity

  • Exposes a stable URL

  • Automatically manages the lifecycle of the worker job

  • Restarts workers if they fail

  • Suitable for APIs, model endpoints, UIs

Job

  • A single execution (one-time run)

  • Starts → runs → exits

  • No stable URL

  • Used for batch tasks, training, scripts, processing

In short: Services stay available. Jobs complete tasks.

Getting Started

The simplest way to think about Services:

  1. Create a Service

  2. Upload your app files

  3. Configure how the Job should run

  4. Hit the Service URL → Job automatically starts

  5. Service proxies traffic to the Job

Here are the steps.

1. Create a Service

eai service new testsvc

Note

This command creates a Service and two helper resources:

  • a runtime data resource (snow.testacc.testsvc_runtime): stores your application files and the job spec (eai.yaml)

  • a role resource (snow.testacc.testsvc_role): used for access control

Additional options you may use while creating a service:

  • --runtime – use an existing runtime data resource

  • --role – use an existing role

  • --upload – upload your application or configuration files

Once created, you also get a stable URL that will receive traffic.

2. Push Application Files

eai data push snow.testacc.testsvc_runtime ./server.py

Note

These files will be packaged into the container that runs your Job.

3. Configure How the Job Runs

eai service update <service> -i python:3.9-slim --cpu 1 --mem 1 -- python3 -u /service/server.py

Note

  • The job’s command must always appear at the end, after --.

  • The Toolkit will generate or update the job spec eai.yaml file behind the scenes — you do not need to manually edit YAML unless you want to.

4. Access the Service URL

Service URL can be accessed via browser or curl and this will start a Job.

curl -H "$(eai login token -H)" https://<service-id>.service.console.elementai.com

You can check the Job:

eai job ls --service <service>

Idle Job Timeout (Important)

An active Job will automatically stop after a period of inactivity (default is 1h).

This timeout can be set by:

eai service set <service> --idle-job-timeout <duration>

Note

Maximum idle job timeout user can set is 24h.

Service Commands

Service commands can be found on the cli. Use eai service --help to understand the list of commands.