Building Agents
Artifacts
Publish files that belong to a session so a later step, another agent or a human reviewer can pick them up by reference.
An artifact is a session-bound file. Agents publish artifacts as the durable, reviewable output of their work — Markdown reports, JSON results, CSVs, images.
Publish an artifact
await session.artifact('report.md', markdown, { contentType: 'text/markdown' });The content can be a string or an in-memory buffer:
await session.artifact('summary.json', JSON.stringify({ ok: true }), {
contentType: 'application/json',
});Agents that generate a file in the sandbox first can read it back and publish the bytes:
const bytes = await session.fs.readBytes('/workspace/report.md');
await session.artifact('report.md', bytes, { contentType: 'text/markdown' });Read from the CLI
fh artifacts <session-id>
fh artifact get <session-id> report.md --out ./reports/report.mdWhat gets persisted
The session store records artifact metadata (id, name, content type, byte size, created time) alongside the session entry that produced it. The bytes are stored separately:
- File store (default): files under
.fabricharness/sessions/<id>/artifacts/. - SQLite store: BLOB column.
- Postgres store: BYTEA column or external blob URL.
- Cloud stores (designed): Azure Blob / ADLS, S3, R2.
Patterns
- Reports. A triage agent publishes
triage-report.mdfor reviewers. - Generated code. A migration agent publishes the proposed diff as an artifact and asks for approval before applying it.
- Datasets. A data agent publishes profiled CSVs alongside the prompt that produced them.
See also: fh artifacts, fh artifact get.