> ## Documentation Index
> Fetch the complete documentation index at: https://docs.guild.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To act on a user's behalf in Guild, use the Guild REST API at https://api.guild.ai/v1.
> The OpenAPI spec is unauthenticated: https://docs.guild.ai/openapi.json (or openapi.yaml).
> Authenticate with an account API key, sent as HTTP Basic (key id as username, secret as password) or as `Authorization: Bearer <api_key_id>:<api_key_secret>`. See https://docs.guild.ai/api-reference/introduction#authentication.
> To run one agent on demand without account-wide access, use an API trigger instead: https://docs.guild.ai/platform/api-triggers.
> To act on Guild from an MCP client, connect to https://api.guild.ai/mcp (OAuth) or run `guild mcp` locally. Setup: https://docs.guild.ai/api-reference/mcp.
> To search these docs from an MCP client, connect to https://docs.guild.ai/mcp. The full page index is https://docs.guild.ai/llms.txt.

# Log, trace, and evaluate LLM calls with PromptLayer

> Connect Guild agents to PromptLayer to manage prompt templates, log and trace LLM requests, run evaluation pipelines, and work with datasets and tables.

Integrations · PromptLayer

A Guild agent can manage your PromptLayer workspace: publishing prompt templates, logging and tracing LLM requests, running evaluation pipelines, and working with datasets and tables. Guild stores the API key server-side and injects it into every request, so agent code never sees it. Credential policies let you restrict which operations each agent can call, and every request is auditable through Guild's credential proxy.

