agentcogs 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {agentcogs-0.1.2 → agentcogs-0.1.4}/PKG-INFO +10 -7
  2. {agentcogs-0.1.2 → agentcogs-0.1.4}/PYPI.md +7 -4
  3. {agentcogs-0.1.2 → agentcogs-0.1.4}/pyproject.toml +2 -2
  4. agentcogs-0.1.4/src/agentcogs/_version.py +1 -0
  5. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/config.py +9 -0
  6. agentcogs-0.1.4/src/agentcogs/star.py +66 -0
  7. agentcogs-0.1.2/src/agentcogs/_version.py +0 -1
  8. {agentcogs-0.1.2 → agentcogs-0.1.4}/.gitignore +0 -0
  9. {agentcogs-0.1.2 → agentcogs-0.1.4}/LICENSE +0 -0
  10. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/__init__.py +0 -0
  11. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/__main__.py +0 -0
  12. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/_shekel_compat.py +0 -0
  13. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/budget.py +0 -0
  14. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/client.py +0 -0
  15. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/context.py +0 -0
  16. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/errors.py +0 -0
  17. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/integrations/__init__.py +0 -0
  18. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/integrations/fastapi.py +0 -0
  19. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/integrations/langgraph.py +0 -0
  20. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/integrations/litellm_event.py +0 -0
  21. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/outbox.py +0 -0
  22. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/ping.py +0 -0
  23. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/shutdown.py +0 -0
  24. {agentcogs-0.1.2 → agentcogs-0.1.4}/src/agentcogs/tokens.py +0 -0
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: agentcogs
3
- Version: 0.1.2
4
- Summary: Track LLM API costs per customer, compare each monthly fee with that AI cost, and check the budget before the next call
3
+ Version: 0.1.4
4
+ Summary: Customer-level AI unit economics. Compare each customer's LLM cost with their monthly fee
5
5
  Project-URL: Homepage, https://agentcogs.vercel.app
6
6
  Project-URL: Repository, https://github.com/vaibhav11123/agentcogs
7
7
  Project-URL: Issues, https://github.com/vaibhav11123/agentcogs/issues
8
8
  Author-email: AgentCOGS <hello@agentcogs.dev>
9
9
  License: MIT
10
10
  License-File: LICENSE
11
- Keywords: anthropic,attribution,billing,cost,langchain,langgraph,llm,margin,openai,tenant
11
+ Keywords: anthropic,attribution,billing,cost,langchain,langgraph,llm,margin,openai,tenant,unit-economics
12
12
  Classifier: Development Status :: 4 - Beta
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: License :: OSI Approved :: MIT License
@@ -29,11 +29,13 @@ Provides-Extra: integrations
29
29
  Requires-Dist: starlette>=0.27.0; extra == 'integrations'
30
30
  Description-Content-Type: text/markdown
31
31
 
32
- # AgentCOGS
32
+ <p align="center">
33
+ <img alt="AgentCOGS" src="https://raw.githubusercontent.com/vaibhav11123/agentcogs/main/docs/assets/brand/1-agentcogs-lockup-primary.png" width="420">
34
+ </p>
33
35
 
34
- AgentCOGS is an open-source Python SDK, plus a self-hosted dashboard, that attributes each LLM call to the customer who caused it, compares that cost with the monthly fee, and checks a per-customer budget before the next SDK call.
36
+ AgentCOGS is an open-source Python SDK and a self-hosted dashboard for customer-level AI unit economics. It attributes each LLM call to the customer who caused it, compares that cost with the monthly fee, and checks a per-customer budget before the next SDK call.
35
37
 
36
- **Which customer stops making money this month.** The blended total can look fine while one customer's fee no longer covers their AI cost.
38
+ **Know which AI customers make you money, and which ones are eating your margins.** The blended total can look fine while one fee no longer covers the AI cost. Which customer stops making money this month.
37
39
 
