Setup
Get your API key from the PromptLayer dashboard → Settings → API Keys.No extra dependencies required — PromptLayer uses
httpx which is already included.Usage with Agent / Task
Everyagent.do() or agent.print_do() call is automatically logged to PromptLayer when you pass promptlayer=pl.
Minimal — Key from Environment
Full Configuration with Tools and Prompt Registry
Usage with Evaluation
AccuracyEvaluator with PromptLayer Datasets
When you passpromptlayer to AccuracyEvaluator, evaluation results are automatically:
- Logged as a PromptLayer request (with score, metadata, tags)
- A dataset group is created (if it doesn’t exist) to organize your evaluation data
"log_only" — the eval is logged as a request and the dataset group is created, but no CSV is uploaded. You control when to create dataset versions.
Dataset Modes
Control how evaluation data is stored withpromptlayer_dataset_mode:

