Collecting and filtering real agent traces
Distill high-scoring frontier runs into training data
The best training datasets come from real production prompts answered by a strong teacher model and filtered by an automated Judge or human reviewer.
Only keep examples that score above your quality threshold — 500 clean examples beat 10,000 noisy ones.
Example
raw_traces = [
{'prompt': 'Refund order #102', 'reply': '{"queue": "billing", "priority": "high"}', 'score': 9.5},
{'prompt': 'App crashes on login', 'reply': 'Maybe try later', 'score': 3.0},
{'prompt': 'Reset my 2FA', 'reply': '{"queue": "security", "priority": "high"}', 'score': 9.2},
]
curated = [t for t in raw_traces if t['score'] >= 8.5]
print(f'Kept {len(curated)}/{len(raw_traces)} high-quality traces')
for row in curated:
print(' ', row['prompt'], '->', row['reply'])Example explained
- raw_traces — Represents logged prompt/response pairs scored by praisonai.eval.Judge or human review.
- t['score'] >= 8.5 — Drops low-scoring replies so the student model never imitates bad teacher outputs.
Extract training sets directly from PraisonAI trial logs
praisonai-train includes CLI helpers to turn saved evaluation trials into clean, deduplicated JSONL files automatically.
Example
# Convert high-scoring eval trials into training rows
praisonai train data from-trials --input trials.jsonl --output raw_train.jsonl
# Remove near-duplicate prompts so the model does not memorize repeats
praisonai train data dedup --input raw_train.jsonl --output clean_train.jsonlExample explained
- from-trials — Exports passing agent runs into standard chat-completion training format.
- dedup — Removes duplicate prompts that skew validation scores and cause overfitting.
Common pitfall: leaking PII or secrets into training rows
Anything written into your JSONL dataset can be memorized and regurgitated by the fine-tuned model. Strip emails, customer names, API keys, and tokens before training.
Reference: documentation