38
40
  ```bash
39
41
  pip install agentcogs
@@ -43,7 +45,7 @@ This package is the SDK. It is on PyPI. The customer list is the dashboard in th
43
45
 
44
46
  ## What does the number mean?
45
47
 
46
- AI margin is `(monthly fee − attributed AI cost) / monthly fee`. It is not accounting gross margin. It leaves out people, infrastructure, refunds, discounts, credits, and proration. You type the fee, or you pull that customer's Stripe subscription. The SDK does not invent it.
48
+ AI margin is `(monthly fee − attributed AI cost) / monthly fee`. It is the contribution of the fee after attributed AI cost. It is not total customer profitability, and it is not accounting gross margin. People, infrastructure, support, payment processing, refunds, discounts, credits, and proration are outside it. Pace is a straight line from the cost so far. It does not forecast a change in behavior. You type the fee, or you pull that customer's Stripe subscription. The SDK does not invent it.
47
49
 
48
50
  ## Install, configure, instrument, verify
49
51
 
@@ -113,3 +115,4 @@ LiteLLM does not ship the callback. You copy it from the repository. The FastAPI
113
115
  ## What is not guaranteed
114
116
 
115
117
  A match against the provider invoice, refunds, credits, discounts, currency conversion, and a hard stop when two calls pass the pre-check together. Development status is Beta: the SDK surface is `init`, `set_customer`, `run`, `ping`, and `shutdown`, and a hosted API is not part of this release.
118
+
@@ -1,8 +1,10 @@
1
- # AgentCOGS
1
+ <p align="center">
2
+ <img alt="AgentCOGS" src="https://raw.githubusercontent.com/vaibhav11123/agentcogs/main/docs/assets/brand/1-agentcogs-lockup-primary.png" width="420">
3
+ </p>
2
4
 
3
- AgentCOGS is an open-source Python SDK, plus a self-hosted dashboard, that attributes each LLM call to the customer who caused it, compares that cost with the monthly fee, and checks a per-customer budget before the next SDK call.
5
+ AgentCOGS is an open-source Python SDK and a self-hosted dashboard for customer-level AI unit economics. It attributes each LLM call to the customer who caused it, compares that cost with the monthly fee, and checks a per-customer budget before the next SDK call.
4
6
 
5
- **Which customer stops making money this month.** The blended total can look fine while one customer's fee no longer covers their AI cost.
7
+ **Know which AI customers make you money, and which ones are eating your margins.** The blended total can look fine while one fee no longer covers the AI cost. Which customer stops making money this month.
6
8
 
7
9
  ```bash
8
10
  pip install agentcogs
@@ -12,7 +14,7 @@ This package is the SDK. It is on PyPI. The customer list is the dashboard in th
12
14
 
13
15
  ## What does the number mean?
14
16
 
15
- AI margin is `(monthly fee − attributed AI cost) / monthly fee`. It is not accounting gross margin. It leaves out people, infrastructure, refunds, discounts, credits, and proration. You type the fee, or you pull that customer's Stripe subscription. The SDK does not invent it.
17
+ AI margin is `(monthly fee − attributed AI cost) / monthly fee`. It is the contribution of the fee after attributed AI cost. It is not total customer profitability, and it is not accounting gross margin. People, infrastructure, support, payment processing, refunds, discounts, credits, and proration are outside it. Pace is a straight line from the cost so far. It does not forecast a change in behavior. You type the fee, or you pull that customer's Stripe subscription. The SDK does not invent it.
16
18
 
17
19
  ## Install, configure, instrument, verify
18
20
 
@@ -82,3 +84,4 @@ LiteLLM does not ship the callback. You copy it from the repository. The FastAPI
82
84
  ## What is not guaranteed
83
85
 
84
86
  A match against the provider invoice, refunds, credits, discounts, currency conversion, and a hard stop when two calls pass the pre-check together. Development status is Beta: the SDK surface is `init`, `set_customer`, `run`, `ping`, and `shutdown`, and a hosted API is not part of this release.
87
+
@@ -5,12 +5,12 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  name = "agentcogs"
7
7
  dynamic = ["version"]
