{"uid":"cap_vqsFPFBpkcQTcNpMdZ_xV","slug":"ailabra-agent-profit-ledger-analyze-48d49de8","name":"Ailabra Agent Profit Ledger - Analyze","description":"Deterministic profit and cash-flow infrastructure for autonomous agents.","url":"https://x402.ailabra.org/api/v1/x402/profit/analyze","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"events":{"type":"array","items":{"$id":"https://x402.ailabra.org/api/v1/schemas/economic-event","type":"object","title":"Ailabra Economic Event v1","$schema":"https://json-schema.org/draft/2020-12/schema","required":["schemaVersion","externalId","occurredAt","kind","direction","amount","currency","category","source"],"properties":{"kind":{"enum":["revenue","expense","refund","fee","transfer","capital","withdrawal","asset_purchase","asset_sale","adjustment"],"type":"string"},"amount":{"type":"string","pattern":"^(?:0|[1-9]\\d*)(?:\\.\\d+)?$"},"source":{"type":"object","required":["name","type","verification"],"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"description":"Identifies the originating ledger or integration and participates in duplicate detection with externalId."},"type":{"type":"string"},"reference":{"type":"string"},"verification":{"enum":["self_reported","receipt_supplied","receipt_verified","onchain_verified","system_observed"],"type":"string"}},"additionalProperties":false},"agentId":{"type":"string"},"category":{"type":"string","maxLength":120,"minLength":1},"currency":{"type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"metadata":{"type":"object"},"direction":{"enum":["inflow","outflow"],"type":"string"},"productId":{"type":"string"},"ventureId":{"type":"string"},"adjustment":{"type":"object","required":["reason","profitTreatment"],"properties":{"reason":{"type":"string"},"profitTreatment":{"enum":["revenue","cost","exclude"],"type":"string"}}},"customerId":{"type":"string"},"externalId":{"type":"string","maxLength":160,"minLength":1},"occurredAt":{"type":"string","format":"date-time"},"assetPolicy":{"enum":["expense","exclude"],"type":"string"},"experimentId":{"type":"string"},"schemaVersion":{"const":"1"},"x402PaymentId":{"type":"string"},"relatedEventId":{"type":"string"},"transactionHash":{"type":"string"}},"additionalProperties":false}}}},"responseSchema":{"type":"json","example":{"findings":[],"schemaVersion":"2","serviceVersion":"1.0.9","analysisVersion":"2.0.0","calculationEngineVersion":"2.0.0"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.05","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.05/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.05","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_i8XnwrVH9jw7CHjevgIC_","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.05","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Analyzes a batch of economic events (revenue, expenses, fees, transfers, etc.) to produce deterministic profit and cash-flow findings for autonomous agents.","exampleAgentPrompt":"Analyze these economic events for my agent venture 'venture-42' and tell me whether it's profitable: a $120 revenue inflow from 'stripe' (receipt_supplied) on 2025-06-01, a $30 fee outflow from 'openai' (system_observed) on 2025-06-01, and a $15 expense outflow from 'aws' (system_observed) on 2025-06-01 — all in USD.","exampleUseCases":[{"title":"Daily P&L check for agent fleet","prompt":"Take today's economic events for my agent fleet — $2,400 revenue inflow from our API customers, $800 in LLM call fees, and $200 in infrastructure expenses, all in USDC — and tell me if we're profitable and what the findings show."},{"title":"Post-campaign revenue attribution","prompt":"I have a list of events from our June marketing experiment: $5,000 inflow categorized as 'revenue' from stripe, $1,200 outflow as 'fee' from ad platforms, and a $300 refund outflow — all USD, experiment ID 'exp-june-2025'. Can you run profit analysis on these and show me the cash-flow findings?"},{"title":"On-chain payment audit for autonomous agent","prompt":"My agent processed several x402 payments yesterday — here are the events: a 0.5 USDC revenue inflow verified onchain from 'x402-gateway', and a 0.05 USDC fee outflow system-observed from 'ailabra'. Run a deterministic profit analysis so I can see the net position."}],"resultDescription":"Returns a JSON object containing an array of profit/cash-flow findings, plus versioning metadata (schemaVersion, serviceVersion, analysisVersion, calculationEngineVersion). Findings capture the deterministic output of classifying and aggregating the submitted economic events into profit-and-loss signals.","failureModes":["Missing required fields (schemaVersion, externalId, occurredAt, kind, direction, amount, currency, category, source) cause validation errors","Invalid amount format (non-numeric or negative) rejected by pattern validation","Unrecognized currency code (must match ^[A-Z][A-Z0-9]{1,11}$) causes schema rejection","Invalid kind or direction enum values return validation errors","Empty events array may return empty findings with no actionable output","Payment failure (insufficient USDC balance for $0.05 per-call fee) blocks the request","Duplicate externalId + source.name combinations may be flagged in findings"],"whenToPreferThis":"Choose this endpoint when you need deterministic, structured profit-and-loss computation for autonomous agent economic activity — especially when events originate from x402 payments, onchain sources, or multi-category ledger streams. Prefer it over generic accounting APIs when you need agent-native constructs like agentId, ventureId, x402PaymentId, and verification levels (onchain_verified, system_observed). Best when you need reproducible, versioned calculation outputs suitable for auditing agent financial behavior.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:31:58.518Z","isFirstParty":false}