agentPlasticity Documentation

Track and evaluate your AI agent calls with a single API call. Works with any language or framework.

Quick Start

Send a POST request to /api/ingest with your agent API token. That's it — works with any language or framework.

  1. Create a project and agent in Projects
  2. Copy the agent's API token
  3. Send your AI call data using any HTTP client

JavaScript / TypeScript

track.ts
await fetch('https://www.agentplasticity.com/api/ingest', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_TOKEN',
  },
  body: JSON.stringify({
    prompt: 'Summarize this document...',
    output: 'The document discusses...',
    modelName: 'gpt-4o',
  }),
});

With optional metadata (token usage, latency):

track-with-metadata.ts
const start = Date.now();
const output = await llm.chat('Summarize this document...');
const latencyMs = Date.now() - start;

await fetch('https://www.agentplasticity.com/api/ingest', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${process.env.AGENT_PLASTICITY_API_KEY}`,
  },
  body: JSON.stringify({
    prompt: 'Summarize this document...',
    output,
    modelName: 'gpt-4o',
    systemPrompt: 'You are a helpful assistant.',
    metadata: { latencyMs, tokenUsage: 350 },
  }),
});

Python

track.py
import requests

requests.post(
    "https://www.agentplasticity.com/api/ingest",
    headers={"Authorization": "Bearer YOUR_API_TOKEN"},
    json={
        "prompt": "Summarize this document...",
        "output": "The document discusses...",
        "modelName": "gpt-4o",
        "metadata": {"latencyMs": 1200, "tokenUsage": 350},
    },
)

cURL

Terminal
curl -X POST https://www.agentplasticity.com/api/ingest \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
    "prompt": "Summarize this document...",
    "output": "The document discusses...",
    "modelName": "gpt-4o",
    "metadata": {
      "latencyMs": 1200,
      "tokenUsage": 350
    }
  }'

Request Body

All requests go to POST /api/ingest with a Bearer token in the Authorization header.

FieldTypeRequiredDescription
promptstringYesThe prompt sent to the AI model
outputstringYesThe AI model's response
modelNamestringYesModel identifier (e.g. "gpt-4o")
systemPromptstringNoSystem prompt used for the call
metadataobjectNoOptional data: tokenUsage (number), latencyMs (number), or any custom fields

Error Codes

The /api/ingest endpoint returns standard HTTP status codes:

StatusMeaningWhat to do
201CreatedCall tracked successfully
400Bad RequestCheck required fields: prompt, output, modelName
401UnauthorizedCheck your API token is valid and the agent is active
429Rate LimitedBack off and retry. Check X-RateLimit-Reset header
500Server ErrorRetry with exponential backoff
agentPlasticityGo to Projects