a2a-t-sdk 0.1.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 (121) hide show
  1. a2a_t_sdk-0.1.0/LICENSE +202 -0
  2. a2a_t_sdk-0.1.0/PKG-INFO +109 -0
  3. a2a_t_sdk-0.1.0/README.md +78 -0
  4. a2a_t_sdk-0.1.0/package_data/env.example +40 -0
  5. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/clarification_negotiation/0.0.1/en-US/system.md +1 -0
  6. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/clarification_negotiation/0.0.1/en-US/user.md +4 -0
  7. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/feasibility_negotiation/0.0.1/en-US/system.md +1 -0
  8. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/feasibility_negotiation/0.0.1/en-US/user.md +4 -0
  9. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/fulfillment_negotiation/0.0.1/en-US/system.md +1 -0
  10. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/fulfillment_negotiation/0.0.1/en-US/user.md +4 -0
  11. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/information_negotiation/0.0.1/en-US/system.md +1 -0
  12. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/information_negotiation/0.0.1/en-US/user.md +4 -0
  13. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/scenario_recognition/0.0.1/en-US/system.md +19 -0
  14. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/scenario_recognition/0.0.1/en-US/user.md +12 -0
  15. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/scenario_recognition/0.0.1/zh-CN/system.md +19 -0
  16. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/scenario_recognition/0.0.1/zh-CN/user.md +12 -0
  17. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/slot_extraction/0.0.1/en-US/system.md +45 -0
  18. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/slot_extraction/0.0.1/en-US/user.md +29 -0
  19. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/slot_extraction/0.0.1/zh-CN/system.md +45 -0
  20. a2a_t_sdk-0.1.0/package_data/prompt_resources/prompts/slot_extraction/0.0.1/zh-CN/user.md +25 -0
  21. a2a_t_sdk-0.1.0/package_data/prompt_resources/scenarios/0.0.1/en-US/scenarios.json +10 -0
  22. a2a_t_sdk-0.1.0/package_data/prompt_resources/scenarios/0.0.1/zh-CN/scenarios.json +10 -0
  23. a2a_t_sdk-0.1.0/package_data/prompt_resources/slots/subscribe_incident/0.0.1/en-US/slot.json +24 -0
  24. a2a_t_sdk-0.1.0/package_data/prompt_resources/slots/subscribe_incident/0.0.1/zh-CN/slot.json +24 -0
  25. a2a_t_sdk-0.1.0/package_data/prompt_resources/templates/subscribe_incident/0.0.1/en-US/template.md +26 -0
  26. a2a_t_sdk-0.1.0/package_data/prompt_resources/templates/subscribe_incident/0.0.1/zh-CN/template.md +26 -0
  27. a2a_t_sdk-0.1.0/pyproject.toml +77 -0
  28. a2a_t_sdk-0.1.0/src/a2a_t/__init__.py +40 -0
  29. a2a_t_sdk-0.1.0/src/a2a_t/client/__init__.py +5 -0
  30. a2a_t_sdk-0.1.0/src/a2a_t/client/a2at_client.py +48 -0
  31. a2a_t_sdk-0.1.0/src/a2a_t/client/negotiation/__init__.py +7 -0
  32. a2a_t_sdk-0.1.0/src/a2a_t/client/negotiation/negotiation_orchestrator.py +12 -0
  33. a2a_t_sdk-0.1.0/src/a2a_t/client/negotiation/negotiation_orchestrator_builder.py +59 -0
  34. a2a_t_sdk-0.1.0/src/a2a_t/client/prompt_generation/__init__.py +8 -0
  35. a2a_t_sdk-0.1.0/src/a2a_t/client/prompt_generation/generation_constants.py +18 -0
  36. a2a_t_sdk-0.1.0/src/a2a_t/client/prompt_generation/input_normalizer.py +36 -0
  37. a2a_t_sdk-0.1.0/src/a2a_t/client/prompt_generation/models.py +57 -0
  38. a2a_t_sdk-0.1.0/src/a2a_t/client/prompt_generation/prompt_generation_orchestrator.py +453 -0
  39. a2a_t_sdk-0.1.0/src/a2a_t/client/prompt_generation/prompt_generation_orchestrator_builder.py +52 -0
  40. a2a_t_sdk-0.1.0/src/a2a_t/common/__init__.py +21 -0
  41. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/__init__.py +38 -0
  42. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/_base.py +31 -0
  43. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/cache.py +31 -0
  44. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/catalog.py +37 -0
  45. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/errors.py +17 -0
  46. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/models.py +43 -0
  47. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/prompt_resource_loader.py +13 -0
  48. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/providers.py +24 -0
  49. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/registry.py +102 -0
  50. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/scenario_loader.py +21 -0
  51. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/slot_schema_loader.py +44 -0
  52. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/source.py +62 -0
  53. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_resources/template_loader.py +11 -0
  54. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_runtime/__init__.py +7 -0
  55. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_runtime/prompt_runtime_components.py +26 -0
  56. a2a_t_sdk-0.1.0/src/a2a_t/common/prompt_runtime/prompt_runtime_components_builder.py +50 -0
  57. a2a_t_sdk-0.1.0/src/a2a_t/config/__init__.py +28 -0
  58. a2a_t_sdk-0.1.0/src/a2a_t/config/errors.py +15 -0
  59. a2a_t_sdk-0.1.0/src/a2a_t/config/models.py +112 -0
  60. a2a_t_sdk-0.1.0/src/a2a_t/config/source.py +19 -0
  61. a2a_t_sdk-0.1.0/src/a2a_t/llm/__init__.py +40 -0
  62. a2a_t_sdk-0.1.0/src/a2a_t/llm/adapters/__init__.py +32 -0
  63. a2a_t_sdk-0.1.0/src/a2a_t/llm/adapters/deepseek_adapter.py +145 -0
  64. a2a_t_sdk-0.1.0/src/a2a_t/llm/base.py +155 -0
  65. a2a_t_sdk-0.1.0/src/a2a_t/llm/client.py +380 -0
  66. a2a_t_sdk-0.1.0/src/a2a_t/llm/errors.py +15 -0
  67. a2a_t_sdk-0.1.0/src/a2a_t/llm/factory.py +51 -0
  68. a2a_t_sdk-0.1.0/src/a2a_t/llm/session_store.py +103 -0
  69. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/__init__.py +1 -0
  70. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/common/__init__.py +37 -0
  71. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/common/constants.py +7 -0
  72. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/common/enums.py +21 -0
  73. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/common/exceptions.py +21 -0
  74. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/common/models.py +88 -0
  75. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/handling/__init__.py +5 -0
  76. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/handling/negotiation_handler.py +213 -0
  77. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/rendering/__init__.py +5 -0
  78. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/rendering/negotiation_prompt_renderer.py +25 -0
  79. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/runtime/__init__.py +5 -0
  80. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/runtime/base_negotiation_orchestrator.py +22 -0
  81. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/store/__init__.py +9 -0
  82. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/store/base.py +15 -0
  83. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/store/factory.py +45 -0
  84. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/store/in_memory.py +20 -0
  85. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/types/__init__.py +13 -0
  86. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/types/base.py +45 -0
  87. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/types/clarification.py +7 -0
  88. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/types/feasibility.py +7 -0
  89. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/types/fulfillment.py +7 -0
  90. a2a_t_sdk-0.1.0/src/a2a_t/negotiation/types/information.py +76 -0
  91. a2a_t_sdk-0.1.0/src/a2a_t/prompt/__init__.py +36 -0
  92. a2a_t_sdk-0.1.0/src/a2a_t/prompt/analysis/__init__.py +20 -0
  93. a2a_t_sdk-0.1.0/src/a2a_t/prompt/analysis/errors.py +17 -0
  94. a2a_t_sdk-0.1.0/src/a2a_t/prompt/analysis/json_schema_builder.py +47 -0
  95. a2a_t_sdk-0.1.0/src/a2a_t/prompt/analysis/message_builder.py +73 -0
  96. a2a_t_sdk-0.1.0/src/a2a_t/prompt/analysis/models.py +18 -0
  97. a2a_t_sdk-0.1.0/src/a2a_t/prompt/analysis/scenario_recognizer.py +92 -0
  98. a2a_t_sdk-0.1.0/src/a2a_t/prompt/analysis/slot_extractor.py +112 -0
  99. a2a_t_sdk-0.1.0/src/a2a_t/prompt/common/__init__.py +40 -0
  100. a2a_t_sdk-0.1.0/src/a2a_t/prompt/common/errors.py +43 -0
  101. a2a_t_sdk-0.1.0/src/a2a_t/prompt/common/models.py +76 -0
  102. a2a_t_sdk-0.1.0/src/a2a_t/prompt/common/task_prompt_format.py +88 -0
  103. a2a_t_sdk-0.1.0/src/a2a_t/prompt/task_rendering/__init__.py +7 -0
  104. a2a_t_sdk-0.1.0/src/a2a_t/prompt/task_rendering/exceptions.py +5 -0
  105. a2a_t_sdk-0.1.0/src/a2a_t/prompt/task_rendering/task_prompt_renderer.py +40 -0
  106. a2a_t_sdk-0.1.0/src/a2a_t/prompt/validation/__init__.py +25 -0
  107. a2a_t_sdk-0.1.0/src/a2a_t/prompt/validation/constants.py +4 -0
  108. a2a_t_sdk-0.1.0/src/a2a_t/prompt/validation/errors.py +9 -0
  109. a2a_t_sdk-0.1.0/src/a2a_t/prompt/validation/guardrails.py +34 -0
  110. a2a_t_sdk-0.1.0/src/a2a_t/prompt/validation/models.py +51 -0
  111. a2a_t_sdk-0.1.0/src/a2a_t/prompt/validation/slot_validator.py +42 -0
  112. a2a_t_sdk-0.1.0/src/a2a_t/server/__init__.py +5 -0
  113. a2a_t_sdk-0.1.0/src/a2a_t/server/a2at_server.py +61 -0
  114. a2a_t_sdk-0.1.0/src/a2a_t/server/negotiation/__init__.py +7 -0
  115. a2a_t_sdk-0.1.0/src/a2a_t/server/negotiation/negotiation_orchestrator.py +12 -0
  116. a2a_t_sdk-0.1.0/src/a2a_t/server/negotiation/negotiation_orchestrator_builder.py +77 -0
  117. a2a_t_sdk-0.1.0/src/a2a_t/server/prompt_compliance/__init__.py +36 -0
  118. a2a_t_sdk-0.1.0/src/a2a_t/server/prompt_compliance/constants.py +20 -0
  119. a2a_t_sdk-0.1.0/src/a2a_t/server/prompt_compliance/prompt_compliance_orchestrator.py +218 -0
  120. a2a_t_sdk-0.1.0/src/a2a_t/server/prompt_compliance/prompt_compliance_orchestrator_builder.py +40 -0
  121. a2a_t_sdk-0.1.0/src/a2a_t/server/prompt_compliance/result.py +20 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: a2a-t-sdk
