agentcat 1.0.2__tar.gz → 2.0.0__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 (195) hide show
  1. {agentcat-1.0.2 → agentcat-2.0.0}/.gitignore +1 -0
  2. agentcat-2.0.0/CONTRIBUTING.md +280 -0
  3. {agentcat-1.0.2 → agentcat-2.0.0}/PKG-INFO +77 -40
  4. {agentcat-1.0.2 → agentcat-2.0.0}/README.md +71 -34
  5. agentcat-2.0.0/docs/cats/void.jpg +0 -0
  6. {agentcat-1.0.2 → agentcat-2.0.0}/pyproject.toml +21 -6
  7. agentcat-2.0.0/src/agentcat/__init__.py +458 -0
  8. agentcat-2.0.0/src/agentcat/modules/__init__.py +15 -0
  9. agentcat-2.0.0/src/agentcat/modules/adapters/__init__.py +11 -0
  10. agentcat-2.0.0/src/agentcat/modules/adapters/_common.py +123 -0
  11. agentcat-2.0.0/src/agentcat/modules/adapters/_inner_tap.py +390 -0
  12. agentcat-2.0.0/src/agentcat/modules/adapters/community.py +831 -0
  13. agentcat-2.0.0/src/agentcat/modules/adapters/lowlevel_v1.py +552 -0
  14. agentcat-2.0.0/src/agentcat/modules/adapters/lowlevel_v2.py +644 -0
  15. agentcat-2.0.0/src/agentcat/modules/callpath.py +321 -0
  16. agentcat-2.0.0/src/agentcat/modules/client_identity.py +103 -0
  17. agentcat-2.0.0/src/agentcat/modules/constants.py +66 -0
  18. agentcat-2.0.0/src/agentcat/modules/detection.py +191 -0
  19. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/diagnostics.py +24 -3
  20. agentcat-2.0.0/src/agentcat/modules/event_queue.py +399 -0
  21. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/exceptions.py +143 -86
  22. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/exporters/otlp.py +24 -1
  23. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/exporters/sentry.py +1 -1
  24. agentcat-2.0.0/src/agentcat/modules/handles.py +316 -0
  25. agentcat-2.0.0/src/agentcat/modules/hooks.py +233 -0
  26. agentcat-2.0.0/src/agentcat/modules/identify.py +39 -0
  27. agentcat-2.0.0/src/agentcat/modules/injection.py +416 -0
  28. agentcat-2.0.0/src/agentcat/modules/internal.py +167 -0
  29. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/logging.py +29 -8
  30. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/redaction.py +51 -1
  31. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/request_extra.py +15 -0
  32. agentcat-2.0.0/src/agentcat/modules/tools.py +55 -0
  33. agentcat-2.0.0/src/agentcat/types.py +303 -0
  34. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/utils.py +31 -0
  35. agentcat-2.0.0/tests/community/__init__.py +1 -0
  36. agentcat-2.0.0/tests/community/test_community_v3_event_serialization.py +138 -0
  37. agentcat-2.0.0/tests/community/test_community_v3_handles.py +1157 -0
  38. agentcat-2.0.0/tests/community/test_community_v3_inject_context.py +138 -0
  39. {agentcat-1.0.2 → agentcat-2.0.0}/tests/community/test_community_v3_openapi.py +80 -100
  40. agentcat-2.0.0/tests/community/test_community_v3_runtime_state_tools.py +114 -0
  41. agentcat-2.0.0/tests/conftest.py +96 -0
  42. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/community_v3/conftest.py +19 -8
  43. agentcat-2.0.0/tests/e2e/community_v3/test_agent_handle_http.py +203 -0
  44. agentcat-2.0.0/tests/e2e/community_v3/test_event_capture_http.py +152 -0
  45. agentcat-2.0.0/tests/e2e/community_v3/test_identify_http.py +189 -0
  46. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/community_v3/test_request_extra_http.py +18 -31
  47. agentcat-2.0.0/tests/e2e/community_v3/test_stateless_http.py +99 -0
  48. agentcat-2.0.0/tests/e2e/community_v4/__init__.py +1 -0
  49. agentcat-2.0.0/tests/e2e/community_v4/conftest.py +97 -0
  50. agentcat-2.0.0/tests/e2e/community_v4/test_agent_handle_http.py +202 -0
  51. agentcat-2.0.0/tests/e2e/community_v4/test_identify_http.py +199 -0
  52. agentcat-2.0.0/tests/e2e/community_v4/test_session_http.py +214 -0
  53. agentcat-2.0.0/tests/e2e/community_v4/test_stateless_http.py +102 -0
  54. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/conftest.py +1 -1
  55. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/official/conftest.py +7 -0
  56. agentcat-2.0.0/tests/e2e/official/test_agent_handle_http.py +237 -0
  57. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/official/test_event_capture_http.py +10 -11
  58. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/official/test_identify_http.py +38 -24
  59. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/official/test_redaction_http.py +8 -26
  60. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/official/test_request_extra_http.py +9 -11
  61. agentcat-2.0.0/tests/e2e/official/test_session_http.py +233 -0
  62. agentcat-2.0.0/tests/e2e/official/test_stateless_http.py +103 -0
  63. agentcat-2.0.0/tests/e2e/official_modern/conftest.py +70 -0
  64. agentcat-2.0.0/tests/e2e/official_modern/test_agent_handle_http.py +198 -0
  65. agentcat-2.0.0/tests/e2e/official_modern/test_identify_http.py +231 -0
  66. agentcat-2.0.0/tests/e2e/official_modern/test_mcpserver_http.py +101 -0
  67. agentcat-2.0.0/tests/e2e/official_modern/test_session_http.py +258 -0
  68. agentcat-2.0.0/tests/e2e/official_modern/test_stateless_http.py +95 -0
  69. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_api_base_url.py +25 -53
  70. agentcat-2.0.0/tests/test_async_hooks.py +327 -0
  71. agentcat-2.0.0/tests/test_callpath.py +720 -0
  72. agentcat-2.0.0/tests/test_client_identity.py +111 -0
  73. agentcat-2.0.0/tests/test_community_v4_handles.py +843 -0
  74. agentcat-2.0.0/tests/test_concurrency_handles.py +194 -0
  75. agentcat-2.0.0/tests/test_constants_copy.py +198 -0
  76. agentcat-2.0.0/tests/test_customer_owned_parameters.py +160 -0
  77. agentcat-2.0.0/tests/test_detection.py +336 -0
  78. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_diagnostics_attributes.py +16 -0
  79. agentcat-2.0.0/tests/test_diagnostics_export.py +138 -0
  80. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_diagnostics_sink.py +2 -1
  81. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_diagnostics_test_env.py +5 -4
  82. agentcat-2.0.0/tests/test_dynamic_tracking.py +259 -0
  83. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_event_capture_completeness.py +32 -63
  84. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_event_queue.py +281 -182
  85. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_event_tags_properties.py +23 -12
  86. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_exceptions.py +202 -2
  87. agentcat-2.0.0/tests/test_exporter_sdk_version.py +157 -0
  88. agentcat-2.0.0/tests/test_handles.py +451 -0
  89. agentcat-2.0.0/tests/test_hook_offload.py +207 -0
  90. agentcat-2.0.0/tests/test_identify_shape.py +188 -0
  91. agentcat-2.0.0/tests/test_injection.py +577 -0
  92. agentcat-2.0.0/tests/test_inner_tap.py +1356 -0
  93. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_logging.py +162 -2
  94. agentcat-2.0.0/tests/test_lowlevel_v1_handles.py +752 -0
  95. agentcat-2.0.0/tests/test_lowlevel_v2_handles.py +1360 -0
  96. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_multiple_servers.py +13 -10
  97. agentcat-2.0.0/tests/test_options_v2.py +14 -0
  98. agentcat-2.0.0/tests/test_process_safety.py +265 -0
  99. agentcat-2.0.0/tests/test_publish_custom_event.py +447 -0
  100. agentcat-2.0.0/tests/test_rebuild_on_demand.py +332 -0
  101. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_redaction.py +101 -3
  102. agentcat-2.0.0/tests/test_removed_events.py +90 -0
  103. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_report_missing.py +23 -17
  104. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_request_extra.py +89 -25
  105. agentcat-2.0.0/tests/test_response_shape.py +90 -0
  106. agentcat-2.0.0/tests/test_session_id_validation.py +443 -0
  107. agentcat-2.0.0/tests/test_tool_context.py +662 -0
  108. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_truncation.py +7 -1
  109. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_truncation_json_safe.py +3 -3
  110. agentcat-2.0.0/tests/test_utils/__init__.py +207 -0
  111. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_utils/client.py +17 -2
  112. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_utils/community_openapi_server.py +18 -3
  113. agentcat-2.0.0/tests/test_utils/delivery.py +73 -0
  114. agentcat-2.0.0/tests/test_utils/flavors.py +816 -0
  115. agentcat-2.0.0/tests/test_utils/modern_server.py +144 -0
  116. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_utils/todo_server.py +25 -5
  117. agentcat-1.0.2/CONTRIBUTING.md +0 -170
  118. agentcat-1.0.2/src/agentcat/__init__.py +0 -264
  119. agentcat-1.0.2/src/agentcat/modules/__init__.py +0 -28
  120. agentcat-1.0.2/src/agentcat/modules/compatibility.py +0 -262
  121. agentcat-1.0.2/src/agentcat/modules/constants.py +0 -22
  122. agentcat-1.0.2/src/agentcat/modules/context_parameters.py +0 -56
  123. agentcat-1.0.2/src/agentcat/modules/event_queue.py +0 -326
  124. agentcat-1.0.2/src/agentcat/modules/identify.py +0 -42
  125. agentcat-1.0.2/src/agentcat/modules/internal.py +0 -222
  126. agentcat-1.0.2/src/agentcat/modules/overrides/community/monkey_patch.py +0 -201
  127. agentcat-1.0.2/src/agentcat/modules/overrides/community/tool_manager.py +0 -177
  128. agentcat-1.0.2/src/agentcat/modules/overrides/community_v3/__init__.py +0 -11
  129. agentcat-1.0.2/src/agentcat/modules/overrides/community_v3/integration.py +0 -94
  130. agentcat-1.0.2/src/agentcat/modules/overrides/community_v3/middleware.py +0 -499
  131. agentcat-1.0.2/src/agentcat/modules/overrides/mcp_server.py +0 -329
  132. agentcat-1.0.2/src/agentcat/modules/overrides/official/monkey_patch.py +0 -583
  133. agentcat-1.0.2/src/agentcat/modules/session.py +0 -200
  134. agentcat-1.0.2/src/agentcat/modules/tools.py +0 -44
  135. agentcat-1.0.2/src/agentcat/modules/version_detection.py +0 -48
  136. agentcat-1.0.2/src/agentcat/types.py +0 -224
  137. agentcat-1.0.2/tests/community/__init__.py +0 -1
  138. agentcat-1.0.2/tests/community/test_community_dynamic_tracking.py +0 -412
  139. agentcat-1.0.2/tests/community/test_community_event_capture.py +0 -375
  140. agentcat-1.0.2/tests/community/test_community_fastmcp.py +0 -191
  141. agentcat-1.0.2/tests/community/test_community_report_missing.py +0 -404
  142. agentcat-1.0.2/tests/community/test_community_tool_context.py +0 -583
  143. agentcat-1.0.2/tests/community/test_community_tracking_timing.py +0 -382
  144. agentcat-1.0.2/tests/community/test_community_v3_event_serialization.py +0 -93
  145. agentcat-1.0.2/tests/community/test_community_v3_inject_context.py +0 -125
  146. agentcat-1.0.2/tests/community/test_community_v3_runtime_state_tools.py +0 -79
  147. agentcat-1.0.2/tests/conftest.py +0 -7
  148. agentcat-1.0.2/tests/e2e/community_v2/conftest.py +0 -100
  149. agentcat-1.0.2/tests/e2e/community_v2/test_identify_http.py +0 -58
  150. agentcat-1.0.2/tests/e2e/community_v2/test_request_extra_http.py +0 -40
  151. agentcat-1.0.2/tests/e2e/community_v3/test_event_capture_http.py +0 -62
  152. agentcat-1.0.2/tests/e2e/community_v3/test_identify_http.py +0 -82
  153. agentcat-1.0.2/tests/e2e/community_v3/test_stateless_http.py +0 -63
  154. agentcat-1.0.2/tests/e2e/official/test_session_http.py +0 -139
  155. agentcat-1.0.2/tests/e2e/official/test_stateless_http.py +0 -113
  156. agentcat-1.0.2/tests/test_context_parameters.py +0 -389
  157. agentcat-1.0.2/tests/test_diagnostics_export.py +0 -72
  158. agentcat-1.0.2/tests/test_dynamic_tracking.py +0 -368
  159. agentcat-1.0.2/tests/test_exporter_sdk_version.py +0 -68
  160. agentcat-1.0.2/tests/test_mcp_version_compatibility.py +0 -37
  161. agentcat-1.0.2/tests/test_session.py +0 -426
  162. agentcat-1.0.2/tests/test_stateless.py +0 -200
  163. agentcat-1.0.2/tests/test_tool_context.py +0 -941
  164. agentcat-1.0.2/tests/test_utils/__init__.py +0 -26
  165. {agentcat-1.0.2 → agentcat-2.0.0}/LICENSE +0 -0
  166. {agentcat-1.0.2 → agentcat-2.0.0}/docs/cats/bibi.png +0 -0
  167. {agentcat-1.0.2 → agentcat-2.0.0}/docs/cats/zelda.jpg +0 -0
  168. {agentcat-1.0.2 → agentcat-2.0.0}/docs/static/architecture.png +0 -0
  169. {agentcat-1.0.2 → agentcat-2.0.0}/docs/static/og-image.png +0 -0
  170. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/exporters/__init__.py +0 -0
  171. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/exporters/datadog.py +0 -0
  172. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/exporters/trace_context.py +0 -0
  173. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/sanitization.py +0 -0
  174. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/telemetry.py +0 -0
  175. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/truncation.py +0 -0
  176. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/modules/validation.py +0 -0
  177. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/thirdparty/__init__.py +0 -0
  178. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/thirdparty/ksuid/__init__.py +0 -0
  179. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/thirdparty/ksuid/baseconv.py +0 -0
  180. {agentcat-1.0.2 → agentcat-2.0.0}/src/agentcat/thirdparty/ksuid/ksuid.py +0 -0
  181. {agentcat-1.0.2 → agentcat-2.0.0}/tests/__init__.py +0 -0
  182. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/__init__.py +0 -0
  183. {agentcat-1.0.2 → agentcat-2.0.0}/tests/e2e/_helpers.py +0 -0
  184. {agentcat-1.0.2/tests/e2e/community_v2 → agentcat-2.0.0/tests/e2e/community_v3}/__init__.py +0 -0
  185. {agentcat-1.0.2/tests/e2e/community_v3 → agentcat-2.0.0/tests/e2e/official}/__init__.py +0 -0
  186. {agentcat-1.0.2/tests/e2e/official → agentcat-2.0.0/tests/e2e/official_modern}/__init__.py +0 -0
  187. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_diagnostics_auth.py +0 -0
  188. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_diagnostics_integration.py +0 -0
  189. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_diagnostics_no_payload.py +0 -0
  190. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_diagnostics_optout.py +0 -0
  191. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_diagnostics_record.py +0 -0
  192. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_sanitization.py +0 -0
  193. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_tag_validation.py +0 -0
  194. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_utils/community_client.py +0 -0
  195. {agentcat-1.0.2 → agentcat-2.0.0}/tests/test_utils/community_todo_server.py +0 -0
