Skip to main content
When a tool returns more data than fits in context, Artifact Storage saves the overflow to disk and gives the agent tools to page through it — so nothing is silently lost.
The user asks for a large result; the agent stores the overflow as an artifact and pages through it with artifact tools instead of truncating silently.

Quick Start

1

Enable with one line

The user asks for a summary; the agent reads artefacts from storage and replies.
2

With configuration

3

With a custom artifact store


How It Works

When a tool returns output larger than output_limit, the agent:
  1. Writes the full content to ~/.praisonai/artifacts/{agent_id}/{run_id}/
  2. Replaces the oversize output with a short preview and an [ArtifactRef ...] line
  3. Gains six new tools (auto-registered) to page through the stored content
The agent picks these up autonomously — you do not call them manually.

Configuration Options

Validation rules:
  • output_limit must be > 0
  • output_max_lines, if set, must be > 0
  • output_direction must be one of "head", "tail", or "both"
  • artifact_retention_days must be >= 0

Retrieval Tools the Agent Gains

These tools are auto-registered on first overflow — you do not add them manually. When a tool output is too large, the agent sees a truncated preview with a line like:
The agent then calls artifact_grep, artifact_chunk, or other tools autonomously to retrieve the parts it needs.
artifact_load loads the entire file into memory. For large files, prefer artifact_head, artifact_tail, or artifact_chunk to page through the content.

Storage Layout

Artifacts are stored under ~/.praisonai/artifacts/ by default:
The .meta.json file contains size, mime type, checksum (SHA256), tool name, and turn number. Security: The store rejects any retrieval path outside base_dir and any extension other than .artifact. Keep this in mind when writing custom store implementations. Cleanup: Artifacts older than artifact_retention_days are removed when the agent is finalized (garbage collected). Set artifact_retention_days=0 to disable retention-based cleanup.

Which Option Should I Use?


Common Patterns

Long web scrapes

An agent scrapes a 200 KB page. The preview shows head and tail, and the agent uses artifact_grep to find “pricing” without re-scraping:

Log file analysis

read_file over a 5 MB log spills to disk. The agent uses artifact_chunk to inspect around an error timestamp:

Custom store backend

Power users can supply their own store instead of the filesystem default:

Best Practices

enable_artifacts=False by default means zero overhead. Enable it only for tools that regularly return large results — web scrapers, file readers, database queries, log fetchers.
Set output_limit based on how much context your model can handle, not arbitrarily large. A value of 8,000–32,000 bytes works well for most models. Larger values mean less of the context window is available for the agent’s reasoning.
Cleanup only runs on agent finalization (garbage collection). In CI environments or sandboxes, set artifact_retention_days=0 or artifact_retention_days=1 to avoid disk buildup if agents are not properly finalized.
The default redact_secrets=True scans for API keys (api_key, secret, token), OpenAI keys (sk-...), and GitHub tokens (ghp_...) before writing to disk. Only disable it for known-safe content (e.g., structured scientific data with no credentials).

Tool Configuration

The parent ToolConfig object — timeout, retry, parallel execution, and artifact settings.

Context Compaction

Adjacent context-management feature — compact conversation history when approaching token limits.

Dynamic Context Discovery

How agents discover and use artifact references in their context window.

Caching

Cache LLM responses to reduce costs and latency — a sibling cost/performance feature.