Skip to main content

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

Every agent.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 pass promptlayer to AccuracyEvaluator, evaluation results are automatically:
  1. Logged as a PromptLayer request (with score, metadata, tags)
  2. A dataset group is created (if it doesn’t exist) to organize your evaluation data
By default, the mode is "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 with promptlayer_dataset_mode:
SCREENSHOT PLACE

AccuracyEvaluator with Multiple Iterations

Run the same query multiple times — all iterations land as rows in a single CSV version:

AccuracyEvaluator Parameters


Advanced APIs

For direct access to PromptLayer’s dataset, report, and evaluation APIs, see the Advanced PromptLayer Guide.

Parameters Reference

Environment Variables