agentrun-inner-test 0.0.12__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 (133) hide show
  1. agentrun_inner_test-0.0.12/LICENSE +201 -0
  2. agentrun_inner_test-0.0.12/PKG-INFO +262 -0
  3. agentrun_inner_test-0.0.12/README.md +225 -0
  4. agentrun_inner_test-0.0.12/agentrun/__init__.py +209 -0
  5. agentrun_inner_test-0.0.12/agentrun/agent_runtime/__client_async_template.py +466 -0
  6. agentrun_inner_test-0.0.12/agentrun/agent_runtime/__endpoint_async_template.py +345 -0
  7. agentrun_inner_test-0.0.12/agentrun/agent_runtime/__init__.py +53 -0
  8. agentrun_inner_test-0.0.12/agentrun/agent_runtime/__runtime_async_template.py +477 -0
  9. agentrun_inner_test-0.0.12/agentrun/agent_runtime/api/__data_async_template.py +58 -0
  10. agentrun_inner_test-0.0.12/agentrun/agent_runtime/api/__init__.py +6 -0
  11. agentrun_inner_test-0.0.12/agentrun/agent_runtime/api/control.py +1362 -0
  12. agentrun_inner_test-0.0.12/agentrun/agent_runtime/api/data.py +98 -0
  13. agentrun_inner_test-0.0.12/agentrun/agent_runtime/client.py +868 -0
  14. agentrun_inner_test-0.0.12/agentrun/agent_runtime/endpoint.py +649 -0
  15. agentrun_inner_test-0.0.12/agentrun/agent_runtime/model.py +362 -0
  16. agentrun_inner_test-0.0.12/agentrun/agent_runtime/runtime.py +904 -0
  17. agentrun_inner_test-0.0.12/agentrun/credential/__client_async_template.py +177 -0
  18. agentrun_inner_test-0.0.12/agentrun/credential/__credential_async_template.py +216 -0
  19. agentrun_inner_test-0.0.12/agentrun/credential/__init__.py +28 -0
  20. agentrun_inner_test-0.0.12/agentrun/credential/api/__init__.py +5 -0
  21. agentrun_inner_test-0.0.12/agentrun/credential/api/control.py +606 -0
  22. agentrun_inner_test-0.0.12/agentrun/credential/client.py +319 -0
  23. agentrun_inner_test-0.0.12/agentrun/credential/credential.py +381 -0
  24. agentrun_inner_test-0.0.12/agentrun/credential/model.py +248 -0
  25. agentrun_inner_test-0.0.12/agentrun/integration/__init__.py +21 -0
  26. agentrun_inner_test-0.0.12/agentrun/integration/agentscope/__init__.py +12 -0
  27. agentrun_inner_test-0.0.12/agentrun/integration/agentscope/adapter.py +17 -0
  28. agentrun_inner_test-0.0.12/agentrun/integration/agentscope/builtin.py +65 -0
  29. agentrun_inner_test-0.0.12/agentrun/integration/agentscope/message_adapter.py +185 -0
  30. agentrun_inner_test-0.0.12/agentrun/integration/agentscope/model_adapter.py +60 -0
  31. agentrun_inner_test-0.0.12/agentrun/integration/agentscope/tool_adapter.py +59 -0
  32. agentrun_inner_test-0.0.12/agentrun/integration/builtin/__init__.py +16 -0
  33. agentrun_inner_test-0.0.12/agentrun/integration/builtin/model.py +97 -0
  34. agentrun_inner_test-0.0.12/agentrun/integration/builtin/sandbox.py +1234 -0
  35. agentrun_inner_test-0.0.12/agentrun/integration/builtin/toolset.py +47 -0
  36. agentrun_inner_test-0.0.12/agentrun/integration/crewai/__init__.py +12 -0
  37. agentrun_inner_test-0.0.12/agentrun/integration/crewai/adapter.py +9 -0
  38. agentrun_inner_test-0.0.12/agentrun/integration/crewai/builtin.py +65 -0
  39. agentrun_inner_test-0.0.12/agentrun/integration/crewai/model_adapter.py +27 -0
  40. agentrun_inner_test-0.0.12/agentrun/integration/crewai/tool_adapter.py +26 -0
  41. agentrun_inner_test-0.0.12/agentrun/integration/google_adk/__init__.py +12 -0
  42. agentrun_inner_test-0.0.12/agentrun/integration/google_adk/adapter.py +15 -0
  43. agentrun_inner_test-0.0.12/agentrun/integration/google_adk/builtin.py +65 -0
  44. agentrun_inner_test-0.0.12/agentrun/integration/google_adk/message_adapter.py +144 -0
  45. agentrun_inner_test-0.0.12/agentrun/integration/google_adk/model_adapter.py +43 -0
  46. agentrun_inner_test-0.0.12/agentrun/integration/google_adk/tool_adapter.py +234 -0
  47. agentrun_inner_test-0.0.12/agentrun/integration/langchain/__init__.py +9 -0
  48. agentrun_inner_test-0.0.12/agentrun/integration/langchain/adapter.py +15 -0
  49. agentrun_inner_test-0.0.12/agentrun/integration/langchain/builtin.py +71 -0
  50. agentrun_inner_test-0.0.12/agentrun/integration/langchain/message_adapter.py +141 -0
  51. agentrun_inner_test-0.0.12/agentrun/integration/langchain/model_adapter.py +37 -0
  52. agentrun_inner_test-0.0.12/agentrun/integration/langchain/tool_adapter.py +50 -0
  53. agentrun_inner_test-0.0.12/agentrun/integration/langgraph/__init__.py +13 -0
  54. agentrun_inner_test-0.0.12/agentrun/integration/langgraph/adapter.py +20 -0
  55. agentrun_inner_test-0.0.12/agentrun/integration/langgraph/builtin.py +65 -0
  56. agentrun_inner_test-0.0.12/agentrun/integration/pydantic_ai/__init__.py +12 -0
  57. agentrun_inner_test-0.0.12/agentrun/integration/pydantic_ai/adapter.py +13 -0
  58. agentrun_inner_test-0.0.12/agentrun/integration/pydantic_ai/builtin.py +65 -0
  59. agentrun_inner_test-0.0.12/agentrun/integration/pydantic_ai/model_adapter.py +44 -0
  60. agentrun_inner_test-0.0.12/agentrun/integration/pydantic_ai/tool_adapter.py +19 -0
  61. agentrun_inner_test-0.0.12/agentrun/integration/utils/__init__.py +112 -0
  62. agentrun_inner_test-0.0.12/agentrun/integration/utils/adapter.py +559 -0
  63. agentrun_inner_test-0.0.12/agentrun/integration/utils/canonical.py +157 -0
  64. agentrun_inner_test-0.0.12/agentrun/integration/utils/converter.py +134 -0
  65. agentrun_inner_test-0.0.12/agentrun/integration/utils/model.py +107 -0
  66. agentrun_inner_test-0.0.12/agentrun/integration/utils/tool.py +1714 -0
  67. agentrun_inner_test-0.0.12/agentrun/model/__client_async_template.py +357 -0
  68. agentrun_inner_test-0.0.12/agentrun/model/__init__.py +57 -0
  69. agentrun_inner_test-0.0.12/agentrun/model/__model_proxy_async_template.py +270 -0
  70. agentrun_inner_test-0.0.12/agentrun/model/__model_service_async_template.py +267 -0
  71. agentrun_inner_test-0.0.12/agentrun/model/api/__init__.py +6 -0
  72. agentrun_inner_test-0.0.12/agentrun/model/api/control.py +1173 -0
  73. agentrun_inner_test-0.0.12/agentrun/model/api/data.py +196 -0
  74. agentrun_inner_test-0.0.12/agentrun/model/client.py +674 -0
  75. agentrun_inner_test-0.0.12/agentrun/model/model.py +218 -0
  76. agentrun_inner_test-0.0.12/agentrun/model/model_proxy.py +439 -0
  77. agentrun_inner_test-0.0.12/agentrun/model/model_service.py +438 -0
  78. agentrun_inner_test-0.0.12/agentrun/sandbox/__browser_sandbox_async_template.py +110 -0
  79. agentrun_inner_test-0.0.12/agentrun/sandbox/__client_async_template.py +466 -0
  80. agentrun_inner_test-0.0.12/agentrun/sandbox/__code_interpreter_sandbox_async_template.py +463 -0
  81. agentrun_inner_test-0.0.12/agentrun/sandbox/__init__.py +54 -0
  82. agentrun_inner_test-0.0.12/agentrun/sandbox/__sandbox_async_template.py +398 -0
  83. agentrun_inner_test-0.0.12/agentrun/sandbox/__template_async_template.py +150 -0
  84. agentrun_inner_test-0.0.12/agentrun/sandbox/api/__browser_data_async_template.py +140 -0
  85. agentrun_inner_test-0.0.12/agentrun/sandbox/api/__code_interpreter_data_async_template.py +206 -0
  86. agentrun_inner_test-0.0.12/agentrun/sandbox/api/__init__.py +17 -0
  87. agentrun_inner_test-0.0.12/agentrun/sandbox/api/__sandbox_data_async_template.py +100 -0
  88. agentrun_inner_test-0.0.12/agentrun/sandbox/api/browser_data.py +172 -0
  89. agentrun_inner_test-0.0.12/agentrun/sandbox/api/code_interpreter_data.py +396 -0
  90. agentrun_inner_test-0.0.12/agentrun/sandbox/api/control.py +1051 -0
  91. agentrun_inner_test-0.0.12/agentrun/sandbox/api/playwright_async.py +492 -0
  92. agentrun_inner_test-0.0.12/agentrun/sandbox/api/playwright_sync.py +492 -0
  93. agentrun_inner_test-0.0.12/agentrun/sandbox/api/sandbox_data.py +140 -0
  94. agentrun_inner_test-0.0.12/agentrun/sandbox/browser_sandbox.py +185 -0
  95. agentrun_inner_test-0.0.12/agentrun/sandbox/client.py +878 -0
  96. agentrun_inner_test-0.0.12/agentrun/sandbox/code_interpreter_sandbox.py +823 -0
  97. agentrun_inner_test-0.0.12/agentrun/sandbox/model.py +269 -0
  98. agentrun_inner_test-0.0.12/agentrun/sandbox/sandbox.py +737 -0
  99. agentrun_inner_test-0.0.12/agentrun/sandbox/template.py +215 -0
  100. agentrun_inner_test-0.0.12/agentrun/server/__init__.py +82 -0
  101. agentrun_inner_test-0.0.12/agentrun/server/invoker.py +131 -0
  102. agentrun_inner_test-0.0.12/agentrun/server/model.py +225 -0
  103. agentrun_inner_test-0.0.12/agentrun/server/openai_protocol.py +798 -0
  104. agentrun_inner_test-0.0.12/agentrun/server/protocol.py +96 -0
  105. agentrun_inner_test-0.0.12/agentrun/server/server.py +192 -0
  106. agentrun_inner_test-0.0.12/agentrun/toolset/__client_async_template.py +62 -0
  107. agentrun_inner_test-0.0.12/agentrun/toolset/__init__.py +51 -0
  108. agentrun_inner_test-0.0.12/agentrun/toolset/__toolset_async_template.py +204 -0
  109. agentrun_inner_test-0.0.12/agentrun/toolset/api/__init__.py +17 -0
  110. agentrun_inner_test-0.0.12/agentrun/toolset/api/control.py +262 -0
  111. agentrun_inner_test-0.0.12/agentrun/toolset/api/mcp.py +100 -0
  112. agentrun_inner_test-0.0.12/agentrun/toolset/api/openapi.py +1248 -0
  113. agentrun_inner_test-0.0.12/agentrun/toolset/client.py +102 -0
  114. agentrun_inner_test-0.0.12/agentrun/toolset/model.py +321 -0
  115. agentrun_inner_test-0.0.12/agentrun/toolset/toolset.py +271 -0
  116. agentrun_inner_test-0.0.12/agentrun/utils/__data_api_async_template.py +715 -0
  117. agentrun_inner_test-0.0.12/agentrun/utils/__init__.py +5 -0
  118. agentrun_inner_test-0.0.12/agentrun/utils/__resource_async_template.py +158 -0
  119. agentrun_inner_test-0.0.12/agentrun/utils/config.py +258 -0
  120. agentrun_inner_test-0.0.12/agentrun/utils/control_api.py +78 -0
  121. agentrun_inner_test-0.0.12/agentrun/utils/data_api.py +1110 -0
  122. agentrun_inner_test-0.0.12/agentrun/utils/exception.py +149 -0
  123. agentrun_inner_test-0.0.12/agentrun/utils/helper.py +34 -0
  124. agentrun_inner_test-0.0.12/agentrun/utils/log.py +77 -0
  125. agentrun_inner_test-0.0.12/agentrun/utils/model.py +168 -0
  126. agentrun_inner_test-0.0.12/agentrun/utils/resource.py +291 -0
  127. agentrun_inner_test-0.0.12/agentrun_inner_test.egg-info/PKG-INFO +262 -0
  128. agentrun_inner_test-0.0.12/agentrun_inner_test.egg-info/SOURCES.txt +131 -0
  129. agentrun_inner_test-0.0.12/agentrun_inner_test.egg-info/dependency_links.txt +1 -0
  130. agentrun_inner_test-0.0.12/agentrun_inner_test.egg-info/requires.txt +42 -0
  131. agentrun_inner_test-0.0.12/agentrun_inner_test.egg-info/top_level.txt +1 -0
  132. agentrun_inner_test-0.0.12/pyproject.toml +122 -0
  133. agentrun_inner_test-0.0.12/setup.cfg +4 -0
