Skip to main content
POST
Requires version 2.0.0 or later of the Archetype platform.

Overview

This endpoint runs a package and returns the created agent. The package fixes everything about how the agent behaves: its blueprint, the blueprint’s values, and the model every slot resolved to when the package was built. The request only says how to run it and binds its I/O. To change anything else, build a new package. mode picks how the agent executes:
  • batch (the default) processes the input files in connectors.source and finishes.
  • serving stays up to answer queries over Query Agent and /api/agents/instances/{agent_id}/connect. A serving run takes its input from each query, so it must not send connectors.
A batch run is returned running. A serving run is returned deploying, before it is placed: poll Get Agent until it is running before you query it. Follow either kind through its events, logs, and results, exactly as a run of a bundle. The run is owned by the caller, or by the project’s creator when the package is in a project. Other members of the organization cannot see it unless they are org admins.

Request

string
required
The pkg_ id of the package to run. It must be ready, built for the platform target, and hold exactly one blueprint.
string
default:"batch"
How the agent executes: batch processes the inputs and finishes; serving stays up to answer queries.
object
The run’s input files and optional output file. A batch run must list at least one file ref in source. A serving run must omit connectors.
array
One or more input refs. Each entry is a data ref.
object
Optional output ref; omit it or send null for the default. It must not name an output that already exists. Omitted: the runner writes one output per input, named after the input. Provided: for concatenable formats (for example CSV) all output folds into this single file.

Data ref

string
required
Storage kind, for example file.
string
required
Identifier within that storage kind, for example file_abc123.
string
Optional format hint, for example csv.

Response

Returns 202 Accepted with the created agent.
string
required
TypeID-encoded agent identifier (agt_ prefix).
string
required
The run’s name. For a run of a package, this is the package’s name.
string
required
Organization the agent belongs to.
string
The package this agent was run from (provenance). Absent for a run of a bundle, which carries bundle_id instead.
string
required
Human-readable blueprint reference (its key), for example osm.
string
required
Immutable blueprint id the package holds.
string
required
How the agent executes: batch or serving.
string
required
Agent lifecycle status. A new run is running, or deploying for a serving run.
string
The project the run is in, which is its package’s project. null outside any project.
object
The I/O binding this run was started with.
string
The executor’s job id for this run. Present once the run has been dispatched.
string
required
When the run was created (date-time).
string
When the run began executing. Absent until it has been dispatched.
string
When the run reached a terminal status. Absent while it is unfinished.
string
Why the run failed. Present only when status is failed.

Important Notes

  • A 400 means the package was built for a target other than platform or holds more than one blueprint, or the request does not fit the mode: a batch run sent no file ref in connectors.source, or a serving run sent connectors. It also covers a serving run whose blueprint cannot be served, which creates no agent.
  • When the package is in a project, the run may only read source files the project’s creator can see. Any other file returns 400.
  • A 403 with code capability_locked means the package’s blueprint is not available to your organization. A 403 without that code means you can see the package’s project but cannot modify it.
  • A 409 means the package is not ready yet, or the sink names an output that already exists.
  • A 429 with code serving_limit_reached means your organization already runs as many serving agents as it may. Cancel one, then retry.
  • A 501 means serving was requested in an environment where serving is not enabled.
  • A serving run that cannot be placed or started ends failed with the reason in error. Create another instance to retry.
  • A package cannot be deleted while runs from it exist. Find them with List Agents and package_id.