3
+ Version: 0.1.0
4
+ Summary: Python A2A SDK for Telecom Scenarios
5
+ Keywords: a2a,agent,telecom,sdk
6
+ Author: A2A SDK Team
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.14
13
+ Requires-Dist: a2a-sdk>=1.0.1
14
+ Requires-Dist: fastapi>=0.115.0
15
+ Requires-Dist: sqlalchemy>=2.0.36
16
+ Requires-Dist: sse-starlette>=2.1.3
17
+ Requires-Dist: pyyaml>=6.0
18
+ Requires-Dist: httpx>=0.27.0
19
+ Requires-Dist: pydantic>=2.6.0
20
+ Requires-Dist: jsonschema>=4.23.0
21
+ Requires-Dist: packaging>=24.0
22
+ Requires-Dist: python-dotenv>=1.1.0
23
+ Requires-Dist: uvicorn>=0.32.0
24
+ Requires-Dist: openai
25
+ Requires-Dist: grpcio>=1.62.0 ; extra == 'grpc'
26
+ Requires-Python: >=3.14
27
+ Project-URL: Homepage, https://github.com/a2a/a2a-t-sdk
28
+ Project-URL: Documentation, https://github.com/a2a/a2a-t-sdk#readme
29
+ Provides-Extra: grpc
30
+ Description-Content-Type: text/markdown
31
+
32
+ # a2a-t-sdk
33
+
34
+ ## 项目简介
35
+
36
+ `a2a-t-sdk` 是一个面向电信场景的 Python SDK,用于生成任务提示词并处理任务协商流程,基于上游 `a2a-sdk` 进行扩展。当前版本为 `0.1.0`,处于 **Alpha** 阶段,适合用于原型验证、接口联调和能力评估,暂不建议直接用于生产环境。
37
+
38
+ 这个 SDK 主要面向两类使用方:
39
+
40
+ - 客户端:根据用户输入生成任务提示词,并发起、接收和推进协商流程。
41
+ - 服务端:校验符合 SDK 格式的 `processed task prompt`(处理后的任务提示词),并发起、接收和推进协商流程。
42
+
43
+ ## 核心能力
44
+
45
+ - 任务提示词生成链路:覆盖输入归一化、场景识别、槽位提取、槽位校验、任务提示词渲染。
46
+ - 客户端 API:提供任务提示词生成结果流,以及 `start_negotiation`、`receive_negotiation`、`continue_negotiation` 等协商入口。
47
+ - 服务端校验 API:面向符合 SDK 格式的 `processed task prompt`,执行元数据解析、槽位提取和槽位校验,并支持可选的 guardrail(防护)钩子。
48
+ - 协商类型:内置 `information`、`clarification`、`feasibility`、`fulfillment` 四类协商类型。
49
+ - 资源组织:内置提示词资源位于 `package_data/prompt_resources`,包含 `prompts`、`scenarios`、`slots`、`templates`。
50
+ - 内置示例场景:当前随包仅提供 `subscribe_incident`。
51
+
52
+ ## 项目结构
53
+
54
+ 仓库的核心代码位于 `src/a2a_t`,主要模块如下:
55
+
56
+ - `client`:客户端封装,提供任务提示词生成与协商入口。
57
+ - `server`:服务端封装,提供 `processed task prompt` 校验与协商入口。
58
+ - `common`:共享的提示词资源加载与运行时公共能力。
59
+ - `config`:模型相关配置及其加载逻辑。
60
+ - `llm`:LLM 适配层、客户端和会话存储抽象。
61
+ - `negotiation`:协商类型、运行时处理与状态存储。
62
+ - `prompt`:任务提示词格式、分析、渲染与校验相关能力。
63
+
64
+ ## 安装与环境要求
65
+
66
+ - Python 要求:`>=3.14`
67
+ - 包名:`a2a-t-sdk`
68
+ - 许可证:`Apache-2.0`
69
+ - 构建后端:`uv_build`
70
+ - 上游依赖:`a2a-sdk @ a2a-python v1.0.0-alpha.0`
71
+
72
+ 当前版本更适合通过源码方式试用、联调和评估。开始前,建议先将 `package_data/env.example` 复制为 `package_data/.env`。
73
+
74
+ ## 开发与测试
75
+
76
+ 项目使用 `uv_build` 作为构建后端,开发依赖包括:
77
+
78
+ - `pytest`
79
+ - `pytest-asyncio`
80
+ - `pytest-cov`
81
+ - `ruff`
82
+ - `mypy`
83
+
84
+ 建议的最小开发流程如下:
85
+
86
+ ```bash
87
+ uv sync --dev
88
+ uv run pytest
89
+ uv run ruff check .
90
+ uv run mypy src
91
+ ```
92
+
93
+ `tests/` 目录包含客户端提示词生成、服务端校验、协商运行时、提示词资源和 LLM 适配等测试用例。对于外部贡献者,建议优先执行与本次改动相关的测试和静态检查。
94
+
95
+ ## 当前支持范围
96
+
97
+ 使用前建议先确认以下限制:
98
+
99
+ - 项目整体处于 **Alpha** 阶段,接口和资源组织仍可能调整。
100
+ - 内置 LLM 适配器目前仅支持 DeepSeek。
101
+ - 内置 guardrail 机制目前仅提供 `noop`。
102
+ - 提示词资源目前仅支持本地文件。
103
+ - 协商状态存储目前仅提供内存实现,不保证持久化。
104
+ - 随包资源与语言覆盖有限,不包含 `registry`(注册中心)等远程资源加载能力。
105
+ - 本文档主要介绍 SDK 本身,不涉及 CLI、托管服务、部署流程或可直接使用的应用方案。
106
+
107
+ ## 许可证
108
+
109
+ 本项目采用 [Apache-2.0](LICENSE) 许可证。
@@ -0,0 +1,78 @@
1
+ # a2a-t-sdk
2
+
3
+ ## 项目简介
4
+
5
+ `a2a-t-sdk` 是一个面向电信场景的 Python SDK,用于生成任务提示词并处理任务协商流程,基于上游 `a2a-sdk` 进行扩展。当前版本为 `0.1.0`,处于 **Alpha** 阶段,适合用于原型验证、接口联调和能力评估,暂不建议直接用于生产环境。
6
+
7
+ 这个 SDK 主要面向两类使用方:
8
+
9
+ - 客户端:根据用户输入生成任务提示词,并发起、接收和推进协商流程。
10
+ - 服务端:校验符合 SDK 格式的 `processed task prompt`(处理后的任务提示词),并发起、接收和推进协商流程。
11
+
12
+ ## 核心能力
13
+
14
+ - 任务提示词生成链路:覆盖输入归一化、场景识别、槽位提取、槽位校验、任务提示词渲染。
15
+ - 客户端 API:提供任务提示词生成结果流,以及 `start_negotiation`、`receive_negotiation`、`continue_negotiation` 等协商入口。
16
+ - 服务端校验 API:面向符合 SDK 格式的 `processed task prompt`,执行元数据解析、槽位提取和槽位校验,并支持可选的 guardrail(防护)钩子。
17
+ - 协商类型:内置 `information`、`clarification`、`feasibility`、`fulfillment` 四类协商类型。
18
+ - 资源组织:内置提示词资源位于 `package_data/prompt_resources`,包含 `prompts`、`scenarios`、`slots`、`templates`。
19
+ - 内置示例场景:当前随包仅提供 `subscribe_incident`。
20
+
21
+ ## 项目结构
22
+
23
+ 仓库的核心代码位于 `src/a2a_t`,主要模块如下:
24
+
25
+ - `client`:客户端封装,提供任务提示词生成与协商入口。
26
+ - `server`:服务端封装,提供 `processed task prompt` 校验与协商入口。
27
+ - `common`:共享的提示词资源加载与运行时公共能力。
28
+ - `config`:模型相关配置及其加载逻辑。
29
+ - `llm`:LLM 适配层、客户端和会话存储抽象。
30
+ - `negotiation`:协商类型、运行时处理与状态存储。
31
+ - `prompt`:任务提示词格式、分析、渲染与校验相关能力。
32
+
33
+ ## 安装与环境要求
34
+
35
+ - Python 要求:`>=3.14`
36
+ - 包名:`a2a-t-sdk`
37
+ - 许可证:`Apache-2.0`
38
+ - 构建后端:`uv_build`
39
+ - 上游依赖:`a2a-sdk @ a2a-python v1.0.0-alpha.0`
40
+
41
+ 当前版本更适合通过源码方式试用、联调和评估。开始前,建议先将 `package_data/env.example` 复制为 `package_data/.env`。
42
+
43
+ ## 开发与测试
44
+
45
+ 项目使用 `uv_build` 作为构建后端,开发依赖包括:
46
+
47
+ - `pytest`
48
+ - `pytest-asyncio`
49
+ - `pytest-cov`
50
+ - `ruff`
51
+ - `mypy`
52
+
53
+ 建议的最小开发流程如下:
54
+
55
+ ```bash
56
+ uv sync --dev
57
+ uv run pytest
58
+ uv run ruff check .
59
+ uv run mypy src
60
+ ```
61
+
62
+ `tests/` 目录包含客户端提示词生成、服务端校验、协商运行时、提示词资源和 LLM 适配等测试用例。对于外部贡献者,建议优先执行与本次改动相关的测试和静态检查。
63
+
64
+ ## 当前支持范围
65
+
66
+ 使用前建议先确认以下限制:
67
+
68
+ - 项目整体处于 **Alpha** 阶段,接口和资源组织仍可能调整。
69
+ - 内置 LLM 适配器目前仅支持 DeepSeek。
70
+ - 内置 guardrail 机制目前仅提供 `noop`。
71
+ - 提示词资源目前仅支持本地文件。
72
+ - 协商状态存储目前仅提供内存实现,不保证持久化。
73
+ - 随包资源与语言覆盖有限,不包含 `registry`(注册中心)等远程资源加载能力。
74
+ - 本文档主要介绍 SDK 本身,不涉及 CLI、托管服务、部署流程或可直接使用的应用方案。
75
+
76
+ ## 许可证
77
+
78
+ 本项目采用 [Apache-2.0](LICENSE) 许可证。
@@ -0,0 +1,40 @@
1
+ A2AT_PROMPT_DEFAULT_TTL_SECONDS=3600
2
+ A2AT_PROMPT_LOCAL_DIR=./prompts
3
+ A2AT_PROMPT_ALLOWED_EXTENSIONS=.md
4
+ A2AT_DEFAULT_PROMPT_EXTENSION_URI=default-prompt
5
+ A2AT_PROMPT_EXTENSION_URI_OVERRIDES={"agent":"prompt://agent-extension"}
6
+ A2AT_DEFAULT_PROMPT_INDEX_URL_PARAM_KEY=promptIndexUrl
7
+ A2AT_PROMPT_INDEX_URL_PARAM_KEY_OVERRIDES={"agent":"agentPromptCatalogUrl"}
8
+
9
+ # Prompt compliance
10
+ # Only "noop" is supported for A2AT_PROMPT_COMPLIANCE_GUARDRAIL_PROVIDER.
11
+ # Other historical values such as "google_model_armor" are no longer implemented.
12
+ A2AT_PROMPT_COMPLIANCE_ENABLED=false
13
+ A2AT_PROMPT_COMPLIANCE_GUARDRAIL_PROVIDER=noop
14
+ A2AT_PROMPT_COMPLIANCE_GUARDRAIL_TIMEOUT_SECONDS=10
15
+ A2AT_PROMPT_COMPLIANCE_GUARDRAIL_POLICY_ID=
16
+ A2AT_PROMPT_COMPLIANCE_GUARDRAIL_ENDPOINT=
17
+ A2AT_PROMPT_COMPLIANCE_GUARDRAIL_REGION=
18
+ A2AT_PROMPT_COMPLIANCE_GUARDRAIL_CREDENTIALS_REF=
19
+ A2AT_PROMPT_COMPLIANCE_SLOT_EXTRACTION_PROVIDER=
20
+ A2AT_PROMPT_COMPLIANCE_SLOT_EXTRACTION_MODEL=
21
+ A2AT_PROMPT_COMPLIANCE_SLOT_EXTRACTION_TIMEOUT_SECONDS=30
22
+ A2AT_PROMPT_COMPLIANCE_SLOT_EXTRACTION_TEMPERATURE=0
23
+ A2AT_PROMPT_COMPLIANCE_SLOT_EXTRACTION_MAX_RETRIES=2
24
+ A2AT_PROMPT_COMPLIANCE_SLOT_LOCAL_DIR=./slots
25
+ A2AT_PROMPT_COMPLIANCE_SLOT_FILE_NAME=slot.json
26
+ A2AT_PROMPT_COMPLIANCE_SLOT_NOT_FOUND_POLICY=strict
27
+
28
+ # LLM runtime
29
+ # Only "deepseek" is supported for A2AT_LLM_PROVIDER in the current project.
30
+ # OpenAI / Google / Anthropic will be supported in future versions.
31
+ A2AT_LLM_PROVIDER=deepseek
32
+ A2AT_LLM_MODEL=deepseek-chat
33
+ A2AT_LLM_API_KEY=
34
+ A2AT_LLM_BASE_URL=https://api.deepseek.com
35
+ A2AT_LLM_MAX_TOKENS=2000
36
+ A2AT_LLM_TEMPERATURE=0
37
+ A2AT_LLM_TIMEOUT_SECONDS=60
38
+ A2AT_LLM_HISTORY_WINDOW=10
39
+ A2AT_LLM_SESSION_MAX_TOTAL=300
40
+ A2AT_LLM_SESSION_MAX_PER_PROVIDER=100
@@ -0,0 +1 @@
1
+ Clarification negotiation started by the {role} side.
@@ -0,0 +1,4 @@
1
+ Status={status}
2
+ Round={round}
3
+ Content={content_text}
4
+ Facts={facts_json}
@@ -0,0 +1 @@
1
+ Feasibility negotiation started by the {role} side.
@@ -0,0 +1,4 @@
1
+ Status={status}
2
+ Round={round}
3
+ Content={content_text}
4
+ Facts={facts_json}
@@ -0,0 +1 @@
1
+ Fulfillment negotiation started by the {role} side.
@@ -0,0 +1,4 @@
1
+ Status={status}
2
+ Round={round}
3
+ Content={content_text}
4
+ Facts={facts_json}
@@ -0,0 +1 @@
1
+ Information negotiation started by the {role} side.
@@ -0,0 +1,4 @@
1
+ Status={status}
2
+ Round={round}
3
+ Content={content_text}
4
+ Facts={facts_json}
@@ -0,0 +1,19 @@
1
+ You are a scenario recognition agent. Your task is to identify the best matching scenario from the provided scenario list based on the user's intent.
2
+
3
+ ## Output Format
4
+ Return a JSON object with the following structure:
5
+ - matched: boolean - true if a scenario matches, false otherwise
6
+ - scenario_code: string or null - the matched scenario code, null if no match
7
+ - error_message: string or null - explanation if matched=false, null if matched=true
8
+
9
+ ## Matching Strategy
10
+ Match scenarios based on:
11
+ 1. **Task Type**: Identify the primary action (e.g., subscribe, analyze, query)
12
+ 2. **Domain Keywords**: Look for domain-specific terms (e.g., incident, alarm, energy, power)
13
+ 3. **Intent Semantics**: Understand what the user wants to accomplish
14
+
15
+ ## Constraints
16
+ - ONLY recognize the scenario, DO NOT extract slot values
17
+ - DO NOT reject a scenario due to missing or invalid slot values
18
+ - Return matched=false ONLY when the input intent does not fit ANY supported scenario
19
+ - When matched=true, scenario_code MUST be one of the exact codes from the scenario list
@@ -0,0 +1,12 @@
1
+ Analyze the normalized input and match it to the best supported scenario.
2
+
3
+ ## Scenario Hints
4
+ - **energy_saving**: Keywords include "energy", "power", "consumption", "saving", "efficiency", "optimize". Intent: analyze energy usage and suggest optimizations.
5
+ - **subscribe_incident**: Keywords include "subscribe", "incident", "alarm", "event", "notification", "alert". Intent: subscribe to incident/alarm events from network devices.
6
+
7
+ ## Decision Rules
8
+ 1. If input clearly indicates one task type, select that scenario
9
+ 2. If input is ambiguous, choose the most likely scenario based on domain keywords
10
+ 3. If input cannot be mapped to any scenario, return matched=false with explanation
11
+
12
+ Process the input now and return your matching result.
@@ -0,0 +1,19 @@
1
+ 你是一个场景识别代理。你的任务是根据用户意图从提供的场景列表中识别最佳匹配场景。
2
+
3
+ ## 输出格式
4
+ 返回一个 JSON 对象,包含以下字段:
5
+ - matched: boolean - 如果场景匹配则为 true,否则为 false
6
+ - scenario_code: string 或 null - 匹配的场景编码,无匹配时为 null
7
+ - error_message: string 或 null - matched=false 时的解释,matched=true 时为 null
8
+
9
+ ## 匹配策略
10
+ 基于以下维度匹配场景:
11
+ 1. **任务类型**:识别主要动作(如订阅、分析、查询)
12
+ 2. **领域关键词**:查找领域术语(如 incident、告警、能耗、节能)
13
+ 3. **意图语义**:理解用户想要完成什么
14
+
15
+ ## 约束
16
+ - 仅识别场景,不提取 slot 值
17
+ - 不要因 slot 缺失或无效而拒绝场景
18
+ - 仅当输入意图不匹配任何支持场景时返回 matched=false
19
+ - matched=true 时,scenario_code 必须是场景列表中的精确编码
@@ -0,0 +1,12 @@
1
+ 分析归一化输入并将其匹配到最佳支持场景。
2
+
3
+ ## 场景提示
4
+ - **energy_saving**:关键词包括"能耗"、"节能"、"电量"、"优化"。意图:分析能耗并提供优化建议。
5
+ - **subscribe_incident**:关键词包括"订阅"、"incident"、"告警"、"事件"、"通知"。意图:订阅网络设备的告警事件。
6
+
7
+ ## 决策规则
8
+ 1. 如果输入明确指示一种任务类型,选择该场景
9
+ 2. 如果输入模糊,根据领域关键词选择最可能的场景
10
+ 3. 如果输入无法映射到任何场景,返回 matched=false 并解释原因
11
+
12
+ 现在处理输入并返回匹配结果。
@@ -0,0 +1,45 @@
1
+ You are a slot extraction agent. Your task is to extract slot values from the user input based on the provided slot schema and template context.
2
+
3
+ ## Output Format
4
+ Return a JSON object with the following structure:
5
+ ```json
6
+ {
7
+ "slots": {
8
+ "<slot_name>": "string value" | null,
9
+ ...
10
+ },
11
+ "slot_errors": [
12
+ {
13
+ "slot_name": "string",
14
+ "code": "missing_input" | "invalid_value",
15
+ "message": "string"
16
+ }
17
+ ]
18
+ }
19
+ ```
20
+
21
+ ## Slot Value Rules
22
+ - Every slot defined in the schema MUST appear in the `slots` object
23
+ - Slot values MUST be either a non-empty string or null
24
+ - Empty strings or whitespace-only strings MUST be treated as null
25
+
26
+ ## Error Reporting Rules
27
+ Report errors ONLY in `slot_errors` array with the following codes:
28
+ - **missing_input**: Required slot cannot be extracted from input (value set to null)
29
+ - **invalid_value**: Extracted value violates the slot's value_constraint (value set to null)
30
+
31
+ ### Required vs Optional Slots
32
+ - **Required slot missing**: Set value to null, add error with code="missing_input"
33
+ - **Optional slot missing**: Set value to null, NO error entry needed
34
+ - **Value violates constraint**: Set value to null, add error with code="invalid_value"
35
+
36
+ ## Extraction Strategy
37
+ 1. Analyze the user input to identify explicit slot values
38
+ 2. Cross-reference with slot schema for value_constraint validation
39
+ 3. Use template context to understand slot semantics and expected format
40
+ 4. For list-type slots, extract as JSON array string (e.g. "[\"item1\", \"item2\"]")
41
+
42
+ ## Constraints
43
+ - DO NOT generate or infer values not present in the input
44
+ - DO NOT produce final prompt text, ONLY extract slot values
45
+ - Report ONLY slots with errors, omit successfully extracted slots from slot_errors
@@ -0,0 +1,29 @@
1
+ Extract slot values from the normalized input based on the slot schema and template provided below.
2
+
3
+ ## Extraction Guidelines
4
+ 1. Identify explicit values for each slot from the input text
5
+ 2. Validate extracted values against each slot's value_constraint
6
+ 3. For slots without explicit input, determine if they are required or optional
7
+ 4. Format list-type slots as JSON array strings
8
+
9
+ ## Error Handling
10
+ - If a required slot cannot be extracted: set value=null, report code="missing_input"
11
+ - If an optional slot cannot be extracted: set value=null, no error
12
+ - If a value violates value_constraint: set value=null, report code="invalid_value"
13
+
14
+ ## Example Output
15
+ ```json
16
+ {
17
+ "slots": {
18
+ "incident_name": "[\"eth-los\"]",
19
+ "incident_level": "[\"critical\", \"major\"]",
20
+ "extra_incident_subscription_condition": null,
21
+ "extra_incident_basic_info": null,
22
+ "extra_incident_analysis_result": null,
23
+ "extra_incident_business_impact": null
24
+ },
25
+ "slot_errors": []
26
+ }
27
+ ```
28
+
29
+ Process the input now and return your extraction result.
@@ -0,0 +1,45 @@
1
+ 你是一个 slot 提取代理。你的任务是根据提供的 slot schema 和模板上下文从用户输入中提取 slot 值。
2
+
3
+ ## 输出格式
4
+ 返回一个 JSON 对象,包含以下结构:
5
+ ```json
6
+ {
7
+ "slots": {
8
+ "<slot_name>": "字符串值" | null,
9
+ ...
10
+ },
11
+ "slot_errors": [
12
+ {
13
+ "slot_name": "字符串",
14
+ "code": "missing_input" | "invalid_value",
15
+ "message": "字符串"
16
+ }
17
+ ]
18
+ }
19
+ ```
20
+
21
+ ## Slot 值规则
22
+ - slot schema 中定义的每个 slot 必须出现在 `slots` 对象中
23
+ - slot 值必须是非空字符串或 null
24
+ - 空字符串或纯空白字符串必须视为 null
25
+
26
+ ## 错误报告规则
27
+ 仅在 `slot_errors` 数组中报告错误,使用以下错误码:
28
+ - **missing_input**:无法从输入中提取必填 slot(值设为 null)
29
+ - **invalid_value**:提取的值违反 slot 的 value_constraint(值设为 null)
30
+
31
+ ### 必填 vs 可选 Slot
32
+ - **必填 slot 缺失**:值设为 null,添加错误 code="missing_input"
33
+ - **可选 slot 缺失**:值设为 null,无需错误条目
34
+ - **值违反约束**:值设为 null,添加错误 code="invalid_value"
35
+
36
+ ## 提取策略
37
+ 1. 分析用户输入,识别明确的 slot 值
38
+ 2. 根据 slot schema 的 value_constraint 校验值
39
+ 3. 利用模板上下文理解 slot 语义和预期格式
40
+ 4. 对于 list 类型 slot,提取为 JSON 数组字符串(如 "[\"item1\", \"item2\"]")
41
+
42
+ ## 约束
43
+ - 不要生成或推断输入中未出现的值
44
+ - 不要生成最终 prompt 文本,仅提取 slot 值
45
+ - 仅报告有错误的 slot,成功提取的 slot 不加入 slot_errors