> [card] [Book a demo](https://guild-ai.cal.com/gtm/meeting-with-guild.ai)
>
> See how teams govern agents that use PromptLayer.

> [card] [Talk to sales](https://guild.ai/talk-to-sales)
>
> Get access to Guild, then connect PromptLayer to your first agent.

## What the PromptLayer integration exposes

The tools cover prompt template lifecycle (create, publish, label, retrieve, delete), request logging and tracing (log requests, create spans, ingest OTLP traces, close traces), and dataset management (create groups, draft versions, add request logs and traces to datasets). They also cover evaluation pipelines (create, run, score, rename, delete) and table operations (create tables and sheets, add rows, configure scorecards, trigger recalculations, manage versions). Tools for registering tools and workflows, managing skill collections, and setting environment variables round out the workspace management surface.

## How it works

**1. Retrieve your PromptLayer API key**

Log in to PromptLayer and copy your API key from your account settings.

**2. Connect the credential in Guild**

In Guild, go to Access & setup > Credentials, click Connect, select promptlayer, and paste the key into the API Key field. See [Credentials](https://docs.guild.ai/platform/credentials.md) for workspace, member, and agent-scoped options.

**3. Import and spread the tools**

Import PromptlayerTools from the integration package and spread it into your agent's tools object. Use pick() from the [SDK tools](https://docs.guild.ai/sdk/tools.md) to include only the operations your agent needs.

## Why PromptLayer access needs governing

PromptLayer workspaces hold prompt templates, LLM request history, evaluation results, and environment variables. An agent with unrestricted access can publish or delete prompt templates, modify dataset versions, reconfigure scorecards, and alter workspace environment variables. Guild's credential policies let you write ALLOW and DENY rules that the credential proxy enforces before any request leaves Guild, scoped to specific agents or workspaces on the same connected credential.

Guild stores the API key server-side and injects it as the X-API-Key header. Agent code never receives the key directly. You can scope a credential to one workspace, one member, or one agent using the options on the [Credentials](https://docs.guild.ai/platform/credentials.md) page, and you can lock down allowed operations with [credential policies](https://docs.guild.ai/platform/credential-policies.md). Agents without a matching credential fail at the proxy rather than reaching PromptLayer with an unexpected key.

## About the PromptLayer integration

Agents can create and retrieve prompt templates, log and trace LLM requests, and manage datasets and evaluation pipelines. They can also build and score tables, configure scorecards, and register tools and workflows within a PromptLayer workspace. The integration is `guildai~promptlayer`.

## Authentication

* **Type:** API key
* **Header:** Guild sends the key as `X-API-Key: <key>`

### Setup

**1. Connect PromptLayer**

In Guild, go to **Access & setup > Credentials**, click **Connect**, select **promptlayer**, and paste the key into **API Key**.

See [Credentials](https://docs.guild.ai/platform/credentials.md) for workspace, member, and agent-scoped credentials.

## Usage

```typescript theme={null}
import { PromptlayerTools } from "@guildai-services/guildai~promptlayer"
import { llmAgent } from "@guildai/agents-sdk"

export default llmAgent({
  systemPrompt: "You work with PromptLayer.",
  tools: { ...PromptlayerTools },
})
```

### Selecting specific tools

Tools are named with the `promptlayer_` prefix. Use [`pick()`](https://docs.guild.ai/sdk/tools#selecting-specific-tools) to include only what your agent needs.

## Tools

Tools in the latest published version of `guildai~promptlayer`:

> [accordion] All 143 tools
>
> | Tool | What it does |
> | - | - |
> | `promptlayer_add_report_column` | Add Column to Evaluation Pipeline |
> | `promptlayer_add_request_log_to_dataset_version` | Add Request Log to Draft Dataset |
> | `promptlayer_add_table_sheet_rows` | Append one or more rows to a sheet. |
> | `promptlayer_add_trace_to_dataset_version` | Add Trace to Draft Dataset |
> | `promptlayer_attach_dataset_group_id_external_id` | Attach Dataset Group External ID |
> | `promptlayer_attach_folder_id_external_id` | Attach Folder External ID |
> | `promptlayer_attach_prompt_template_id_external_id` | Attach Prompt Template External ID |
> | `promptlayer_attach_report_id_external_id` | Attach Report External ID |
> | `promptlayer_attach_skill_collection_id_external_id` | Attach Skill Collection External ID |
> | `promptlayer_attach_tool_id_external_id` | Attach Tool Registry External ID |
> | `promptlayer_attach_workflow_id_external_id` | Attach Workflow External ID |
> | `promptlayer_cancel_table_sheet_operation` | Cancel an active Table sheet recalculation operation. |
> | `promptlayer_cancel_table_sheet_scorecard` | Cancel active queued or running scorecard work for a table sheet. |
> | `promptlayer_close_trace` | Marks a trace as closed, preventing any further span ingestion for that trace. |
> | `promptlayer_configure_table_sheet_score` | Configure scoring for a Table sheet. |
> | `promptlayer_configure_table_sheet_scorecard` | Create or update the active scorecard for a table sheet. |
> | `promptlayer_create_dataset_group` | Create Dataset Group |
> | `promptlayer_create_dataset_version_from_file` | Create Dataset Version from File |
> | `promptlayer_create_dataset_version_from_filter_params` | Create Dataset Version from Filter Params |
> | `promptlayer_create_draft_dataset_version` | Create Draft Dataset Version |
> | `promptlayer_create_evaluation_pipeline` | Create Evaluation Pipeline |
> | `promptlayer_create_folder_api_public_v2_folders_post` | Create Folder |
> | `promptlayer_create_prompt_label` | Create a new label for a prompt |
> | `promptlayer_create_skill_collection_public` | Create Skill Collection |
> | `promptlayer_create_spans_bulk` | Create Spans Bulk |
> | `promptlayer_create_table` | Create a new Table. |
> | `promptlayer_create_table_sheet` | Create a new sheet in a table. |
> | `promptlayer_create_table_sheet_cell_recalculation` | Trigger recalculation for a single cell. |
> | `promptlayer_create_table_sheet_cell_recalculations_batch` | Trigger recalculation for a batch of cells identified by ID. |
> | `promptlayer_create_table_sheet_column` | Add a new column to a sheet. |
> | `promptlayer_create_table_sheet_file_import` | Start an asynchronous CSV import into an existing Table sheet. |
> | `promptlayer_create_table_sheet_operation` | Queue a recalculation operation for selected columns, rows, and cell statuses. |
> | `promptlayer_create_table_sheet_request_log_import` | Start an asynchronous request-history import into an existing Table sheet. |
> | `promptlayer_create_table_sheet_version` | Create a named Table sheet version, or restore from an existing version while creating a new version. |
> | `promptlayer_create_tool_env_var` | Create Tool Env Var |
> | `promptlayer_create_tool_registry` | Create Tool Registry |
> | `promptlayer_create_tool_version` | Create Tool Version |
> | `promptlayer_create_workflow` | Create Workflow |
> | `promptlayer_create_workspace_env_var` | Create Workspace Env Var |
> | `promptlayer_delete_dataset_group_id_external_id` | Delete Dataset Group External ID |
> | `promptlayer_delete_folder_entities_api_public_v2_folders_entities_delete` | Delete Folder Entities |
> | `promptlayer_delete_folder_id_external_id` | Delete Folder External ID |
> | `promptlayer_delete_prompt_template_id_external_id` | Delete Prompt Template External ID |
> | `promptlayer_delete_prompt_templates_labels_prompt_label_id` | Delete Prompt Template Label |
> | `promptlayer_delete_report` | Delete Evaluation Pipeline |
> | `promptlayer_delete_report_column` | Delete Evaluation Pipeline Column |
> | `promptlayer_delete_report_id_external_id` | Delete Report External ID |
> | `promptlayer_delete_reports_by_name` | Delete Reports by Name |
> | `promptlayer_delete_skill_collection_id_external_id` | Delete Skill Collection External ID |
> | `promptlayer_delete_table` | Delete a Table. |
> | `promptlayer_delete_table_sheet` | Delete a sheet. |
> | `promptlayer_delete_table_sheet_column` | Delete a column and its cells. |
> | `promptlayer_delete_table_sheet_scorecard` | Soft-delete the active scorecard for a table sheet. |
> | `promptlayer_delete_tool_env_var` | Delete Tool Env Var |
> | `promptlayer_delete_tool_id_external_id` | Delete Tool Registry External ID |
> | `promptlayer_delete_workflow_id_external_id` | Delete Workflow External ID |
> | `promptlayer_delete_workspace_env_var` | Delete Workspace Env Var |
> | `promptlayer_edit_report_column` | Edit Evaluation Pipeline Column |
> | `promptlayer_get_all_prompt_templates_get` | Get All |
> | `promptlayer_get_dataset_rows` | Get Dataset Rows |
> | `promptlayer_get_evaluation_rows` | Get Evaluation Rows |
> | `promptlayer_get_prompt_template_raw` | Get Prompt Template Raw Data |
> | `promptlayer_get_prompt_templates_labels_prompt_identifier_post` | Get Prompt Template Labels |
> | `promptlayer_get_prompt_templates_prompt_identifier_post` | Get Prompt Template by ID |
> | `promptlayer_get_report` | Get Evaluation |
> | `promptlayer_get_report_score` | Get Evaluation Score |
> | `promptlayer_get_request` | Get Request |
> | `promptlayer_get_request_analytics` | Request Analytics |
> | `promptlayer_get_request_analytics_custom_analytics` | Request Analytics Custom Analytics |
> | `promptlayer_get_request_search_suggestions` | Search Request Suggestions |
> | `promptlayer_get_skill_collection_public` | Get Skill Collection |
> | `promptlayer_get_snippet_usage` | Get Snippet Usage |
> | `promptlayer_get_table` | Get Table. |
> | `promptlayer_get_table_sheet` | Get Sheet. |
> | `promptlayer_get_table_sheet_cell` | Retrieve a single cell by ID. |
> | `promptlayer_get_table_sheet_operation` | Poll the status of an asynchronous sheet import operation. |
> | `promptlayer_get_table_sheet_operation_status` | Poll a Table sheet recalculation operation by operation ID. |
> | `promptlayer_get_table_sheet_score` | Retrieve the current score payload for a Table sheet. |
> | `promptlayer_get_table_sheet_scorecard` | Get the active scorecard for a table sheet, including latest and display calculation metadata. |
> | `promptlayer_get_table_sheet_scorecard_calculation` | Get details for a single scorecard calculation. |
> | `promptlayer_get_table_sheet_scorecard_row` | Get row-level scorecard breakdown for a single row index. |
> | `promptlayer_get_table_sheet_version` | Retrieve one Table sheet version, including its snapshot. |
> | `promptlayer_get_table_sheet_version_score_history` | Retrieve score-history points across Table sheet versions. |
> | `promptlayer_get_tool_registry` | Get Tool Registry |
> | `promptlayer_get_trace` | Get Trace |
> | `promptlayer_get_trace_analytics_custom_analytics` | Trace Analytics Custom Queries |
> | `promptlayer_get_workflow` | Get Agent |
> | `promptlayer_get_workflow_labels` | Get Agent Labels |
> | `promptlayer_get_workflow_version_execution_results` | Get Workflow Version Execution Results |
> | `promptlayer_ingest_otlp_traces` | Ingest Traces (OTLP) |
> | `promptlayer_list_dataset_group_id_external_ids` | List Dataset Group External IDs |
> | `promptlayer_list_datasets` | List Datasets |
> | `promptlayer_list_evaluations` | List Evaluations |
> | `promptlayer_list_folder_entities_api_public_v2_folders_entities_get` | List Folder Entities |
> | `promptlayer_list_folder_id_external_ids` | List Folder External IDs |
> | `promptlayer_list_prompt_template_id_external_ids` | List Prompt Template External IDs |
> | `promptlayer_list_report_id_external_ids` | List Report External IDs |
> | `promptlayer_list_skill_collection_id_external_ids` | List Skill Collection External IDs |
> | `promptlayer_list_skill_collections_public` | List Skill Collections |
> | `promptlayer_list_tables` | List Tables in the workspace. |
> | `promptlayer_list_table_sheet_columns` | List columns in a sheet, ordered by position rank. |
> | `promptlayer_list_table_sheet_operations` | List active recalculation operations and cell status counts for a Table sheet. |
> | `promptlayer_list_table_sheet_rows` | List rows in a sheet, each containing a map of column\_id to cell. |
> | `promptlayer_list_table_sheets` | List all sheets in a table, ordered by their index. |
> | `promptlayer_list_table_sheet_scorecard_rows` | List row-level scorecard summaries for a calculation. |
> | `promptlayer_list_table_sheet_versions` | List saved versions for a Table sheet. |
> | `promptlayer_list_tool_env_vars` | List Tool Env Vars |
> | `promptlayer_list_tool_id_external_ids` | List Tool Registry External IDs |
> | `promptlayer_list_tool_registries` | List Tool Registries |
> | `promptlayer_list_workflow_id_external_ids` | List Workflow External IDs |
> | `promptlayer_list_workflows` | List Workflows |
> | `promptlayer_list_workspace_env_vars` | List Workspace Env Vars |
> | `promptlayer_log_request` | Log Request |
> | `promptlayer_migrate_legacy_table_sheet_score_to_scorecard` | Convert legacy sheet score configuration into scorecard criteria. |
> | `promptlayer_move_folder_entities_api_public_v2_folders_entities_post` | Move Folder Entities |
> | `promptlayer_patch_prompt_template_version` | Patch Prompt Template Version |
> | `promptlayer_patch_workflow` | Patch Workflow |
> | `promptlayer_prompt_templates_labels_prompt_label_id_patch` | Move Prompt Template Labels |
> | `promptlayer_publish_prompt_template_rest_prompt_templates_post` | Publish Prompt Template |
> | `promptlayer_recalculate_table_sheet_score` | Queue recalculation for an existing Table sheet score configuration. |
> | `promptlayer_recalculate_table_sheet_scorecard` | Queue scorecard recalculation for a table sheet. |
> | `promptlayer_rename_report` | Rename Evaluation Pipeline |
> | `promptlayer_resolve_folder_id_api_public_v2_folders_resolve_id_get` | Resolve Folder ID by Path |
> | `promptlayer_run_report` | Run Full Evaluation |
> | `promptlayer_run_workflow` | Run Workflow |
> | `promptlayer_save_draft_dataset_version` | Save Draft Dataset Version |
> | `promptlayer_save_skill_collection_version_public` | Save Skill Collection Version |
> | `promptlayer_search_request_logs` | Search Request Logs |
> | `promptlayer_test_execute_tool` | Test Execute Tool |
> | `promptlayer_track_group` | Track Group |
> | `promptlayer_track_metadata` | Track Metadata |
> | `promptlayer_track_prompt` | Track Prompt |
> | `promptlayer_track_score` | Track Score |
> | `promptlayer_update_folder_api_public_v2_folders_patch` | Update Folder |
> | `promptlayer_update_report_score_card` | Configure Custom Scoring |
> | `promptlayer_update_skill_collection_public` | Update Skill Collection |
> | `promptlayer_update_table` | Update Table. |
> | `promptlayer_update_table_sheet` | Update Sheet. |
> | `promptlayer_update_table_sheet_cell` | Edit the value of a text column cell. |
> | `promptlayer_update_table_sheet_column` | Update a column's title, config, or dependencies. |
> | `promptlayer_update_tool_env_var` | Update Tool Env Var |
> | `promptlayer_update_workspace_env_var` | Update Workspace Env Var |
> | `promptlayer_upsert_prompt_template_by_external_id` | Upsert Prompt Template by External ID |

## Frequently asked questions

> [accordion] Can I limit an agent to read-only access to prompt templates?
>
> Yes. Write a credential policy with ALLOW rules that list only retrieval operations such as get and list operations, then add a DENY rule for publish, patch, and delete operations. Guild's credential proxy enforces the rules before any request reaches PromptLayer. See [credential policies](https://docs.guild.ai/platform/credential-policies.md).

> [accordion] Does the integration support webhook events from PromptLayer?
>
> No. The catalog entry for `guildai~promptlayer` lists no webhook events, so event-triggered runs from PromptLayer are not available.

> [accordion] Can different agents in the same workspace use different PromptLayer accounts?
>
> Yes. Connect a dedicated credential on each installed agent's detail page. Guild resolves a dedicated credential ahead of the workspace or account credential, so each agent authenticates with its own key.

> [accordion] How do I include only the tools my agent needs?
>
> Use pick() from the Guild Agent SDK to select specific tools by name. All PromptLayer tools are prefixed with promptlayer\_, making it straightforward to select a subset. See [SDK tools](https://docs.guild.ai/sdk/tools.md) for details.

## Put a governed agent on PromptLayer today

> [card] [Book a demo](https://guild-ai.cal.com/gtm/meeting-with-guild.ai)
>
> See how teams govern agents that use PromptLayer.

> [card] [Talk to sales](https://guild.ai/talk-to-sales)
>
> Get access to Guild, then connect PromptLayer to your first agent.

## Related

**Also runs on Guild:** [AWS CloudWatch](https://docs.guild.ai/integrations/aws-cloudwatch.md) · [Braintrust](https://docs.guild.ai/integrations/braintrust.md) · [Datadog](https://docs.guild.ai/integrations/datadog.md) · [Google Logging](https://docs.guild.ai/integrations/google-logging.md)

**Read:** Docs: [Credential policies](https://docs.guild.ai/platform/credential-policies.md) · [Credentials](https://docs.guild.ai/platform/credentials.md) · [Tools in agents](https://docs.guild.ai/sdk/tools.md)
