Skip to content

agentic.emit_artifact

Page status: scaffold Source state: generated Applies to: Shepherd v1.0-dev Owner: @docs-system-owner (TBD) Validation: scripts/gen_shepherd_api_inventory.py --check

This is reference — exact, generated facts. The mental model lives in concepts; recipes live in guides.

Pre-rename surface

Generated from the internal agentic facade; names and paths change at the Shepherd rename.

function

emit_artifact

emit_artifact(
    *,
    content: str | bytes,
    kind: str,
    name: str,
    metadata: dict[str, Any] | None = None,
) -> Artifact

Emit a durable artifact during task execution.

The artifact appears on Run[T].artifacts after the task completes (in emission order). Returns the constructed Artifact so callers can cite it locally; the framework owns the persistence path.

Sync/async dispatch (CONTRACTS A8): inside an async @task body, returns a coroutine that callers await. Inside a sync @task body, blocks via the same run_sync helper that deliver() uses and returns the Artifact directly.

Raises:

Type Description
NoActiveTaskRun

called outside a @task-decorated body.

See also