Quick Start
Configure State Store
Set
PRAISONAI_STATE_URL or pass state_url= when creating agents. See Database Persistence for configuration options.How It Works
Both methods read persisted data from the configured state store:| Method | Source keys | Filters | Sort |
|---|---|---|---|
get_runs | run:{session_id}:* | session_id (required), limit (optional) | started_at desc |
get_traces | trace:* | session_id, user_id, limit (all optional) | started_at desc |
Configuration Options
- If
state_storeis not configured, returns[]and logs a warning limit=0returns[],limit=Nonereturns everything matching- Bad/non-dict entries are skipped with a warning
- Uses
state_store.scan_prefix()when available, falls back tostate_store.keys()
Common Patterns
Show last 10 runs for a user:Best Practices
Always set state_url before calling these methods
Always set state_url before calling these methods
Otherwise you get
[] and a warning: "get_runs() called but no state_url configured; returning []".Configure via environment variable or constructor:Pick a small limit for UIs
Pick a small limit for UIs
These methods scan the store, so use small limits for responsive UIs:
Use these methods outside hot paths
Use these methods outside hot paths
Both methods perform store scans which can be expensive for large datasets. Cache results when possible:
Related
Database Persistence
Configure state stores for persistence
Session Management
Manage agent sessions and state
Langfuse Observability
Advanced trace analysis and monitoring

