artifact

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package artifact defines storage for named binary outputs of agents and tools. Implementations live in agentx-contrib; applications own authorization and choose the scope from trusted identity, rather than from model arguments.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("artifact: not found")

ErrNotFound reports an absent artifact in the requested scope.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Key
	Name      string            `json:"name,omitempty"`
	MediaType string            `json:"media_type"`
	Data      []byte            `json:"data"`
	Metadata  map[string]string `json:"metadata,omitempty"`
}

Artifact holds a binary output and application-owned metadata. It is not a provider file ID or an expiring download URL.

func (*Artifact) Validate

func (a *Artifact) Validate() error

Validate checks the required artifact fields. Empty files are allowed.

type Key

type Key struct {
	Scope string `json:"scope"`
	ID    string `json:"id"`
}

Key identifies an artifact. Scope and ID are exact, case-sensitive strings. Implementations must not interpret them as filesystem paths.

func (Key) Validate

func (k Key) Validate() error

Validate checks a key without imposing backend path conventions.

type Store

type Store interface {
	Put(ctx context.Context, value *Artifact) error
	Get(ctx context.Context, key Key) (*Artifact, error)
	Delete(ctx context.Context, key Key) error
}

Store persists artifacts atomically per key. Put replaces an existing value; applications needing immutable revisions must choose distinct IDs. Get returns ErrNotFound for missing keys. Delete is idempotent. Implementations must be concurrent-safe and must not retain or return mutable aliases. Calls do not provide a transaction across several artifacts.

Directories

Path Synopsis
Package artifacttest tests implementations of artifact.Store.
Package artifacttest tests implementations of artifact.Store.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL