agentx-python 0.1__tar.gz → 0.1.1__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 (93) hide show
  1. agentx_python-0.1.1/LICENSE +190 -0
  2. agentx_python-0.1.1/PKG-INFO +422 -0
  3. agentx_python-0.1.1/README.md +358 -0
  4. agentx_python-0.1.1/agentx/__init__.py +31 -0
  5. agentx_python-0.1.1/agentx/agentx.py +195 -0
  6. agentx_python-0.1.1/agentx/cli.py +158 -0
  7. agentx_python-0.1.1/agentx/evaluations/__init__.py +7 -0
  8. agentx_python-0.1.1/agentx/evaluations/_term.py +102 -0
  9. agentx_python-0.1.1/agentx/evaluations/adapters/__init__.py +5 -0
  10. agentx_python-0.1.1/agentx/evaluations/adapters/http_endpoint.py +69 -0
  11. agentx_python-0.1.1/agentx/evaluations/adapters/precomputed.py +35 -0
  12. agentx_python-0.1.1/agentx/evaluations/adapters/raw.py +38 -0
  13. agentx_python-0.1.1/agentx/evaluations/client.py +636 -0
  14. agentx_python-0.1.1/agentx/evaluations/datasets.py +347 -0
  15. agentx_python-0.1.1/agentx/evaluations/evaluation_settings.py +146 -0
  16. agentx_python-0.1.1/agentx/evaluations/models.py +744 -0
  17. agentx_python-0.1.1/agentx/evaluations/prompts.py +74 -0
  18. agentx_python-0.1.1/agentx/evaluations/reporting.py +186 -0
  19. agentx_python-0.1.1/agentx/evaluations/results.py +137 -0
  20. agentx_python-0.1.1/agentx/evaluations/runner.py +639 -0
  21. agentx_python-0.1.1/agentx/evaluations/tool_schemas.py +48 -0
  22. agentx_python-0.1.1/agentx/evaluations/tracing.py +54 -0
  23. agentx_python-0.1.1/agentx/exceptions.py +50 -0
  24. agentx_python-0.1.1/agentx/export.py +99 -0
  25. agentx_python-0.1.1/agentx/feedback.py +94 -0
  26. agentx_python-0.1.1/agentx/integrations/__init__.py +10 -0
  27. agentx_python-0.1.1/agentx/integrations/_traced_call.py +168 -0
  28. agentx_python-0.1.1/agentx/integrations/anthropic.py +285 -0
  29. agentx_python-0.1.1/agentx/integrations/autogen.py +200 -0
  30. agentx_python-0.1.1/agentx/integrations/crewai.py +251 -0
  31. agentx_python-0.1.1/agentx/integrations/databricks.py +405 -0
  32. agentx_python-0.1.1/agentx/integrations/google_adk.py +315 -0
  33. agentx_python-0.1.1/agentx/integrations/google_genai.py +329 -0
  34. agentx_python-0.1.1/agentx/integrations/langchain.py +940 -0
  35. agentx_python-0.1.1/agentx/integrations/litellm.py +154 -0
  36. agentx_python-0.1.1/agentx/integrations/llamaindex.py +303 -0
  37. agentx_python-0.1.1/agentx/integrations/moveworks.py +587 -0
  38. agentx_python-0.1.1/agentx/integrations/openai.py +169 -0
  39. agentx_python-0.1.1/agentx/integrations/openai_agents.py +309 -0
  40. agentx_python-0.1.1/agentx/monitor/__init__.py +17 -0
  41. agentx_python-0.1.1/agentx/monitor/agents.py +28 -0
  42. agentx_python-0.1.1/agentx/monitor/client.py +365 -0
  43. agentx_python-0.1.1/agentx/monitor/judge_scorers.py +334 -0
  44. agentx_python-0.1.1/agentx/monitor/models.py +184 -0
  45. agentx_python-0.1.1/agentx/monitor/online_evaluators.py +173 -0
  46. agentx_python-0.1.1/agentx/monitor/patterns.py +121 -0
  47. agentx_python-0.1.1/agentx/monitor/profile.py +72 -0
  48. agentx_python-0.1.1/agentx/monitor/scorers.py +172 -0
  49. agentx_python-0.1.1/agentx/monitor/sessions.py +21 -0
  50. agentx_python-0.1.1/agentx/monitor/signals.py +41 -0
  51. agentx_python-0.1.1/agentx/outcomes.py +86 -0
  52. agentx_python-0.1.1/agentx/projects.py +61 -0
  53. agentx_python-0.1.1/agentx/py.typed +0 -0
  54. agentx_python-0.1.1/agentx/resources/__init__.py +0 -0
  55. agentx_python-0.1.1/agentx/resources/agent.py +56 -0
  56. agentx_python-0.1.1/agentx/resources/conversation.py +128 -0
  57. agentx_python-0.1.1/agentx/resources/workforce.py +121 -0
  58. agentx_python-0.1.1/agentx/testing.py +90 -0
  59. agentx_python-0.1.1/agentx/traces.py +64 -0
  60. agentx_python-0.1.1/agentx/tracing/__init__.py +21 -0
  61. agentx_python-0.1.1/agentx/tracing/ci_types.py +66 -0
  62. agentx_python-0.1.1/agentx/tracing/ingest_client.py +440 -0
  63. agentx_python-0.1.1/agentx/tracing/tracer.py +1165 -0
  64. agentx_python-0.1.1/agentx/util.py +20 -0
  65. agentx_python-0.1.1/agentx/version.py +1 -0
  66. agentx_python-0.1.1/agentx_python.egg-info/PKG-INFO +422 -0
  67. agentx_python-0.1.1/agentx_python.egg-info/SOURCES.txt +80 -0
  68. agentx_python-0.1.1/agentx_python.egg-info/entry_points.txt +4 -0
  69. agentx_python-0.1.1/agentx_python.egg-info/not-zip-safe +1 -0
  70. agentx_python-0.1.1/agentx_python.egg-info/requires.txt +51 -0
  71. agentx_python-0.1.1/agentx_python.egg-info/top_level.txt +1 -0
  72. agentx_python-0.1.1/setup.py +87 -0
  73. agentx_python-0.1.1/tests/test_deep_dive_fixes.py +85 -0
  74. agentx_python-0.1.1/tests/test_docs_match_sdk.py +176 -0
  75. agentx_python-0.1.1/tests/test_integration.py +181 -0
  76. agentx_python-0.1.1/tests/test_integrations.py +1049 -0
  77. agentx_python-0.1.1/tests/test_judge_scorers.py +270 -0
  78. agentx_python-0.1.1/tests/test_selfhost_analysis_fallback.py +251 -0
  79. agentx_python-0.1.1/tests/test_span_tree.py +635 -0
  80. agentx_python-0.1.1/tests/test_testing.py +49 -0
  81. agentx-python-0.1/LICENSE +0 -21
  82. agentx-python-0.1/PKG-INFO +0 -30
  83. agentx-python-0.1/README.md +0 -16
  84. agentx-python-0.1/agentx_python/__init__.py +0 -19
  85. agentx-python-0.1/agentx_python/agent.py +0 -55
  86. agentx-python-0.1/agentx_python/version.py +0 -1
  87. agentx-python-0.1/agentx_python.egg-info/PKG-INFO +0 -30
  88. agentx-python-0.1/agentx_python.egg-info/SOURCES.txt +0 -11
  89. agentx-python-0.1/agentx_python.egg-info/requires.txt +0 -2
  90. agentx-python-0.1/agentx_python.egg-info/top_level.txt +0 -1
  91. agentx-python-0.1/setup.py +0 -23
  92. {agentx-python-0.1 → agentx_python-0.1.1}/agentx_python.egg-info/dependency_links.txt +0 -0
  93. {agentx-python-0.1 → agentx_python-0.1.1}/setup.cfg +0 -0
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2023-2026 AgentX, Inc.
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,422 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentx-python
3
+ Version: 0.1.1
4
+ Summary: Official Python SDK for AgentX (https://www.agentx.so/)
5
+ Home-page: https://github.com/AgentX-ai/AgentX-python
6
+ Author: Robin Wang and AgentX Team
7
+ Author-email: contact@agentx.so
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.6
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: urllib3>=1.26.11
15
+ Requires-Dist: certifi
16
+ Requires-Dist: requests
17
+ Requires-Dist: pydantic>=2.0.0
18
+ Provides-Extra: langchain
19
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
20
+ Provides-Extra: crewai
21
+ Requires-Dist: crewai>=0.80.0; extra == "crewai"
22
+ Provides-Extra: openai-agents
23
+ Requires-Dist: openai-agents>=0.0.3; extra == "openai-agents"
24
+ Provides-Extra: openai
25
+ Requires-Dist: openai>=1.0.0; extra == "openai"
26
+ Provides-Extra: anthropic
27
+ Requires-Dist: anthropic>=0.25.0; extra == "anthropic"
28
+ Provides-Extra: google-adk
29
+ Requires-Dist: google-adk>=1.0.0; extra == "google-adk"
30
+ Provides-Extra: google-genai
31
+ Requires-Dist: google-genai>=1.0.0; extra == "google-genai"
32
+ Provides-Extra: litellm
33
+ Requires-Dist: litellm>=1.0.0; extra == "litellm"
34
+ Provides-Extra: llamaindex
35
+ Requires-Dist: llama-index-core>=0.10.0; extra == "llamaindex"
36
+ Provides-Extra: autogen
37
+ Requires-Dist: autogen-agentchat>=0.4.0; extra == "autogen"
38
+ Requires-Dist: autogen-core>=0.4.0; extra == "autogen"
39
+ Provides-Extra: databricks
40
+ Requires-Dist: mlflow>=3.6.0; extra == "databricks"
41
+ Provides-Extra: all
42
+ Requires-Dist: langchain-core>=0.1.0; extra == "all"
43
+ Requires-Dist: crewai>=0.80.0; extra == "all"
44
+ Requires-Dist: openai-agents>=0.0.3; extra == "all"
45
+ Requires-Dist: openai>=1.0.0; extra == "all"
46
+ Requires-Dist: anthropic>=0.25.0; extra == "all"
47
+ Requires-Dist: google-adk>=1.0.0; extra == "all"
48
+ Requires-Dist: google-genai>=1.0.0; extra == "all"
49
+ Requires-Dist: litellm>=1.0.0; extra == "all"
50
+ Requires-Dist: llama-index-core>=0.10.0; extra == "all"
51
+ Requires-Dist: autogen-agentchat>=0.4.0; extra == "all"
52
+ Requires-Dist: autogen-core>=0.4.0; extra == "all"
53
+ Dynamic: author
54
+ Dynamic: author-email
55
+ Dynamic: classifier
56
+ Dynamic: description
57
+ Dynamic: description-content-type
58
+ Dynamic: home-page
59
+ Dynamic: license-file
60
+ Dynamic: provides-extra
61
+ Dynamic: requires-dist
62
+ Dynamic: requires-python
63
+ Dynamic: summary
64
+
65
+ ![Logo](https://agentx-resources.s3.us-west-1.amazonaws.com/AgentX-logo-387x60.png)
66
+
67
+ [![PyPI version](https://img.shields.io/pypi/v/agentx-python)](https://pypi.org/project/agentx-python/)
68
+ [![Python versions](https://img.shields.io/pypi/pyversions/agentx-python)](https://pypi.org/project/agentx-python/)
69
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
70
+
71
+ The official Python SDK for **[AgentX](https://app.agentx.so/)** - an evaluation, tracing, and monitoring framework for AI agents, plus a client for AgentX's own hosted agents.
72
+
73
+ Also see [SDK Developer Docs](https://developers.agentx.so), [API Reference Docs](https://docs.agentx.so/reference)
74
+
75
+ ---
76
+
77
+ ## Contents
78
+
79
+ - [Why AgentX](#why-agentx)
80
+ - [Installation](#installation)
81
+ - [Authentication](#authentication)
82
+ - [Quick start](#quick-start)
83
+ - [Custom agent evaluations](#custom-agent-evaluations) - LLM-as-a-judge, cosine / Jaccard similarity, any framework
84
+ - [Production tracing](#production-tracing) - record live agent runs from any framework
85
+ - [Monitor](#monitor) - automatic production monitoring, patterns and signals
86
+ - [Self-host](#self-host) - run Trace/Evaluate/Monitor on your own machine instead of the hosted dashboard
87
+ - [Agents & conversations](#agents--conversations) - chat with and orchestrate AgentX's own hosted agents
88
+ - [Links](#links)
89
+
90
+ ---
91
+
92
+ ## Why AgentX
93
+
94
+ - **Agent Evaluations** - score **any** agent (LangChain, CrewAI, AutoGen, LlamaIndex, OpenAI, Anthropic, HTTP, or plain Python) against a dataset with LLM-as-a-judge ratings plus optional cosine, Jaccard, and BLEU/ROUGE similarity metrics. Configurable judge prompt/model, per-question judge guidelines, smoke testing for phrasing robustness, and a durable multi-judge analysis pass for a qualitative report.
95
+ - **Production tracing** - one decorator or context manager records every agent run (input, output, latency, tool calls, token usage, and a real span tree) into your workspace, for any framework.
96
+ - **Monitor** - check live traces against detection patterns or a sampled LLM judge, and read back triage-ready signals, no dashboard setup required.
97
+ - **Prompt registry** - make AgentX the source of truth for your own agent's prompts: pull a version at runtime, tag eval runs and live traces with it, let a judge propose a rewrite from your worst-rated results.
98
+ - **Self-host** - run the whole Trace/Evaluate/Monitor stack locally, bring your own LLM keys, no account required.
99
+ - **Bring any LLM** - works across major open and closed-source vendors, for evaluation, tracing, and AgentX's own hosted agents alike.
100
+ - **AgentX's own hosted agents** - a simple `Agent → Conversation → Message` mental model, chain-of-thought built in, multi-agent workforces, MCP support, and A2A publishing, for when you want AgentX to run the agent too, not just evaluate/trace/monitor it.
101
+
102
+ ---
103
+
104
+ ## Installation
105
+
106
+ ```bash
107
+ pip install --upgrade agentx-python
108
+ ```
109
+
110
+ Requires Python 3.9 or newer.
111
+
112
+ ---
113
+
114
+ ## Authentication
115
+
116
+ Get your API key at [app.agentx.so](https://app.agentx.so), then either pass it inline or expose it as an environment variable.
117
+
118
+ ```python
119
+ # Option A - pass the key inline
120
+ from agentx import AgentX
121
+ client = AgentX(api_key="your-api-key-here")
122
+
123
+ # Option B - set AGENTX_API_KEY in your environment, then:
124
+ client = AgentX.from_env()
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Quick start
130
+
131
+ Evaluate your own agent - any framework, or plain Python - against a dataset:
132
+
133
+ ```python
134
+ from agentx import AgentX
135
+
136
+ client = AgentX.from_env()
137
+
138
+ def my_agent(case):
139
+ return call_my_agent(case.query) # your agent's own code, any framework
140
+
141
+ report = (
142
+ client.evaluations
143
+ .run(dataset_id="evds_…", subject={"kind": "custom_agent", "framework": "raw_python"})
144
+ .execute(my_agent)
145
+ .finalize()
146
+ .analyze()
147
+ )
148
+
149
+ print(report.average_rating) # LLM-graded score, 0–10
150
+ print(report.summary) # AI-generated narrative from .analyze()
151
+ ```
152
+
153
+ That's it. The rest of this section covers building the dataset, framework adapters, similarity metrics, and judge configuration.
154
+
155
+ ---
156
+
157
+ ## Custom agent evaluations
158
+
159
+ Evaluate **any** AI agent - LangChain, CrewAI, AutoGen, LlamaIndex, OpenAI, Anthropic, HTTP endpoints, or plain Python - using AgentX as the scoring and reporting backend. Includes optional **cosine**, **Jaccard**, and **BLEU/ROUGE** similarity metrics alongside LLM-graded ratings.
160
+
161
+ ```python
162
+ report = (
163
+ client.evaluations
164
+ .run(dataset_id="evds_…", subject={"kind": "custom_agent", "framework": "raw_python"})
165
+ .execute(my_agent_fn)
166
+ .finalize()
167
+ .analyze()
168
+ )
169
+
170
+ print(report.average_rating) # LLM-graded score, 0–10
171
+ print(report.cosine_similarity) # embedding cosine, 0–1 (None if not enabled)
172
+ print(report.jaccard_similarity) # token-set overlap, 0–1 (None if not enabled)
173
+
174
+ print(report.summary) # AI-generated narrative from .analyze()
175
+ print(report.recommendations) # list of prioritized, actionable fixes
176
+ ```
177
+
178
+ `.analyze()` also generates a full qualitative report (strengths, weaknesses, instruction adherence, reasoning quality, and recommendations), running the same durable, multi-judge pipeline as the dashboard's "Analyze" button. `analyze(mode=..., quality_mode=..., judges=[...])` controls how items are scored and by which models. See [AI analysis report](EVALUATIONS.md#ai-analysis-report) in the full guide for the complete field and parameter reference.
179
+
180
+ Ask a case's question several extra ways each run, LLM-paraphrased server-side, to catch agents that break on phrasing rather than substance, and override the judge's prompt/model per config, see [Smoke testing](EVALUATIONS.md#smoke-testing-phrasing-robustness) and [Configuring the judge](EVALUATIONS.md#configuring-the-judge) in the full guide.
181
+
182
+ Since AgentX doesn't own your agent's code, `client.evaluations.prompts` lets AgentX become your prompt's *source of truth* instead - the same problem LangSmith's Prompt Hub and Langfuse's Prompt Management solve. Pull a version at runtime, tag your eval runs (or live traces) with it, and let a judge propose a rewrite from your real worst-rated results - a human always has to approve before it publishes:
183
+
184
+ ```python
185
+ prompt = client.evaluations.prompts.get("support-agent-system-prompt") # or prompt.id
186
+ # use prompt.text as your own agent's system prompt
187
+
188
+ client.evaluations.run(
189
+ dataset_id="evds_…",
190
+ subject={"kind": "custom_agent", "metadata": {"promptName": prompt.name}},
191
+ ).execute(my_agent_fn)
192
+ ```
193
+
194
+ See [Prompt registry](EVALUATIONS.md#prompt-registry) in the full guide, or [self-host's docs](https://docs.agentx.so/improve/prompt-management) for the "Suggest improvement" dashboard flow (self-host only - no hosted-SaaS equivalent yet).
195
+
196
+ On self-host, a finalized run can also **gate a CI job**: `report.gate(fail_under=7, no_regression=True)` checks the run's average rating against an absolute floor and/or the dataset's previous run, prints per-check verdicts into the CI log, and returns an exit code - `sys.exit(gate.exit_code)` blocks the merge on regression. Recorded gates appear in the dashboard's CI Gates tab. See [self-host's CI docs](https://docs.agentx.so/integrations/self-host-ci) for the GitHub Actions recipe.
197
+
198
+ See **[EVALUATIONS.md](EVALUATIONS.md)** for the full guide - dataset builder, framework adapters, similarity metrics, smoke testing, judge configuration, prompt registry, and the complete API reference.
199
+
200
+ ---
201
+
202
+ ## Production tracing
203
+
204
+ Record live agent runs into your workspace with a single decorator or context manager - no changes to your agent's logic. Traces appear in the **Live Traces** tab and can be evaluated against your test datasets with [`tracer.evaluate_trace()`](TRACING.md#tracerevaluate_trace).
205
+
206
+ ```python
207
+ from agentx import AgentX
208
+
209
+ client = AgentX.from_env()
210
+ tracer = client.tracer
211
+
212
+ @tracer.trace("customer-support-agent", framework="langchain", model="gpt-4o")
213
+ def handle_query(query: str) -> str:
214
+ return chain.invoke(query)
215
+
216
+ # Every call is automatically traced: input, output, latency, tool calls, token usage
217
+ handle_query("How do I reset my password?")
218
+ tracer.flush(timeout=10) # ensure delivery before the process exits
219
+ ```
220
+
221
+ Prefer full control over what gets captured? Use the context manager instead:
222
+
223
+ ```python
224
+ with tracer.trace("rag-agent", framework="langchain") as span:
225
+ span.input = {"query": query, "user_id": user_id}
226
+
227
+ kb_result = search_knowledge_base(query)
228
+ span.add_tool_call("search_knowledge_base", input=query, output=kb_result, latency_ms=190)
229
+
230
+ span.output = llm.invoke(f"Context: {kb_result}\n\nQuery: {query}")
231
+ ```
232
+
233
+ To time a tool call and capture its failures automatically, wrap the execution itself instead of reporting it after the fact:
234
+
235
+ ```python
236
+ with tracer.trace_tool_call("search_knowledge_base", input=query) as t:
237
+ t.output = search_knowledge_base(query)
238
+ ```
239
+
240
+ An exception escaping the block records the call as failed (`success=False` plus the error text, which is what Monitor's built-in "Tool failure" check and the dashboard's Tool quality column read) and then propagates unchanged.
241
+
242
+ ### Framework integrations
243
+
244
+ Each integration auto-captures LLM calls, tool calls, and token usage - including prompt-caching
245
+ token counts (Anthropic's cache write/read, OpenAI/LiteLLM's cached tokens, Google GenAI's cached
246
+ content), reported as their own `cache_read_tokens`/`cache_write_tokens` fields alongside the
247
+ regular totals, no extra config needed. Self-host's cost estimate prices these separately from a
248
+ regular input token when you've set optional cache rates on that model. Install the matching
249
+ extra:
250
+
251
+ | Framework | Install | Integration |
252
+ | --------------------- | -------------------------------------------- | ------------------------ |
253
+ | LangChain | `pip install "agentx-python[langchain]"` | `AgentXCallbackHandler` |
254
+ | CrewAI | `pip install "agentx-python[crewai]"` | `AgentXCrewObserver` |
255
+ | OpenAI Agents SDK | `pip install "agentx-python[openai-agents]"` | `AgentXTracingProcessor` |
256
+ | OpenAI (raw client) | `pip install "agentx-python[openai]"` | `patch_openai_client` |
257
+ | Anthropic | `pip install "agentx-python[anthropic]"` | `patch_anthropic_client` |
258
+ | Google ADK | `pip install "agentx-python[google-adk]"` | `AgentXADKPlugin` |
259
+ | Google GenAI (Gemini) | `pip install "agentx-python[google-genai]"` | `patch_genai_client` |
260
+ | LiteLLM | `pip install "agentx-python[litellm]"` | `AgentXLiteLLMLogger` |
261
+ | LlamaIndex | `pip install "agentx-python[llamaindex]"` | `AgentXLlamaIndexHandler`|
262
+ | AutoGen | `pip install "agentx-python[autogen]"` | `AgentXAutoGenObserver` |
263
+
264
+ Or plain Python - wrap any function with `@tracer.trace(...)` and it just works, no framework required.
265
+
266
+ Running specialist agents in parallel with a `ThreadPoolExecutor`? Wrap each worker body in `tracer.use_span(span)` so their steps land on the parent trace instead of becoming independent traces - see [TRACING.md](TRACING.md) for the full pattern.
267
+
268
+ See **[TRACING.md](TRACING.md)** for the complete guide - session grouping, error handling, async support, and the full API reference.
269
+
270
+ ---
271
+
272
+ ## Monitor
273
+
274
+ Automatic production monitoring: check traces against detection patterns and get back triage-ready signals. A **pattern** is a first-class SDK resource with a real id, just like a `Dataset` or `EvaluationSettings`: create one once, then reference it by id at trace time.
275
+
276
+ ```python
277
+ pattern = client.monitor.patterns.builder(
278
+ name="Promises a refund",
279
+ detector_kind="semantic",
280
+ semantic_prompt="The response promises a refund.",
281
+ severity="high",
282
+ ).publish()
283
+
284
+ with client.tracer.trace("support-agent", monitor=True, pattern_ids=[pattern.id]) as span:
285
+ span.output = call_llm(query)
286
+ ```
287
+
288
+ `monitor=True` checks the trace immediately, no dashboard setup required. `pattern_ids` restricts detection to exactly those patterns; omit it to run the full default sweep instead (built-in checks like empty response, trace error, and latency regression, plus every pattern enabled for the workspace).
289
+
290
+ This works independently of the dashboard's per-agent monitoring toggle (Governance > Observe > Agents), which still auto-checks every trace from an agent once enabled there, with no code changes needed either way.
291
+
292
+ Read the resulting alerts back with `client.monitor.signals.list()`/`.get()`, no dashboard required:
293
+
294
+ ```python
295
+ for signal in client.monitor.signals.list(severity="high"):
296
+ print(signal.summary, signal.occurrence_count)
297
+ ```
298
+
299
+ Per-agent coverage/threshold settings (sample rate, retention, and threshold overrides like the built-in "Latency regression" pattern's threshold) are `client.monitor.profile.get()`/`.update()`:
300
+
301
+ ```python
302
+ client.monitor.profile.update("agent_123", threshold_overrides={"latencyMs": 15000})
303
+ ```
304
+
305
+ Self-host also has **online evaluators**: a real LLM judge scoring a sample of live traffic continuously, distinct from a pattern's rule-matching. A score below `alert_threshold` raises a signal the same way a failing pattern does, deduped and triage-ready in `client.monitor.signals`.
306
+
307
+ ```python
308
+ evaluator = client.monitor.online_evaluators.builder(
309
+ name="Helpfulness",
310
+ evaluation_settings_id=settings.id,
311
+ sample_rate=0.1,
312
+ alert_threshold=5,
313
+ ).publish()
314
+
315
+ client.monitor.online_evaluators.ratings(evaluator.id, window="7d")
316
+ ```
317
+
318
+ An online evaluator and a dataset run's grading config are two profiles of one **LLM Judge Scorer**, and `client.monitor.judge_scorers` manages both in a single call - one rubric, one id, used offline and online:
319
+
320
+ ```python
321
+ scorer = client.monitor.judge_scorers.builder(
322
+ name="Helpfulness",
323
+ acceptance_criteria="Concrete, correct, cites the policy.",
324
+ live=True, sample_rate=0.1, alert_threshold=5, # the online profile
325
+ ).publish()
326
+
327
+ client.evaluations.run(dataset_id=dataset.id, subject={...}, scorer_id=scorer.id)
328
+ client.monitor.judge_scorers.ratings(scorer.id, window="7d")
329
+ ```
330
+
331
+ The two clients above are that entity's per-profile legacy views; they keep working and share the same ids. See [LLM Judge Scorers](EVALUATIONS.md#llm-judge-scorers---reusable-grading-configs) for the full surface, including which self-host engine builds serve it.
332
+
333
+ An online evaluator can also judge **whole conversations** instead of single traces: pass `scope="session"` and the engine scores each multi-turn session once it's been idle for `idle_seconds`, re-scoring if the conversation resumes. And to close the loop with reality, two ground-truth streams feed the dashboard's Judge Calibration view (which measures how often AgentX's automated verdicts agree with what actually happened): `client.outcomes.report(...)` for after-the-fact system results (a reopened ticket, a human confirmation), and `client.feedback.report(...)` for end-user votes forwarded from your own app's UI - a "down" raises a "Negative user feedback" signal directly, no sampling or judge call involved. All self-host features.
334
+
335
+ ```python
336
+ client.monitor.online_evaluators.builder(
337
+ name="Conversation resolution",
338
+ evaluation_settings_id=settings.id,
339
+ scope="session", # judge the whole session, not each trace
340
+ idle_seconds=120, # score once the conversation has been quiet this long
341
+ alert_threshold=5,
342
+ ).publish()
343
+
344
+ client.outcomes.report(
345
+ trace_id=trace_id,
346
+ outcome="reopened",
347
+ is_negative=True,
348
+ reason="Customer reopened the ticket within 3 days",
349
+ )
350
+
351
+ client.feedback.report(
352
+ trace_id=trace_id,
353
+ rating="down", # "up" or "down"
354
+ comment="It never answered my question", # optional, the user's own words
355
+ end_user_id=current_user.id, # optional, opaque to AgentX
356
+ )
357
+ ```
358
+
359
+ See **[TRACING.md](TRACING.md)** for the complete Monitor guide.
360
+
361
+ ---
362
+
363
+ ## Self-host
364
+
365
+ Prefer to run Trace/Evaluate/Monitor locally instead of the hosted dashboard - no account, bring your own LLM keys? This SDK ships a launcher for [AgentX-trace-eval](https://github.com/AgentX-ai/AgentX-trace-eval), a separate, portable governance engine:
366
+
367
+ ```bash
368
+ agentx-trace-eval --dev
369
+ ```
370
+
371
+ The first run downloads the engine (and dashboard) into `~/.agentx/bin` and prints a local API key; every run after that just starts it. Point this SDK at it instead of the hosted API:
372
+
373
+ ```bash
374
+ export AGENTX_API_BASE_URL=http://localhost:4700/api/v1
375
+ export AGENTX_API_KEY=<printed by agentx-trace-eval on first run>
376
+ ```
377
+
378
+ `agentx-trace-eval` isn't this SDK's own code - the engine itself is a separate, compiled binary, downloaded on demand rather than bundled into this package, so installing `agentx-python` doesn't get any heavier for the (much more common) case of just talking to the hosted AgentX API. See that repo's README for what's included, and `AGENTX_INSTALL_DIR`/`AGENTX_TRACE_EVAL_VERSION`/`AGENTX_TRACE_EVAL_SKIP_WEB` env vars to control where/what it installs.
379
+
380
+ ---
381
+
382
+ ## Agents & conversations
383
+
384
+ Beyond evaluation, tracing, and monitoring, this SDK is also a client for AgentX's own hosted agents - build, chat with, and orchestrate them directly.
385
+
386
+ ```python
387
+ agent = client.list_agents()[0]
388
+ conversation = agent.new_conversation()
389
+
390
+ # Blocking - returns the full response once it's ready
391
+ print(conversation.chat("What can you help me with?"))
392
+
393
+ # Streaming - yields ChatResponse objects as the model produces them
394
+ for chunk in conversation.chat_stream("Hello!"):
395
+ if chunk.text:
396
+ print(chunk.text, end="")
397
+ ```
398
+
399
+ Each `ChatResponse` chunk exposes the agent's `text` and, where applicable, its `cot` (chain-of-thought) reasoning, along with any retrieved references and tasks. `agent.list_conversations()` / `conversation.list_messages()` resume history instead of starting fresh.
400
+
401
+ A **workforce** is a team of agents coordinated by a designated manager, mixing LLM vendors and routing work between specialists:
402
+
403
+ ```python
404
+ workforce = client.list_workforces()[0]
405
+ conversation = workforce.new_conversation()
406
+
407
+ for chunk in workforce.chat_stream(conversation.id, "How can you help me with this project?"):
408
+ if chunk.text:
409
+ print(chunk.text, end="")
410
+ ```
411
+
412
+ ---
413
+
414
+ ## Links
415
+
416
+ - **Dashboard** - [app.agentx.so](https://app.agentx.so)
417
+ - **Website** - [agentx.so](https://www.agentx.so/)
418
+ - **PyPI** - [agentx-python](https://pypi.org/project/agentx-python/)
419
+ - **Tracing docs** - [TRACING.md](TRACING.md)
420
+ - **Evaluations docs** - [EVALUATIONS.md](EVALUATIONS.md)
421
+ - **Monitor docs** - [docs.agentx.so/sdk/monitor](https://docs.agentx.so/sdk/monitor)
422
+ - **Self-host** - [AgentX-trace-eval](https://github.com/AgentX-ai/AgentX-trace-eval)