Quick Start
How It Works
When a tool returns output larger thanoutput_limit, the agent:
- Writes the full content to
~/.praisonai/artifacts/{agent_id}/{run_id}/ - Replaces the oversize output with a short preview and an
[ArtifactRef ...]line - Gains six new tools (auto-registered) to page through the stored content
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
output_limit | int | 16000 | Maximum bytes of tool output before spilling to the artifact store |
output_max_lines | int | None | Maximum lines before spilling (alternative to byte limit) |
output_direction | str | "both" | Truncation direction shown to the agent: "head", "tail", or "both" |
enable_artifacts | bool | False | Master switch — enables artifact spillover. Off by default for backward compatibility |
artifact_retention_days | int | 7 | Days to keep artifacts before garbage collection on agent destruction |
artifact_store | Any | None | Custom store instance — pass a FileSystemArtifactStore(...) or another ArtifactStoreProtocol implementation |
redact_secrets | bool | True | Redact common secret patterns (API keys, tokens, passwords) before writing to disk |
timeout | int | None | Tool execution timeout in seconds |
retry_policy | RetryPolicy | None | Tool retry configuration |
parallel | bool | False | Enable parallel tool execution |
output_limitmust be> 0output_max_lines, if set, must be> 0output_directionmust be one of"head","tail", or"both"artifact_retention_daysmust be>= 0
Retrieval Tools the Agent Gains
These tools are auto-registered on first overflow — you do not add them manually.| Tool | Signature | Returns |
|---|---|---|
artifact_head | artifact_head(artifact_path, lines=50) | First N lines as a string |
artifact_tail | artifact_tail(artifact_path, lines=50) | Last N lines as a string |
artifact_grep | artifact_grep(artifact_path, pattern, context_lines=2, max_matches=50) | List of {line_number, line, context_before, context_after} |
artifact_chunk | artifact_chunk(artifact_path, start_line=1, end_line=None) | Lines start_line..end_line (1-indexed, inclusive) |
artifact_load | artifact_load(artifact_path) | Full content (deserialised if JSON) — loads entire file into memory |
artifact_list | artifact_list(agent_id=None, run_id=None, tool_name=None) | List of artifact metadata dicts |
artifact_grep, artifact_chunk, or other tools autonomously to retrieve the parts it needs.
Storage Layout
Artifacts are stored under~/.praisonai/artifacts/ by default:
.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 usesartifact_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
Only enable for tools that produce large output
Only enable for tools that produce large output
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.Tune output_limit to your model's context budget
Tune output_limit to your model's context budget
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.Set short retention in CI and sandboxes
Set short retention in CI and sandboxes
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.Trust redact_secrets=True for any web or file tool
Trust redact_secrets=True for any web or file tool
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).Related
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.