@@ -149,3 +149,4 @@ CLAUDE.md
149
149
  .claude/
150
150
  .serena/
151
151
  AGENTS.md
152
+ docs/superpowers/
@@ -0,0 +1,280 @@
1
+ # Contributing to AgentCat 🎉
2
+
3
+ Thank you for your interest in contributing to AgentCat! We're excited to have you join our community of developers building analytics tools for MCP servers.
4
+
5
+ ## Getting Started
6
+
7
+ 1. **Fork the repository** on GitHub
8
+ 2. **Clone your fork** locally:
9
+ ```bash
10
+ git clone https://github.com/YOUR-USERNAME/agentcat-python-sdk.git
11
+ cd agentcat-python-sdk
12
+ ```
13
+ 3. **Install dependencies** using uv (see [Dev environments](#dev-environments) for the legacy variant):
14
+ ```bash
15
+ uv sync --extra community
16
+ ```
17
+ 4. **Create a branch** for your feature or fix:
18
+ ```bash
19
+ git checkout -b feature/your-feature-name
20
+ # or
21
+ git checkout -b fix/your-bug-fix
22
+ ```
23
+
24
+ ## Dev Environments
25
+
26
+ AgentCat v2 supports two generations of the MCP ecosystem: the official `mcp` package 1.x and 2.x, and community `fastmcp` 3.x and 4.x. The two `mcp` majors cannot be installed side by side, so development uses two mutually exclusive uv dependency groups, declared as conflicting in `pyproject.toml`:
27
+
28
+ - `mcp-modern` — `mcp` 2.x + `fastmcp` 4.x (the default group)
29
+ - `mcp-legacy` — `mcp` 1.x + `fastmcp` 3.x
30
+
31
+ **Modern environment (default):**
32
+
33
+ ```bash
34
+ uv sync --extra community
35
+ ```
36
+
37
+ **Legacy environment** (turn off the default modern group, turn on legacy):
38
+
39
+ ```bash
40
+ uv sync --extra community --no-group mcp-modern --group mcp-legacy
41
+ ```
42
+
43
+ Note that a bare `uv run` re-syncs to the default (modern) environment, which would silently undo a legacy sync. Once you have synced the generation you want, run against it with `--no-sync`:
44
+
45
+ ```bash
46
+ uv run --no-sync pytest
47
+ ```
48
+
49
+ **Both generations are expected to pass.** `tests/conftest.py` reads the installed `mcp` major at collection time and skips the modules that target the other generation, so the same `pytest` invocation selects the right subset in either environment — there is nothing to pass by hand. At the time of writing that is 576 passed / 26 skipped on modern and 732 passed / 10 skipped on legacy. CI runs both legs in the `test-dependency-groups` job of `mcp-compatibility.yml`, so a change that only works in the generation you developed in will be caught there.
50
+
51
+ ## Development Process
52
+
53
+ ### Making Changes
54
+
55
+ 1. **Write your code** following our Python standards
56
+ 2. **Add tests** for new features (required for feature additions)
57
+ 3. **Run the test suite** to ensure everything passes, in the generation you
58
+ synced:
59
+ ```bash
60
+ uv run --no-sync pytest
61
+ ```
62
+ `--no-sync`: a bare `uv run` re-syncs to the default (modern) groups and
63
+ silently undoes a legacy sync. Both generations are expected to pass — see
64
+ [Dev Environments](#dev-environments).
65
+ 4. **Check your code** meets our standards:
66
+ ```bash
67
+ uvx ruff check . # lint the whole repo
68
+ git diff --name-only main -- '*.py' | xargs -r uvx ruff format --check
69
+ ```
70
+ `uvx`, not `uv run` — see [Code Quality](#code-quality) for why. And
71
+ `--check`, scoped to the files you touched: 46 files in this repo are
72
+ unformatted, so a bare `uvx ruff format .` rewrites all of them and buries
73
+ your change in an unrelated 46-file diff. Reformatting debt you did not
74
+ create is welcome as [its own PR](#the-linttype-debt-and-the-ratchet).
75
+
76
+ **`xargs -r`, not `$(…)`.** With no path arguments `ruff format` defaults to
77
+ `.` — so on a branch that has touched no Python (a docs change, or before
78
+ you have made any), the substitution expands to nothing and the command
79
+ becomes exactly the whole-repo rewrite this step exists to avoid. `-r` skips
80
+ the run instead.
81
+
82
+ ### Commit Conventions
83
+
84
+ We follow [Conventional Commits](https://www.conventionalcommits.org/). Your commit messages should be structured as:
85
+
86
+ ```
87
+ <type>: <description>
88
+
89
+ [optional body]
90
+ ```
91
+
92
+ **Types:**
93
+
94
+ - `feat`: New feature
95
+ - `fix`: Bug fix
96
+ - `docs`: Documentation changes
97
+ - `test`: Adding or updating tests
98
+ - `refactor`: Code change that neither fixes a bug nor adds a feature
99
+ - `chore`: Changes to build process or auxiliary tools
100
+
101
+ **Examples:**
102
+
103
+ ```bash
104
+ git commit -m "feat: add telemetry exporters for observability"
105
+ git commit -m "fix: handle edge case in session tracking"
106
+ git commit -m "docs: update API documentation"
107
+ ```
108
+
109
+ ## Pull Request Process
110
+
111
+ 1. **Push your changes** to your fork:
112
+
113
+ ```bash
114
+ git push origin feature/your-feature-name
115
+ ```
116
+
117
+ 2. **Create a Pull Request** from your fork to our `main` branch
118
+
119
+ 3. **Fill out the PR description** with:
120
+
121
+ - What changes you've made
122
+ - Why these changes are needed
123
+ - Any relevant context or screenshots
124
+
125
+ 4. **Wait for review** - The AgentCat team will review your PR within 2 business days
126
+
127
+ 5. **Address feedback** if any changes are requested
128
+
129
+ 6. **Celebrate** 🎉 once your PR is merged!
130
+
131
+ ### No Issue Required
132
+
133
+ You don't need to open an issue before submitting a PR. Feel free to submit pull requests directly with your improvements!
134
+
135
+ ## Good First Issues
136
+
137
+ Looking for a place to start? Check out issues labeled [`good first issue`](https://github.com/agentcathq/agentcat-python-sdk/labels/good%20first%20issue) - these are great for newcomers to the codebase.
138
+
139
+ ## Testing
140
+
141
+ - New features **should include tests** to ensure reliability
142
+ - Run tests locally with `uv run --no-sync pytest`, in the generation you synced
143
+ - We use [pytest](https://docs.pytest.org/) for our test suite
144
+ - Test files should be placed in the `tests/` directory with `test_*.py` naming convention
145
+
146
+ ## Code Quality
147
+
148
+ ```bash
149
+ # Run tests — this IS gated in CI. `--no-sync` keeps the generation you synced.
150
+ uv run --no-sync pytest
151
+
152
+ # Check code style and linting
153
+ uvx ruff check .
154
+
155
+ # Check formatting (the whole repo; 46 files already fail — see the ratchet)
156
+ uvx ruff format --check .
157
+
158
+ # Format only what you changed. `xargs -r`, never `$(…)`: with no path
159
+ # arguments ruff formats `.`, so an empty expansion silently rewrites all 46.
160
+ git diff --name-only main -- '*.py' | xargs -r uvx ruff format
161
+
162
+ # Type checking
163
+ uvx mypy src/agentcat
164
+ ```
165
+
166
+ **`uvx`, not `uv run`, for the last three.** `ruff` and `mypy` are declared only
167
+ in the `dev` *extra*, and no default sync installs an extra —
168
+ `[tool.uv] default-groups` selects the `dev` dependency *group*, which holds
169
+ `freezegun`, `pytest-asyncio` and `pytest-cov`. So `uv run ruff check .` fails
170
+ with `ruff: command not found` in a normally-synced checkout. `uvx` fetches the
171
+ tool on demand and needs no environment change, which also keeps these commands
172
+ safe to run in either dependency generation.
173
+
174
+ One consequence worth knowing: `uvx mypy` runs *without* the project's
175
+ dependencies, so a handful of its findings are import-resolution noise rather
176
+ than real type errors. `uvx --with pydantic mypy src/agentcat` removes the
177
+ largest chunk of it. The table below reports the plain `uvx mypy` number, so
178
+ the commands above reproduce it exactly.
179
+
180
+ Note that a bare `uv run pytest` syncs the environment to the **default**
181
+ groups first, which is the modern generation (`mcp` 2.x + `fastmcp` 4.x). To
182
+ run the legacy generation's suite, sync it explicitly — see
183
+ [Dev Environments](#dev-environments) — and then use `uv run --no-sync`.
184
+
185
+ **Only the tests are gated.** Neither workflow in `.github/workflows/` mentions
186
+ ruff or mypy at all, so a lint or type finding will not fail your PR today.
187
+ That is what makes the rule below a convention rather than a check.
188
+
189
+ ### The lint/type debt, and the ratchet
190
+
191
+ Neither tool has ever been clean on this repo, and turning either into a
192
+ blocking gate would fail every PR on pre-existing findings. Measured on
193
+ `feat/explicit-handles-v2` (`uvx ruff check .`, `uvx mypy src/agentcat`, which
194
+ reads the `strict = true` in `pyproject.toml`):
195
+
196
+ | Check | `main` | this branch |
197
+ | --- | --- | --- |
198
+ | `ruff check .` | 515 | 259 |
199
+ | `ruff format --check .` | 57 files | 46 files |
200
+ | `mypy src/agentcat` | 80 in 23 files | 53 in 15 files |
201
+
202
+ Reproduce them with the three `uvx` commands under [Code Quality](#code-quality),
203
+ `ruff format --check .` included — that row counts files the formatter *would*
204
+ rewrite, which is why it is the `--check` form and not the rewriting one.
205
+
206
+ The standing rule is a **ratchet, not a gate: a change may not add findings.**
207
+ Compare rule-by-rule against `main` rather than eyeballing the totals — a patch
208
+ that fixes ten `E501`s and introduces one `B904` has gone backwards even though
209
+ the count fell. Cleaning up debt you did not create is welcome as its own PR,
210
+ where it can be reviewed as such.
211
+
212
+ Most of what remains is mechanical: `UP006`/`UP045` (pre-PEP-585/604 typing
213
+ spellings), `E501`, `I001` import ordering, and untyped test helpers.
214
+
215
+ Measure both sides the same way. Roughly 3 of the 53 mypy findings are the
216
+ import-resolution noise described above, so a `uvx mypy` number and a
217
+ `uvx --with pydantic mypy` number are not comparable to each other — mixing
218
+ them invents an improvement, or hides a regression, that is purely an artifact
219
+ of the invocation.
220
+
221
+ ## Release dependencies outside this repo
222
+
223
+ Some changes here are only half-shipped until another repo moves. Check these
224
+ before cutting a release:
225
+
226
+ - **`agentcat-go-api/api/openapi.yaml` is missing the `agentcat:custom`
227
+ `event_type` enum entry.** `publish_custom_event` emits that type, and the
228
+ backend has accepted it since TS 2.0, but the generated `agentcat-api` client
229
+ still validates against the older enum. This SDK works around it by
230
+ overriding the validator (`Event.event_type_validate_enum` in
231
+ `src/agentcat/types.py`) — **any other consumer of that spec stays broken
232
+ until the enum entry lands.** Adding it upstream lets the override be
233
+ deleted.
234
+
235
+ ## Dependencies
236
+
237
+ While we don't restrict adding new dependencies, they are generally **discouraged** unless absolutely necessary. If you need to add a dependency:
238
+
239
+ 1. Consider if the functionality can be achieved with existing dependencies
240
+ 2. Check if the dependency is well-maintained and lightweight
241
+ 3. Ensure it's compatible with our MIT license
242
+ 4. Add it using uv: `uv add <package-name>`
243
+
244
+ ## Project Structure
245
+
246
+ ```
247
+ agentcat-python-sdk/
248
+ ├── src/ # Source code
249
+ │ └── agentcat/ # Main package
250
+ │ ├── modules/ # Core modules
251
+ │ ├── thirdparty/ # Vendored dependencies
252
+ │ ├── types.py # Type definitions
253
+ │ └── utils.py # Utility functions
254
+ ├── tests/ # Test files
255
+ ├── docs/ # Documentation
256
+ └── dist/ # Built distributions (generated)
257
+ ```
258
+
259
+ ## Community
260
+
261
+ - **Discord**: Join our [Discord server](https://discord.gg/n9qpyhzp2u) for discussions
262
+ - **Documentation**: Visit [docs.agentcat.com](https://docs.agentcat.com) for detailed guides
263
+ - **Issues**: Browse [open issues](https://github.com/agentcathq/agentcat-python-sdk/issues) for areas needing help
264
+
265
+ ## Versioning
266
+
267
+ The AgentCat team handles versioning and releases. Your contributions will be included in the next appropriate release based on semantic versioning principles.
268
+
269
+ ## Recognition
270
+
271
+ All contributors are recognized in our repository. Your contributions help make AgentCat better for everyone building MCP servers!
272
+
273
+ ## Questions?
274
+
275
+ If you have questions about contributing, feel free to:
276
+
277
+ - Ask in our [Discord server](https://discord.gg/n9qpyhzp2u)
278
+ - Open a [discussion](https://github.com/agentcathq/agentcat-python-sdk/discussions) on GitHub
279
+
280
+ Thank you for contributing to AgentCat! 🐱
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentcat
3
- Version: 1.0.2
4
- Summary: Analytics tool for MCP (Model Context Protocol) servers and AI agents - tracks tool usage patterns and provides insights
3
+ Version: 2.0.0
4
+ Summary: Analytics tool for MCP (Model Context Protocol) servers, Claude Connectors, and ChatGPT Plugins - tracks tool usage patterns and provides insights
5
5
  Project-URL: Homepage, https://github.com/agentcathq/agentcat-python-sdk
6
6
  Project-URL: Bug Tracker, https://github.com/agentcathq/agentcat-python-sdk/issues
7
7
  Project-URL: Repository, https://github.com/agentcathq/agentcat-python-sdk
8
8
  Author-email: "AgentCat, Inc." <support@agentcat.com>
9
9
  License: MIT
10
10
  License-File: LICENSE
11
- Classifier: Development Status :: 4 - Beta
11
+ Classifier: Development Status :: 5 - Production/Stable
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Programming Language :: Python :: 3
@@ -17,11 +17,11 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Requires-Python: >=3.10
19
19
  Requires-Dist: agentcat-api==1.0.0
20
- Requires-Dist: mcp>=1.2.0
21
- Requires-Dist: pydantic<2.12,>=2.0.0
20
+ Requires-Dist: mcp<3,>=1.2.0
21
+ Requires-Dist: pydantic<3,>=2.0.0
22
22
  Requires-Dist: requests>=2.31.0
23
23
  Provides-Extra: community
24
- Requires-Dist: fastmcp!=2.9.*,>=2.7.0; extra == 'community'
24
+ Requires-Dist: fastmcp<5,>=3.0.0; extra == 'community'
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: freezegun>=1.2.0; extra == 'dev'
27
27
  Requires-Dist: mypy>=1.0.0; extra == 'dev'
@@ -55,12 +55,14 @@ Description-Content-Type: text/markdown
55
55
  <a href="https://github.com/agentcathq/agentcat-python-sdk/actions"><img src="https://github.com/agentcathq/agentcat-python-sdk/workflows/MCP%20Version%20Compatibility%20Testing/badge.svg" alt="CI"></a>
56
56
  </p>
57
57
 
58
+ > [!NOTE]
59
+ > AgentCat v2 introduces compatibility with the [MCP Protocol "Stateless" 2026-07-28 Update](https://blog.modelcontextprotocol.io/posts/2026-07-28/) and the coinciding [MCP Python SDK v2](https://github.com/modelcontextprotocol/python-sdk/releases) release that puts it into effect. The stateless transition has a massive impact on analytics, as sessions were a built-in concept tying related tool calls together. AgentCat has now migrated its session tracking under guidance of the MCP core team's recommendations of using [explicit handles (SEP-2567)](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2567).
60
+ >
61
+ > As a result AgentCat now injects a `session_id` on every MCP tool call to associate them under the same task umbrella. Our evals show much higher tool correlation accuracy at the cost of < 1% additional context pollution.
62
+
58
63
  > [!IMPORTANT]
59
64
  > **MCPcat is now AgentCat** 🐱 — same team, same product, new name. This package was previously published as [`mcpcat`](https://pypi.org/project/mcpcat/), which keeps working forever, but new features land here. Upgrading takes a few minutes — see the [migration guide](./MIGRATION.md).
60
65
 
61
- > [!NOTE]
62
- > Looking for the TypeScript SDK? Check it out here [agentcat-typescript](https://github.com/agentcathq/agentcat-typescript-sdk).
63
-
64
66
  AgentCat is an analytics platform for MCP server owners 🐱. It captures user intentions and behavior patterns to help you understand what AI users actually need from your tools — eliminating guesswork and accelerating product development all with one-line of code.
65
67
 
66
68
  This SDK also provides a free and simple way to forward telemetry like logs, traces, and errors to any Open Telemetry collector or popular tools like Datadog and Sentry.
@@ -69,24 +71,35 @@ This SDK also provides a free and simple way to forward telemetry like logs, tra
69
71
  # Basic installation (includes official MCP SDK)
70
72
  pip install agentcat
71
73
 
72
- # With Jlowin's/Prefect's FastMCP support
74
+ # With community FastMCP support
73
75
  pip install "agentcat[community]"
74
76
  ```
75
77
 
76
- To learn more about us, check us out [here](https://agentcat.com)
78
+ To learn more about us, check us out [here](https://agentcat.com). For detailed guides visit our [documentation](https://docs.agentcat.com).
77
79
 
78
80
  ## Why use AgentCat? 🤔
79
81
 
80
- AgentCat helps developers and product owners build, improve, and monitor their MCP servers by capturing user analytics and tracing tool calls.
82
+ AgentCat helps builders of MCP servers, Claude Connectors, and ChatGPT Plugins learn how to improve them by capturing any agents goals and detecting when they get stuck.
81
83
 
82
84
  Use AgentCat for:
83
85
 
84
- - **User session replay** 🎬. Follow alongside your users to understand why they're using your MCP servers, what functionality you're missing, and what clients they're coming from.
86
+ - **Agent session replay** 🎬. Follow alongside your users and their agents to understand why they're using your MCP servers, what functionality you're missing, and what clients they're coming from.
85
87
  - **Trace debugging** 🔍. See where your users are getting stuck, track and find when LLMs get confused by your API, and debug sessions across all deployments of your MCP server.
86
88
  - **Existing platform support** 📊. Get logging and tracing out of the box for your existing observability platforms (OpenTelemetry, Datadog, Sentry) — eliminating the tedious work of implementing telemetry yourself.
87
89
 
88
90
  <img alt="AgentCat architecture — the AgentCat SDK inside your MCP server sends analytics to your observability vendors and session replay to the AgentCat dashboard" src="docs/static/architecture.png" />
89
91
 
92
+ ## How it works
93
+
94
+ AgentCat works as a lightweight middleware inside your MCP server. When you call `track()`, it seamlessly modifies your registered tool schemas in place, following the MCP core team's [explicit handles (SEP-2567)](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2567) guidelines. Concretely, AgentCat adds the following to your server:
95
+
96
+ - **`session_id`** — a parameter injected into each tool's input schema. Agents echo it back on every call, letting AgentCat group related tool calls into one task even over stateless transports. Values are validated: anything AgentCat did not issue is rejected rather than adopted, and the agent is told to re-send the ID it was given.
97
+ - **`agent_id`** _(off by default)_ — enabled with `enable_agent_tracking=True`. Each agent self-generates its own ID, keeping parallel agents working the same task individually attributable.
98
+ - **`context`** — a parameter asking the agent to explain, in one sentence, why it is making this call. This is where intent data comes from.
99
+ - **`get_more_tools`** — an additional tool, prompt-engineered so that agents readily report the features and tools they looked for but couldn't find — surfacing your missing functionality directly from real usage.
100
+
101
+ Injected parameters are stripped from arguments before your tool handler runs, so your code never sees them. For tools that declare an output schema, issued IDs are also mirrored into `structuredContent` (as `_mcp_instructions`), so clients that only read structured results still receive them.
102
+
90
103
  ## Getting Started
91
104
 
92
105
  To get started with AgentCat, first create an account and obtain your project ID by signing up at [agentcat.com](https://agentcat.com). For detailed setup instructions visit our [documentation](https://docs.agentcat.com).
@@ -95,31 +108,57 @@ Once you have your project ID, integrate AgentCat into your MCP server:
95
108
 
96
109
  ```python
97
110
  import agentcat
98
- from mcp.server import FastMCP
111
+ from mcp.server.mcpserver import MCPServer
99
112
 
100
- server = FastMCP(name="echo-mcp", version="1.0.0")
113
+ server = MCPServer("echo-mcp", version="0.1.0")
101
114
 
115
+ @server.tool(description="Echo a message")
116
+ def echo(msg: str) -> str:
117
+ return msg
118
+
119
+ # Track the server with AgentCat
102
120
  agentcat.track(server, "proj_0000000")
103
121
  ```
104
122
 
123
+ Stateless servers built on [MCP 2026-07-28](https://blog.modelcontextprotocol.io/posts/2026-07-28/) create a fresh server instance per worker or per tenant, serving each request with `stateless_http=True`. Call `track()` inside the factory so every instance is tracked:
124
+
125
+ ```python
126
+ import agentcat
127
+ from mcp.server.mcpserver import MCPServer
128
+
129
+ def create_server() -> MCPServer:
130
+ server = MCPServer("echo-mcp", version="0.1.0")
131
+ # register tools...
132
+ agentcat.track(server, "proj_0000000")
133
+ return server
134
+
135
+ server = create_server()
136
+ server.run(transport="streamable-http", stateless_http=True)
137
+ ```
138
+
139
+ Calling `track()` per instance is cheap — the event queue, telemetry exporters, and diagnostics are initialized once and shared across instances.
140
+
105
141
  ### Identifying users
106
142
 
107
- You can identify your user sessions with a simple callback AgentCat exposes, called `identify`.
143
+ We strongly encourage identifying every actor. If you can't resolve a real user, return a stable anonymized ID instead — for example, a hash of the auth token or API key — so that all events from the same end user still roll up to one actor in your dashboard rather than scattering into anonymous one-off sessions.
144
+
145
+ `identify` (like every AgentCat hook) may be sync or async and runs on every tool call, ahead of your handler: a hook that fails outright — or returns anything that is not a `UserIdentity` — costs analytics data for that event, never the call itself. Every hook runs under a 5-second cap, and a slow lookup delays that call's response — so keep it cheap, and add your own caching if it does a database or API lookup.
146
+
147
+ The callback receives the tool call's `request` params (`.name` and `.arguments`, a plain dict) and the request context the SDK hands to handlers — the same `(request, extra)` shape on every supported server flavor. On HTTP transports, identity signals like headers and auth live on `extra.request`:
108
148
 
109
149
  ```python
110
150
  from agentcat import AgentCatOptions, UserIdentity
111
151
 
112
- def identify_user(request, extra):
113
- user = myapi.get_user(request.params.arguments.token)
114
- return UserIdentity(
115
- user_id=user.id,
116
- user_name=user.name,
117
- user_data={
118
- "favorite_color": user.favorite_color,
119
- },
120
- )
152
+ async def identify(request, extra):
153
+ http = getattr(extra, "request", None) # incoming HTTP request, when present
154
+ token = http.headers.get("authorization") if http else None
155
+ org_id = http.headers.get("x-org-id") if http else None
156
+ user = await myapi.get_user(token)
157
+ if not user:
158
+ return None
159
+ return UserIdentity(user_id=user.id, user_name=user.name, user_data={"org_id": org_id})
121
160
 
122
- agentcat.track(server, "proj_0000000", AgentCatOptions(identify=identify_user))
161
+ agentcat.track(server, "proj_0000000", AgentCatOptions(identify=identify))
123
162
  ```
124
163
 
125
164
  ### Redacting sensitive data
@@ -129,14 +168,14 @@ AgentCat redacts all data sent to its servers and encrypts at rest, but for addi
129
168
  ```python
130
169
  from agentcat import AgentCatOptions
131
170
 
132
- # Sync version
133
- def redact_sync(text):
134
- return custom_redact(text)
171
+ async def redact(text: str) -> str:
172
+ return await redactor(text)
173
+ # or a plain sync function — both are supported
135
174
 
136
- agentcat.track(server, "proj_0000000", AgentCatOptions(redact_sensitive_information=redact_sync))
175
+ agentcat.track(server, "proj_0000000", AgentCatOptions(redact_sensitive_information=redact))
137
176
  ```
138
177
 
139
- ### Forwarding data to existing observability platforms
178
+ ### Vendor Support
140
179
 
141
180
  AgentCat seamlessly integrates with your existing observability stack, providing automatic logging and tracing without the tedious setup typically required. Export telemetry data to multiple platforms simultaneously:
142
181
 
@@ -147,29 +186,26 @@ from agentcat import AgentCatOptions
147
186
 
148
187
  agentcat.track(
149
188
  server,
150
- "proj_0000000", # Or None if you just want to use the SDK to forward telemetry
189
+ "proj_0000", # Project ID can optionally be None if you just want to forward telemetry
151
190
  AgentCatOptions(
152
191
  exporters={
153
- # OpenTelemetry - works with Jaeger, Tempo, New Relic, etc.
154
192
  "otlp": {
155
193
  "type": "otlp",
156
194
  "endpoint": "http://localhost:4318/v1/traces",
157
195
  },
158
- # Datadog
159
196
  "datadog": {
160
197
  "type": "datadog",
161
- "api_key": os.getenv("DD_API_KEY"),
198
+ "api_key": os.environ["DD_API_KEY"],
162
199
  "site": "datadoghq.com",
163
200
  "service": "my-mcp-server",
164
201
  },
165
- # Sentry
166
202
  "sentry": {
167
203
  "type": "sentry",
168
- "dsn": os.getenv("SENTRY_DSN"),
204
+ "dsn": os.environ["SENTRY_DSN"],
169
205
  "environment": "production",
170
206
  },
171
207
  }
172
- )
208
+ ),
173
209
  )
174
210
  ```
175
211
 
@@ -192,7 +228,7 @@ Diagnostics are on by default and can be turned off completely with either:
192
228
 
193
229
  AgentCat is free for qualified open source projects. We believe in supporting the ecosystem that makes MCP possible. If you maintain an open source MCP server, you can access our full analytics platform at no cost.
194
230
 
195
- **How to apply**: Email hi@agentcat.com with your repository link
231
+ **How to apply**: Email [hi@agentcat.com](mailto:hi@agentcat.com) with your repository link
196
232
 
197
233
  _Already using AgentCat? We'll upgrade your account immediately._
198
234
 
@@ -203,6 +239,7 @@ Meet the cats behind AgentCat! Add your cat to our community by submitting a PR
203
239
  <div align="left">
204
240
  <img src="docs/cats/bibi.png" alt="bibi" width="80" height="80">
205
241
  <img src="docs/cats/zelda.jpg" alt="zelda" width="80" height="80">
242
+ <img src="docs/cats/void.jpg" alt="void" width="80" height="80">
206
243
  </div>
207
244
 
208
- _Want to add your cat? Create a PR adding your cat's photo to `docs/cats/` and update this section!_
245
+ _Want to add your cat? Create a PR adding your cat's photo to_ `docs/cats/` _and update this section!_