@@ -0,0 +1,201 @@
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
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Serverless Devs
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,262 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentrun-inner-test
3
+ Version: 0.0.12
4
+ Summary: Alibaba Cloud Agent Run SDK
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: crcmod>=1.7
9
+ Requires-Dist: pydantic>=2.12.4
10
+ Requires-Dist: httpx>=0.23.0
11
+ Requires-Dist: python-dotenv>=1.2.1
12
+ Requires-Dist: typing-extensions>=4.15.0
13
+ Requires-Dist: litellm>=1.79.3
14
+ Requires-Dist: alibabacloud-devs20230714>=2.4.1
15
+ Requires-Dist: pydash>=8.0.5
16
+ Requires-Dist: alibabacloud-agentrun20250910>=4.0.1
17
+ Requires-Dist: alibabacloud_tea_openapi>=0.4.2
18
+ Provides-Extra: server
19
+ Requires-Dist: fastapi>=0.104.0; extra == "server"
20
+ Requires-Dist: uvicorn>=0.24.0; extra == "server"
21
+ Provides-Extra: langchain
22
+ Requires-Dist: langchain>=1.0.0; python_version >= "3.10" and extra == "langchain"
23
+ Requires-Dist: langchain-openai>=1.0.0; python_version >= "3.10" and extra == "langchain"
24
+ Provides-Extra: google-adk
25
+ Requires-Dist: google-adk>=1.18.0; extra == "google-adk"
26
+ Provides-Extra: agentscope
27
+ Requires-Dist: agentscope>=0.1.6; extra == "agentscope"
28
+ Provides-Extra: crewai
29
+ Requires-Dist: crewai>=1.6.0; extra == "crewai"
30
+ Provides-Extra: pydantic-ai
31
+ Requires-Dist: pydantic-ai>=1.22.0; python_version >= "3.10" and extra == "pydantic-ai"
32
+ Provides-Extra: playwright
33
+ Requires-Dist: playwright>=1.40.0; extra == "playwright"
34
+ Provides-Extra: mcp
35
+ Requires-Dist: mcp>=1.21.2; python_version >= "3.10" and extra == "mcp"
36
+ Dynamic: license-file
37
+
38
+ # AgentRun Python SDK
39
+
40
+ <div align="center">
41
+
42
+ [![PyPI version](https://img.shields.io/pypi/v/agentrun-sdk.svg)](https://pypi.org/project/agentrun-sdk/)
43
+ [![License](https://img.shields.io/github/license/Serverless-Devs/agentrun-sdk-python.svg)](https://github.com/Serverless-Devs/agentrun-sdk-python/blob/main/LICENSE)
44
+ [![Documentation](https://img.shields.io/badge/docs-agent.run-blue.svg)](https://docs.agent.run)
45
+ [![GitHub stars](https://img.shields.io/github/stars/Serverless-Devs/agentrun-sdk-python.svg?style=social)](https://github.com/Serverless-Devs/agentrun-sdk-python)
46
+ [![GitHub issues](https://img.shields.io/github/issues/Serverless-Devs/agentrun-sdk-python.svg)](https://github.com/Serverless-Devs/agentrun-sdk-python/issues)
47
+
48
+ </div>
49
+
50
+ AgentRun Python SDK 是阿里云 AgentRun 服务的 Python 客户端库,提供简洁易用的 API 来管理 AI Agent 运行时环境。
51
+
52
+ ## ✨ 特性
53
+
54
+ - 🎯 **简洁 API** - 面向对象的设计,直观易用
55
+ - ⚡ **异步支持** - 同时提供同步和异步接口
56
+ - 🔧 **类型提示** - 完整的类型注解,IDE 友好
57
+ - 🔐 **多种认证** - 支持 Access Key、STS Token 等
58
+ - 🌐 **多区域** - 支持阿里云所有可用区域
59
+ - 📝 **详细文档** - 完善的代码注释和示例
60
+
61
+ ## 📦 安装
62
+
63
+ ### 使用 pip 安装
64
+
65
+ ```bash
66
+ pip install agentrun-sdk
67
+ ```
68
+
69
+ 可选依赖项
70
+ - `server`: 使用 AgentRunServer 集成 HTTP 服务
71
+ - `playwright:使用` Browser Sandbox 并集成 playwright
72
+ - `mcp:使用` MCP ToolSet
73
+ - `agentscope:集成` AgentScope
74
+ - `langchain:集成` LangChain
75
+ - `google`-adk:集成 Google ADK
76
+ - `crewai:集成` CrewAI
77
+ - `pydantic`-ai:集成 PydanticAI
78
+
79
+ 假设您需要使用 agentscope,并且需要用到 Browser Sandbox,AgentRun 上的 MCP 服务,那么您应该通过如下方式安装
80
+ ```bash
81
+ pip install agentrun-sdk[playwright,mcp,agentscope]
82
+ ```
83
+
84
+
85
+ ### 依赖要求
86
+
87
+ - Python 3.10 或更高版本
88
+
89
+ ## 🚀 快速开始
90
+
91
+ 你可以使用任意您喜欢的框架进行 Agent 开发,这里以 langchain 为例
92
+
93
+ ### 1. 安装 Serverless Devs
94
+
95
+ 运行脚手架,您需要使用 Serverless Devs 工具,请参考对应 [安装教程](https://serverless-devs.com/docs/user-guide/install)
96
+ > 如果您拥有 NodeJS 开发环境,可以使用 `npm i -g @serverless-devs/s` 快速安装 Serverless Devs
97
+ > 您也可以直接下载 [Serverless Devs 二进制程序](https://github.com/Serverless-Devs/Serverless-Devs/releases) 使用 Serverless Devs
98
+
99
+
100
+ ### 2. 创建模板
101
+
102
+ 使用快速创建脚手架创建您的 Agent
103
+
104
+ **注意!** 您需要确保您的 python 环境在 3.10 以上
105
+
106
+ ```bash
107
+ # 初始化模板
108
+ s init agentrun-quick-start-langchain
109
+
110
+ # 按照实际情况进入代码目录
111
+ cd agentrun-quick-start-langchain/code
112
+
113
+ # 初始化虚拟环境并安装依赖
114
+ uv venv && uv pip install -r requirements.txt
115
+ ```
116
+
117
+ ### 3. 配置认证信息
118
+
119
+ 设置环境变量(建议通过 `.env` 配置您的环境变量)
120
+
121
+ ```bash
122
+ export AGENTRUN_ACCESS_KEY_ID="your-access-key-id"
123
+ export AGENTRUN_ACCESS_KEY_SECRET="your-access-key-secret"
124
+ export AGENTRUN_ACCOUNT_ID="your-account-id"
125
+ export AGENTRUN_REGION="cn-hangzhou"
126
+ ```
127
+
128
+ ### 4. 了解 Agent 如何与 LangChain 集成
129
+
130
+
131
+ 使用 `from agentrun.integration.langchain import model, sandbox_toolset` 导入 langchain 的集成能力,这里默认提供了 `model`、`sandbox_toolset`、`toolset`,可以快速创建 langchain 可识别的大模型、工具
132
+ 同时,通过 AgentRunServer 可以快速开放 HTTP Server 供其他业务集成
133
+
134
+ ```python
135
+ from agentrun.integration.langchain import model, sandbox_toolset
136
+ from agentrun.sandbox import TemplateType
137
+ from agentrun.server import AgentRequest, AgentRunServer
138
+ from agentrun.utils.log import logger
139
+
140
+ # 请替换为您已经创建的 模型 和 沙箱 名称
141
+ MODEL_NAME = "<your-model-name>"
142
+ SANDBOX_NAME = "<your-sandbox-name>"
143
+
144
+ if MODEL_NAME.startswith("<"):
145
+ raise ValueError("请将 MODEL_NAME 替换为您已经创建的模型名称")
146
+
147
+ code_interpreter_tools = []
148
+ if SANDBOX_NAME and not SANDBOX_NAME.startswith("<"):
149
+ code_interpreter_tools = sandbox_toolset(
150
+ template_name=SANDBOX_NAME,
151
+ template_type=TemplateType.CODE_INTERPRETER,
152
+ sandbox_idle_timeout_seconds=300,
153
+ )
154
+ else:
155
+ logger.warning("SANDBOX_NAME 未设置或未替换,跳过加载沙箱工具。")
156
+
157
+ # ...
158
+
159
+ # 自动启动 http server,提供 OpenAI 协议
160
+ AgentRunServer(invoke_agent=invoke_agent).start()
161
+ ```
162
+
163
+ ### 5. 调用 Agent
164
+
165
+ ```bash
166
+ curl 127.0.0.1:9000/openai/v1/chat/completions \
167
+ -XPOST \
168
+ -H "content-type: application/json" \
169
+ -d '{"messages": [{"role": "user", "content": "通过代码查询现在是几点?"}], "stream":true}'
170
+ ```
171
+
172
+ ### 6. 部署项目
173
+
174
+ 项目中已经存在 `s.yaml` 文件,这是 Serverless Devs 的部署配置文件,通过这个文件,您可以配置当前 Agent 在 Agent Run 上的名称、CPU/内存规格、日志投递信息
175
+
176
+ 在示例情况下,您只需要简单修改该文件即可。修改 `role` 字段为授信给阿里云函数计算(FC)服务,需要拥有AliyunAgentRunFullAccess权限的角色(如果您拥有精细化权限控制的需求,可以根据实际使用的 API 收敛权限)
177
+
178
+ > 您可以点击此[快速授权链接](https://ram.console.aliyun.com/authorize?request=%7B%22template%22%3A%22OldRoleCommonAuthorize%22%2C%22referrer%22%3A%22https%3A%2F%2Ffunctionai.console.aliyun.com%2Fcn-hangzhou%2Fexplore%22%2C%22payloads%22%3A%5B%7B%22missionId%22%3A%22OldRoleCommonAuthorize.FC%22%2C%22roleName%22%3A%22agentRunRole%22%2C%22roleDescription%22%3A%22AgentRun%20auto%20created%20role.%22%2C%22rolePolicies%22%3A%5B%7B%22policyName%22%3A%22AliyunAgentRunFullAccess%22%7D%2C%7B%22policyName%22%3A%22AliyunDevsFullAccess%22%7D%5D%7D%5D%2C%22callback%22%3A%22https%3A%2F%2Ffunctionai.console.aliyun.com%22%7D),创建一个符合相关权限的角色agentRunRole。
179
+ >
180
+ > 此快速创建角色的RoleArn为:acs:ram::{您的阿里云主账号 ID}:role/agentRunRole
181
+
182
+ ```yaml
183
+ role: acs:ram::{您的阿里云主账号 ID}:role/{您的阿里云角色名称}
184
+ ```
185
+
186
+ > 如果在未来的使用中遇到了任何 Serverless Devs 相关问题,都可以参考 [Serverless Devs 相关文档](https://serverless-devs.com/docs/overview)
187
+
188
+ 在部署前,您需要配置您的部署密钥,使用 `s config add` 进入交互式密钥管理,并按照引导录入您在阿里云的 Access Key ID 与 Access Key Secret。在录入过程中,您需要短期记忆一下您输入的密钥对名称(假设为 `agentrun-deploy`)
189
+
190
+ 配置完成后,需要首先执行`s build`构建,该步骤依赖本地的`docker`服务,对代码目录下的`requirements.txt`进行构建,以便部署在云端。
191
+
192
+ 随后即可执行`s deploy`进行部署操作。
193
+
194
+ ```bash
195
+ s build
196
+ s deploy -a agentrun-deploy
197
+ # agentrun-deploy 是您使用的密钥对名称,也可以将该名称写入到 s.yaml 开头的 access: 字段中
198
+ ```
199
+
200
+ ### 7. 在线上进行调用
201
+
202
+ 部署完成后,您可以看到如下格式的输出
203
+ ```
204
+ endpoints:
205
+ -
206
+ id: ...
207
+ arn: ...
208
+ name: ...
209
+ url: https://12345.agentrun-data.cn-hangzhou.aliyuncs.com/agent-runtimes/abcd/endpoints/prod/invocations
210
+ ```
211
+
212
+ 此处的 url 为您的 Agent 调用地址,将实际的请求 path 拼接到该 base url 后,即可调用云上的 Agent 资源
213
+
214
+ ```bash
215
+ curl https://12345.agentrun-data.cn-hangzhou.aliyuncs.com/agent-runtimes/abcd/endpoints/prod/invocations/openai/v1/chat/completions \
216
+ -XPOST \
217
+ -H "content-type: application/json" \
218
+ -d '{"messages": [{"role": "user", "content": "通过代码查询现在是几点?"}], "stream":true}'
219
+ ```
220
+
221
+ ## ⚙️ 配置说明
222
+
223
+ ### Config 类
224
+
225
+ 用于配置认证信息和客户端参数。
226
+
227
+ ```python
228
+ from agentrun.utils.config import Config
229
+
230
+ config = Config(
231
+ access_key_id="your-key-id", # Access Key ID
232
+ access_key_secret="your-secret", # Access Key Secret
233
+ security_token="your-sts-token", # 可选:STS Token
234
+ token="token", # 数据链路 token(可以在无 AK 情况下调用数据链路)
235
+ headers={}, # 附加的请求头
236
+ account_id="your-account-id", # 账号 ID
237
+ region_id="cn-hangzhou", # 区域
238
+ timeout=30, # 可选:请求超时(秒)
239
+ control_endpoint="", # 可选:自定义控制端点
240
+ data_endpoint="", # 可选:自定义数据端点
241
+ )
242
+
243
+ # 使用配置创建客户端
244
+ client = agent_runtime.AgentRuntimeClient()
245
+ agent = client.create(input_config, config=config)
246
+ ```
247
+
248
+ ### 环境变量
249
+
250
+ SDK 会自动读取以下环境变量:
251
+
252
+ | 环境变量 | 说明 | 备用变量 |
253
+ |---------|------|---------|
254
+ | `AGENTRUN_ACCESS_KEY_ID` | Access Key ID | `ALIBABA_CLOUD_ACCESS_KEY_ID` |
255
+ | `AGENTRUN_ACCESS_KEY_SECRET` | Access Key Secret | `ALIBABA_CLOUD_ACCESS_KEY_SECRET` |
256
+ | `AGENTRUN_SECURITY_TOKEN` | STS Token | `ALIBABA_CLOUD_SECURITY_TOKEN` |
257
+ | `AGENTRUN_ACCOUNT_ID` | 账号 ID | `FC_ACCOUNT_ID` |
258
+ | `AGENTRUN_REGION` | 区域 | `FC_REGION` |
259
+ | `AGENTRUN_CONTROL_ENDPOINT` | 控制端点 | - |
260
+ | `AGENTRUN_DATA_ENDPOINT` | 数据端点 | - |
261
+ | `AGENTRUN_SDK_DEBUG` | 开启 DEBUG 日志 | - |
262
+