Execute Agents as Jobs
An execute-agent job (agents.execute) runs an agent once, to completion,
as a scheduled platform job. You give it an agent and a prompt; the platform
schedules a container, runs the agent until it finishes or times out, saves
everything the run produced, and exits.
This is the bounded counterpart to Deploy Agents. A deployment is a service that stays up waiting for requests. An execute job is a single unit of work with a beginning and an end — you are asking an agent to do one thing, not to be available.
When to Use a Job Instead of a Deployment
Reach for a job when the work is long enough that holding an HTTP connection open is the wrong shape, when the run produces files rather than a reply, or when the agent only needs to exist for the duration of one task.
CLI
Python SDK
How It Works
- Submission resolves and snapshots everything. When the job is created, the platform resolves the agent reference, resolves and merges the agent environment, and validates any working-directory references. A bad agent name, a missing secret, or a nonexistent fileset fails your create request rather than the run. The resolved config, compute, and secret references are snapshotted onto the job, so a later edit to the underlying entities does not change what an already-submitted job runs.
- The job runs the agent once. The scheduled step stages the working
directory, invokes the agent through Fabric with your prompt, and waits up to
timeout_secondsfor a result. - Everything is saved as job results. The input working directory, the output working directory, the run’s artifacts, and Fabric’s own run record are all saved and downloadable after the job finishes — including when it fails.
Submit a Job
The examples below use the calculator agent that ships with the source checkout. Register it first if you have not already:
CLI
Python SDK
The command prints the created job record, including the generated name you
use to track it.
Job Spec Fields
The CLI generates one flag per spec field (--agent, --input,
--environment, --workdir.base-workdir, --timeout-seconds,
--auto-telemetry). Fields that do not reduce to a single flag — an inline
agent, an inline environment, workdir.artifact_mounts — are supplied with
--spec (a JSON string) or --spec-file (a YAML or JSON file). Individual
flags override values from the supplied spec.
Track a Job and Fetch Its Results
An execute job is an ordinary platform job, so the nemo jobs commands work on
it by name (e.g. "calc-run-1" in the example commands below).
CLI
Python SDK
Result Names
Results download as gzipped tarballs of a directory, or as a single JSON file.
output_workdir and output_artifacts are saved on failure too, on a
best-effort basis. When a run fails, that may be where the explanation is —
the job also logs the tail of the agent’s stderr so the initial diagnosis needs no
downloads.
Working Directories
An agent that reads and writes files needs somewhere to do it. workdir builds
that directory from the Files service
before the agent starts.
Mounts are applied after the base tree, so a mount at the same path wins. Mount paths must be relative and must not overlap each other.
Whatever the agent leaves behind in that directory comes back as
output_workdir.
Environments, Secrets, and Compute
Execute jobs use the same environment model as deployments. Pass
--environment default/research and the environment’s spec is merged into the
agent config, its secret references become secret-backed environment variables
on the job step, and its compute spec sizes the container.
Compute is expressed the Kubernetes way on the compute spec. Execute jobs
support cpu, memory, and nvidia.com/gpu; any other resource key is
rejected at submission rather than silently dropped.
See Agent Environments for how to create the environment, environment spec, and compute spec.
Inline Agents
agent also accepts a full agent definition instead of a reference. The config
is validated at submission and snapshotted onto the job, but it is never stored
as an Agent entity. This suits an agent composed per request — models chosen by
the caller, harness settings scoped to a single run — where there would be
nothing to keep in sync afterward.
Supply it with --spec/--spec-file from the CLI, or as the spec body from
the SDK.
Execute Extensions
A plugin can register a trusted extension that runs after a successful
invocation and turns the agent’s output into something the plugin owns — for
example, the Insights plugin’s analysis runs attach an extension that saves an
analysis-report result and files the insights it found.
Extensions are named by extension.kind and configured by
extension.config. Only kinds registered by an installed plugin are accepted;
an unknown kind fails the create request. If you are using a feature built on
execute jobs, its own commands set this for you.
Requirements and Limits
- Config format. Only
nemo-agents-spec-v1agents can run as execute jobs. Legacy NAT workflow configs are rejected; usenemo agents evaluateor a deployment for those. - Fabric environment. The merged agent config must select the
localFabric environment provider. Because an environment spec can override the provider, this is checked after the merge. - Timeout.
timeout_secondsbounds the wait for a Fabric result and defaults to one hour. A run that exceeds it fails with a savedfabric_errorrather than hanging. - Reserved environment variables. A secret cannot be bound to an environment
variable name the platform injects itself (the
NEMO_JOB_*family,NMP_BASE_URL,AGENT_CONFIG_PATH, and similar). The collision is rejected at submission.
Clean Up
Job records and their results persist until you remove them.