Skip to main content

AgentCOGS

Which customer stops making money this month.

You sell an agent to other companies. The model provider sends one invoice. AgentCOGS splits that spend by the tenant who caused it, sets it against the monthly fee, and shows where the month is headed if the calls keep coming.

License: MIT Python 3.10+ CI

The sample company is Patternstack. One click, nothing to type. It is a snapshot of a fictional book of business, shipped in the dashboard, so it opens when no API is running. A hosted AgentCOGS API is not serving. To run your own customers, self-host.


The book, and the account inside it

Patternstack, as of 14 Nov 2026. Forty customers. The month so far looks healthy.

So far If the calls continue
AI cost $39,613.25 $84,885.54
Fees $155,918.00 $155,918.00
Margin 74.6% 45.6%

The fee is the monthly amount on the account. Pace is a straight line from the cost so far. It does not forecast a change in behavior.

Two accounts are where the month breaks. Vellum Research has cost $5,822.84 against an $8,200 fee: 29.0% so far, 2,724 runs, and the largest node is synthesize. If that spend continues, the month ends near −52.2%. Pinnacle Claims is 35.0% so far and ends near −39.3%. The blended 74.6% does not show either of those.

Patternstack customers. Blended margin 74.6%. Vellum Research is 29.0% and the month ends near −52.2%.

Open the account and the same numbers sit next to the call that posted them.

Vellum Research. Margin 29.0%, AI cost $5,822.84, fee $8,200, and the set_customer call that posts each run.

import agentcogs

agentcogs.init()  # AGENTCOGS_API_KEY, AGENTCOGS_WORKSPACE_ID, AGENTCOGS_ENDPOINT
agentcogs.set_customer("vellum_research")  # your tenant id, once per request

with agentcogs.run(workflow_id="research_agent"):
    result = agent.invoke(state)

The SDK does not call a model and does not invent the fee. It names the customer and posts the cost of the call you already made. You type the fee, or you pull the subscription from that customer's Stripe account. If no customer is set, the run stays unattributed.

python examples/one_run.py posts one recorded $0.84 cost for Vellum Research so you can see a row land. It does not call a model.


Look, then run it on yours

Look. agentcogs.vercel.app → Open Patternstack.

Run. From this repo:

cp .env.selfhost.example .env
docker compose up -d --build

Open http://localhost:3000 and choose Create my workspace. No email. The next screen has the install command with your key in it. The package is not on PyPI yet:

pip install "agentcogs @ git+https://github.com/vaibhav11123/agentcogs.git"

Point AGENTCOGS_ENDPOINT at http://localhost:8000. Send one call, open that customer, and type the monthly fee. Margin is the fee minus the cost.

Full steps: docs/quickstart.md. Self-host notes: docs/DEPLOY.md.


Who it is for

A founder of a product that sells one agent to many companies, priced as a monthly fee, with the model bill arriving as a single invoice. Support, research, claims, intake, document pipelines.

You already have AgentCOGS adds
Langfuse or LangSmith Which tenant the trace belonged to, and whether that tenant is still profitable
LiteLLM A callback that posts the tenant and the cost. The proxy stays
Stripe The subscription as the fee, and an optional meter for the usage you already attributed
The provider invoice The join from that one number to the customer list

What you can connect

FastAPI Set the tenant from the request
LangGraph Wrap the graph
LiteLLM Post proxy traffic without wrapping the app
Customer import Load names and fees before the first run
Slack A spike opens that customer
Stripe Pull subscription fees. Push a daily usage meter
Budget monthly_budget_usd raises CustomerBudgetExceededError before the next call

Terminal proof for the SDK, the outbox, and a live call: docs/demo-paths.md.


Repo

Path
src/agentcogs/ The SDK
backend/ Ingest, margin, pace, budgets
dashboard/ The book
examples/one_run.py One recorded cost, no model call
docs/ Index

Python SDK, FastAPI, Postgres, Redis, React. MIT. Contributing. Security.

Metadata

Release files for agentcogs 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentcogs 0.1.1
File Size Uploaded Provenance Actions
agentcogs-0.1.1.tar.gz 13.8 kB With provenance Details for agentcogs-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentcogs 0.1.1
File Interpreter ABI Platform Actions
agentcogs-0.1.1-py3-none-any.whl Python 3 none any Details for agentcogs-0.1.1-py3-none-any.whl

Total release size: 32.3 kB

Release files / agentcogs-0.1.1.tar.gz

Download URL agentcogs-0.1.1.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
67335715e18c3101229150d5c482c760b225278d4c9d38b6fdb1aaae2e51f0a2
BLAKE2b-256 checksum
How to use checksums
f81df1015be8fbbb3f5e5dced35a25ad7cf9796a4b10f4b68c4717f97e00eaef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / agentcogs-0.1.1-py3-none-any.whl

Download URL agentcogs-0.1.1-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0280c77967879497420eb9a0159ffeb5af559bbd5de4539d7a2f710429d0ea29
BLAKE2b-256 checksum
How to use checksums
8f32b385a3db848b61dcc9443399332c89902921e251040d0b2000a0f5c0f3aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for agentcogs 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentcogs-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page