Skip to main content

Module artifact

Module artifact 

Source
Expand description

Artifacts: files of a job attempt that agents may read through the runner (jobs artifact, MCP get_artifact), during the run and after it.

results (the result journal) is built in. A worker adds its own files, such as an evaluation log or a warm-start snapshot, by declaring them with declare before it first writes them. Declarations are checked records in artifacts.jsonl of the attempt directory, so workers in any language can write them, and a runner that predates them simply ignores the file. The final manifest lists every declared file that exists, and runner.artifact_index records its format, size and SHA-256 when the attempt is sealed.

Structs§

Declaration
A file a worker declares in its attempt directory.

Constants§

DECLARATIONS
The declarations of an attempt: checked records, version 1.
FORMATS
Artifact formats.
INLINE_CAP
What one runner call returns inline: the whole content of an artifact, or the records of one page.
MAX_DECLARATIONS
Declarations per attempt.
MAX_DESCRIPTION
Bytes of a description.
MAX_PAGE
Records of one page at most.
RESERVED
Files of the runner and the SDK in an attempt directory. No artifact may use them; nor a name that starts with . or ends with .lock or .tmp.
RESULTS
The built-in artifact: the result journal results.jsonl.

Functions§

all
Every artifact of the attempt: results first, then the declarations. Files that do not exist (yet) are included.
all_or_results
all, or results alone and the error when the declarations are broken: what a running attempt serves.
content
The whole content of an artifact, at most INLINE_CAP bytes. A records artifact is read up to its last complete line, so a record being appended is never cut.
declarations
The declarations of the attempt in dir, in declaration order; none if there are none. A declaration that breaks the rules, or a second declaration of a name or file, makes them all untrusted: an error.
declare
Declares an artifact of the attempt in dir, the attempt directory a worker’s prepare receives as base. Declare it in solve, before the first write, so agents can read it while the job runs; never in prepare, which also runs for validation. Repeating an identical declaration is a no-op; another declaration of the same name or file is an error. Safe to call from concurrent tasks.
digest_file
Size and SHA-256 of a file, read in blocks.
page
Records offset..offset + limit of a records artifact: the payloads of complete records whose checksums hold, at most INLINE_CAP bytes of payload (always at least one record). next_offset is where the next page starts; available counts the complete records now in the file, which a running job may extend.
progress
The artifact index of a running attempt, for jobs get: every artifact whose file exists, with its current size, and the problems found (a broken declaration file leaves results alone).
sealed
The manifest’s view of the artifacts when an attempt is sealed: the artifacts map (name to file), runner.artifact_index (format, size, SHA-256, task, description) and the problems found. Only regular files that exist are listed; a broken declaration file lists results alone. An artifact problem never fails the attempt: its results stand.