8
- description = "Track LLM API costs per customer, compare each monthly fee with that AI cost, and check the budget before the next call"
8
+ description = "Customer-level AI unit economics. Compare each customer's LLM cost with their monthly fee"
9
9
  readme = "PYPI.md"
10
10
  license = { text = "MIT" }
11
11
  requires-python = ">=3.10"
12
12
  authors = [{ name = "AgentCOGS", email = "hello@agentcogs.dev" }]
13
- keywords = ["llm", "cost", "attribution", "margin", "tenant", "langgraph", "langchain", "openai", "anthropic", "billing"]
13
+ keywords = ["llm", "cost", "attribution", "margin", "unit-economics", "tenant", "langgraph", "langchain", "openai", "anthropic", "billing"]
14
14
  classifiers = [
15
15
  "Development Status :: 4 - Beta",
16
16
  "Intended Audience :: Developers",
@@ -0,0 +1 @@
1
+ __version__ = "0.1.4"
@@ -74,6 +74,15 @@ def init(
74
74
  atexit.register(_shutdown_on_exit)
75
75
  _config._atexit_registered = True
76
76
 
77
+ try:
78
+ from .star import star
79
+
80
+ star()
81
+ except Exception: # noqa: BLE001 — a star failure must not fail setup
82
+ from .star import REPO_URL
83
+
84
+ print(REPO_URL)
85
+
77
86
 
78
87
  def get_config() -> _Config:
79
88
  if _config.api_key is None and not _config.offline:
@@ -0,0 +1,66 @@
1
+ """Star the GitHub repository with the person's existing ``gh`` login.
2
+
3
+ Called from ``agentcogs.init()``. Importing this module does not star anything.
4
+ """
5
+ import shutil
6
+ import subprocess
7
+
8
+ REPO_URL = "https://github.com/vaibhav11123/agentcogs"
9
+ _STAR_API = "/user/starred/vaibhav11123/agentcogs"
10
+
11
+
12
+ def star() -> int:
13
+ """Star the repository when the GitHub CLI is already logged in.
14
+
15
+ Runs ``gh auth status``. On a login, runs
16
+ ``gh api --method PUT /user/starred/vaibhav11123/agentcogs`` and prints
17
+ the result. If ``gh`` is missing or logged out, prints the repository URL
18
+ and returns 0. A failed star request prints what happened and returns
19
+ non-zero; ``init()`` ignores that and continues setup.
20
+ """
21
+ gh = shutil.which("gh")
22
+ if not gh:
23
+ print(REPO_URL)
24
+ return 0
25
+
26
+ try:
27
+ auth = subprocess.run(
28
+ [gh, "auth", "status"],
29
+ check=False,
30
+ capture_output=True,
31
+ text=True,
32
+ )
33
+ except OSError as exc:
34
+ print(f"Could not run gh auth status: {exc}")
35
+ print(REPO_URL)
36
+ return 0
37
+
38
+ if auth.returncode != 0:
39
+ print(REPO_URL)
40
+ return 0
41
+
42
+ try:
43
+ result = subprocess.run(
44
+ [gh, "api", "--method", "PUT", _STAR_API],
45
+ check=False,
46
+ capture_output=True,
47
+ text=True,
48
+ )
49
+ except OSError as exc:
50
+ print(f"Could not run gh api: {exc}")
51
+ print(REPO_URL)
52
+ return 1
53
+
54
+ if result.returncode == 0:
55
+ for stream in (result.stdout, result.stderr):
56
+ text = (stream or "").strip()
57
+ if text:
58
+ print(text)
59
+ print(f"Starred {REPO_URL}")
60
+ return 0
61
+
62
+ detail = (result.stderr or result.stdout or "").strip()
63
+ if detail:
64
+ print(detail)
65
+ print(f"Could not star {REPO_URL}")
66
+ return result.returncode or 1
@@ -1 +0,0 @@
1
- __version__ = "0.1.2"
File without changes
File without changes