PromptLayer MCP for AI Agents

Securely connect your AI agents and chatbots (Claude, ChatGPT, Cursor, etc) with PromptLayer MCP or direct API to version prompts, run evaluations, inspect request logs, and analyze LLM performance through natural language.

PromptLayer logoPromptLayer
Api Key

PromptLayer is a prompt management and observability platform for LLM apps. Use it to version prompts, run evaluations, trace requests, and analyze model behavior.

16 Tools

Try PromptLayer now

Type what you want done — sign in and watch it run live in the Tool Router playground.

TOOL ROUTER PLAYGROUND
PromptLayer
Try asking
TOOLS

Supported Tools

Every PromptLayer action and event your agent gets out of the box.

Get Prompt Template

Retrieve a prompt template version, release label, messages, model metadata, snippets, and optionally provider-ready kwargs without executing it.

Get Registered Tool

Retrieve a PromptLayer registered tool definition by ID or name at a selected version or release label without test execution.

Get Request Log

Retrieve one PromptLayer request log with its recorded input, output, timing, usage, metadata, tags, and scores.

Get Skill Collection

Retrieve a PromptLayer skill collection and its files as JSON at a selected version or release label.

Get Table

Retrieve one PromptLayer Table's metadata and per-sheet row counts by UUID.

Get Workflow

Retrieve a PromptLayer workflow definition by ID or name at a specific version or release label without running it.

List Folder Entities

Browse or search PromptLayer folders and registry entities in the API-key workspace, optionally recursively and with metadata.

List Prompt Templates

Search and page through PromptLayer prompt templates and snippets without executing a model.

List Registered Tools

List and filter tools defined in PromptLayer's tool registry without executing them.

List Skill Collections

List and filter PromptLayer skill collections available in the API-key workspace.

List Table Columns

List one page of user and optionally system columns for a PromptLayer Table sheet.

List Table Rows

Read one page of rows and cells from a PromptLayer Table sheet, with optional schema and execution aggregates.

List Tables

Search and page through PromptLayer Tables by folder, name, or referenced prompt.

List Table Sheets

List one page of sheets in a PromptLayer Table, optionally filtering by referenced prompt.

List Workflows

Search and page through PromptLayer workflows without running them.

Search Request Logs

Search PromptLayer request logs by text or structured filters and return one rate-limited page sorted by operational fields.

SETUP GUIDE

Connect PromptLayer MCP Tool with your Agent

1

Install Composio

typescript
npm install @composio/core ai @ai-sdk/openai @ai-sdk/mcp
Install the Composio SDK for Python or TypeScript
2

Initialize Client and Create Tool Router Session

typescript
import { Composio } from '@composio/core';

const composio = new Composio({ apiKey: 'your-api-key' });
const session = await composio.create('your-user-id');
console.log(`Tool Router session created: ${session.mcp.url}`);
Import and initialize the Composio client, then create a Tool Router session for PromptLayer
3

Connect to AI Agent

typescript
import { openai } from '@ai-sdk/openai';
import { experimental_createMCPClient as createMCPClient } from '@ai-sdk/mcp';
import { generateText } from 'ai';

const client = await createMCPClient({
  transport: {
    type: 'http',
    url: session.mcp.url,
    headers: {
      'x-api-key': 'your-composio-api-key',
    },
  },
});

const tools = await client.tools();
const { text } = await generateText({
  model: openai('gpt-4o'),
  tools,
  messages: [{
    role: 'user',
    content: 'Compare the latest PromptLayer prompt versions and identify which evaluation scores improved'
  }],
  maxSteps: 5,
});

console.log(`Agent: ${text}`);
Use the MCP server with your AI agent (Anthropic Claude or Mastra)
SETUP GUIDE

Connect PromptLayer API Tool with your Agent

1

Install Composio

typescript
npm install @composio/openai
Install the Composio SDK
2

Initialize Composio and Create Tool Router Session

typescript
import OpenAI from 'openai';
import { Composio } from '@composio/core';
import { OpenAIResponsesProvider } from '@composio/openai';

const composio = new Composio({
  provider: new OpenAIResponsesProvider(),
});
const openai = new OpenAI({});
const session = await composio.create('your-user-id');
Import and initialize Composio client, then create a Tool Router session
3

Execute PromptLayer Tools via Tool Router with Your Agent

typescript
const tools = session.tools;
const response = await openai.responses.create({
  model: 'gpt-4.1',
  tools: tools,
  input: [{
    role: 'user',
    content: 'List failed PromptLayer requests from the last 24 hours and summarize the main error patterns'
  }],
});
const result = await composio.provider.handleToolCalls(
  'your-user-id',
  response.output
);
console.log(result);
Get tools from Tool Router session and execute PromptLayer actions with your Agent

Why Use Composio?

AI Native PromptLayer Integration

  • Supports both PromptLayer MCP and direct API based integrations
  • Structured, LLM-friendly schemas for reliable prompt, log, and evaluation workflows
  • Rich coverage for reading, writing, and querying your PromptLayer data without bespoke integration code

Managed Auth

  • PromptLayer uses API key auth, and Composio keeps those keys out of your agent code
  • Create auth configs with auth_configs.create() and link user accounts with connected_accounts.link()
  • Use per user and per environment credentials instead of hard-coded PromptLayer keys

Agent Optimized Design

  • Tools are tuned for LLMs, so agents can safely inspect PromptLayer runs, evaluations, and prompt versions
  • Comprehensive execution logs help you see what ran, when, and on whose behalf
  • Use mcp.create() or Tool Router sessions to connect PromptLayer to Claude, ChatGPT, Cursor, and other agents

Enterprise Grade Security

  • Fine-grained RBAC helps you control which agents and users can access PromptLayer
  • Scoped, least privilege access keeps PromptLayer prompt and observability data protected
  • Full audit trails make agent activity easier to review, debug, and govern
FAQ

Frequently asked questions

Yes, PromptLayer requires you to configure your own API key credentials. Once set up, Composio handles secure credential storage and API request handling for you.

Yes! Composio's Tool Router enables agents to use multiple toolkits. Learn more.

Composio is SOC 2 and ISO 27001 compliant with all data encrypted in transit and at rest. Learn more.

Composio maintains and updates all toolkit integrations automatically, so your agents always work with the latest API versions.

Start with PromptLayer.It takes 30 seconds.

Managed auth, hosted MCP servers, and every PromptLayer tool your agent needs.Free to start.

Start building