Share files and reports
Store task outputs as artifacts and pass references between tasks or processes.
Publish and read an artifact
Section titled “Publish and read an artifact”Use an artifact when a task produces a file or report that you want to store separately from its result. publishArtifact() encodes and stores the content, then returns a reference that readStoredArtifact() can use to read it back.
The payload lands in .outpost/storage/artifacts/<id>.blob. The reference is a small JSON object: id, a SHA-256 digest, size, contract, producer and parents. Reading checks the contract, the size and the digest before decoding.
When to use an artifact
Section titled “When to use an artifact”| Task output | Artifact | |
|---|---|---|
| Holds | Lossless JSON in a checkpointed run | JSON checked by a schema, or bytes |
| Size | The whole checkpoint is capped, 16 MiB | Each artifact up to 16 MiB by default (maxBytes) |
| Readable by | Dependent tasks of the same run | Any process with the store and the reference |
| Checked | Not validated when read | Contract, size and digest on every read |
Keep small results as task outputs. Publish an artifact for a large report, a binary file or a result another process reads: the checkpoint then keeps only the reference.
Choose a contract
Section titled “Choose a contract”| Contract | Value | On publish and read |
|---|---|---|
defineJsonArtifact({ name, version, schema }) | Lossless JSON | Validates with a Standard Schema (Zod, Valibot…) or a function that throws |
defineBinaryArtifact({ name, version }) | Uint8Array | Copies the bytes as they are |
Change version when the format changes. A contract with another name, version or encoding rejects the reference with Artifact contract mismatch.
Use artifacts in a workflow
Section titled “Use artifacts in a workflow”defineArtifactTask() takes the usual task options plus store, contract and produce(context). Its output is the reference; readArtifact() reads it from a task listed in after.
The task sets producer from the execution, its key and the attempt. readArtifact() rejects a reference produced by another execution or another task, then verifies and decodes the payload. In a real workflow, produce reads an agent task’s result with context.value().
Record lineage
Section titled “Record lineage”parents lists, in order, the references an artifact was derived from. In defineArtifactTask(), pass parents: (context) => [context.value(audit)].
The producer and the parents are part of the reference and of its id. Pass producer or parents to readStoredArtifact() to reject a reference that does not match them.
Read an artifact in another process
Section titled “Read an artifact in another process”A reference is plain JSON: save it in a checkpoint, a queue job or a file. Another process opens a store over the same transport and reads it with the same contract.
readStoredArtifact() validates the reference itself, so an edited id, digest or producer is rejected.
Store artifacts remotely
Section titled “Store artifacts remotely”createArtifactStore({ transporter }) accepts any Transport. Use an S3 or R2 transport to share artifacts between machines; Where data lives covers the local layout.
Limits
Section titled “Limits”- An artifact’s contents are held in memory during publication and reading. To choose a size limit, see ArtifactStoreOptions.
- A published artifact is immutable. Outpost never deletes one: expire old objects with your storage’s own rules.
API: defineJsonArtifact · defineBinaryArtifact · createArtifactStore · publishArtifact · readStoredArtifact · defineArtifactTask · readArtifact · ArtifactReference