agentex-sdk 0.1.0__py3-none-any.whl

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 (289) hide show
  1. agentex/__init__.py +103 -0
  2. agentex/_base_client.py +1992 -0
  3. agentex/_client.py +506 -0
  4. agentex/_compat.py +219 -0
  5. agentex/_constants.py +14 -0
  6. agentex/_exceptions.py +108 -0
  7. agentex/_files.py +123 -0
  8. agentex/_models.py +829 -0
  9. agentex/_qs.py +150 -0
  10. agentex/_resource.py +43 -0
  11. agentex/_response.py +830 -0
  12. agentex/_streaming.py +333 -0
  13. agentex/_types.py +219 -0
  14. agentex/_utils/__init__.py +57 -0
  15. agentex/_utils/_logs.py +25 -0
  16. agentex/_utils/_proxy.py +65 -0
  17. agentex/_utils/_reflection.py +42 -0
  18. agentex/_utils/_resources_proxy.py +24 -0
  19. agentex/_utils/_streams.py +12 -0
  20. agentex/_utils/_sync.py +86 -0
  21. agentex/_utils/_transform.py +447 -0
  22. agentex/_utils/_typing.py +151 -0
  23. agentex/_utils/_utils.py +422 -0
  24. agentex/_version.py +4 -0
  25. agentex/lib/.keep +4 -0
  26. agentex/lib/__init__.py +0 -0
  27. agentex/lib/adk/__init__.py +41 -0
  28. agentex/lib/adk/_modules/__init__.py +0 -0
  29. agentex/lib/adk/_modules/acp.py +247 -0
  30. agentex/lib/adk/_modules/agent_task_tracker.py +176 -0
  31. agentex/lib/adk/_modules/agents.py +77 -0
  32. agentex/lib/adk/_modules/events.py +141 -0
  33. agentex/lib/adk/_modules/messages.py +285 -0
  34. agentex/lib/adk/_modules/state.py +291 -0
  35. agentex/lib/adk/_modules/streaming.py +75 -0
  36. agentex/lib/adk/_modules/tasks.py +124 -0
  37. agentex/lib/adk/_modules/tracing.py +194 -0
  38. agentex/lib/adk/providers/__init__.py +9 -0
  39. agentex/lib/adk/providers/_modules/__init__.py +0 -0
  40. agentex/lib/adk/providers/_modules/litellm.py +232 -0
  41. agentex/lib/adk/providers/_modules/openai.py +416 -0
  42. agentex/lib/adk/providers/_modules/sgp.py +85 -0
  43. agentex/lib/adk/utils/__init__.py +5 -0
  44. agentex/lib/adk/utils/_modules/__init__.py +0 -0
  45. agentex/lib/adk/utils/_modules/templating.py +94 -0
  46. agentex/lib/cli/__init__.py +0 -0
  47. agentex/lib/cli/commands/__init__.py +0 -0
  48. agentex/lib/cli/commands/agents.py +328 -0
  49. agentex/lib/cli/commands/init.py +227 -0
  50. agentex/lib/cli/commands/main.py +33 -0
  51. agentex/lib/cli/commands/secrets.py +169 -0
  52. agentex/lib/cli/commands/tasks.py +118 -0
  53. agentex/lib/cli/commands/uv.py +133 -0
  54. agentex/lib/cli/handlers/__init__.py +0 -0
  55. agentex/lib/cli/handlers/agent_handlers.py +160 -0
  56. agentex/lib/cli/handlers/cleanup_handlers.py +186 -0
  57. agentex/lib/cli/handlers/deploy_handlers.py +351 -0
  58. agentex/lib/cli/handlers/run_handlers.py +452 -0
  59. agentex/lib/cli/handlers/secret_handlers.py +670 -0
  60. agentex/lib/cli/templates/default/.dockerignore.j2 +43 -0
  61. agentex/lib/cli/templates/default/Dockerfile-uv.j2 +42 -0
  62. agentex/lib/cli/templates/default/Dockerfile.j2 +42 -0
  63. agentex/lib/cli/templates/default/README.md.j2 +193 -0
  64. agentex/lib/cli/templates/default/deploy/example.yaml.j2 +55 -0
  65. agentex/lib/cli/templates/default/manifest.yaml.j2 +116 -0
  66. agentex/lib/cli/templates/default/project/acp.py.j2 +29 -0
  67. agentex/lib/cli/templates/default/pyproject.toml.j2 +33 -0
  68. agentex/lib/cli/templates/default/requirements.txt.j2 +5 -0
  69. agentex/lib/cli/templates/deploy/Screenshot 2025-03-19 at 10.36.57/342/200/257AM.png +0 -0
  70. agentex/lib/cli/templates/deploy/example.yaml.j2 +55 -0
  71. agentex/lib/cli/templates/sync/.dockerignore.j2 +43 -0
  72. agentex/lib/cli/templates/sync/Dockerfile-uv.j2 +42 -0
  73. agentex/lib/cli/templates/sync/Dockerfile.j2 +42 -0
  74. agentex/lib/cli/templates/sync/README.md.j2 +293 -0
  75. agentex/lib/cli/templates/sync/deploy/example.yaml.j2 +55 -0
  76. agentex/lib/cli/templates/sync/manifest.yaml.j2 +116 -0
  77. agentex/lib/cli/templates/sync/project/acp.py.j2 +26 -0
  78. agentex/lib/cli/templates/sync/pyproject.toml.j2 +33 -0
  79. agentex/lib/cli/templates/sync/requirements.txt.j2 +5 -0
  80. agentex/lib/cli/templates/temporal/.dockerignore.j2 +43 -0
  81. agentex/lib/cli/templates/temporal/Dockerfile-uv.j2 +48 -0
  82. agentex/lib/cli/templates/temporal/Dockerfile.j2 +48 -0
  83. agentex/lib/cli/templates/temporal/README.md.j2 +316 -0
  84. agentex/lib/cli/templates/temporal/deploy/example.yaml.j2 +55 -0
  85. agentex/lib/cli/templates/temporal/manifest.yaml.j2 +137 -0
  86. agentex/lib/cli/templates/temporal/project/acp.py.j2 +30 -0
  87. agentex/lib/cli/templates/temporal/project/run_worker.py.j2 +33 -0
  88. agentex/lib/cli/templates/temporal/project/workflow.py.j2 +66 -0
  89. agentex/lib/cli/templates/temporal/pyproject.toml.j2 +34 -0
  90. agentex/lib/cli/templates/temporal/requirements.txt.j2 +5 -0
  91. agentex/lib/cli/utils/cli_utils.py +14 -0
  92. agentex/lib/cli/utils/credential_utils.py +103 -0
  93. agentex/lib/cli/utils/exceptions.py +6 -0
  94. agentex/lib/cli/utils/kubectl_utils.py +135 -0
  95. agentex/lib/cli/utils/kubernetes_secrets_utils.py +185 -0
  96. agentex/lib/core/__init__.py +0 -0
  97. agentex/lib/core/adapters/__init__.py +0 -0
  98. agentex/lib/core/adapters/llm/__init__.py +1 -0
  99. agentex/lib/core/adapters/llm/adapter_litellm.py +46 -0
  100. agentex/lib/core/adapters/llm/adapter_sgp.py +55 -0
  101. agentex/lib/core/adapters/llm/port.py +24 -0
  102. agentex/lib/core/adapters/streams/adapter_redis.py +128 -0
  103. agentex/lib/core/adapters/streams/port.py +50 -0
  104. agentex/lib/core/clients/__init__.py +1 -0
  105. agentex/lib/core/clients/temporal/__init__.py +0 -0
  106. agentex/lib/core/clients/temporal/temporal_client.py +181 -0
  107. agentex/lib/core/clients/temporal/types.py +47 -0
  108. agentex/lib/core/clients/temporal/utils.py +56 -0
  109. agentex/lib/core/services/__init__.py +0 -0
  110. agentex/lib/core/services/adk/__init__.py +0 -0
  111. agentex/lib/core/services/adk/acp/__init__.py +0 -0
  112. agentex/lib/core/services/adk/acp/acp.py +210 -0
  113. agentex/lib/core/services/adk/agent_task_tracker.py +85 -0
  114. agentex/lib/core/services/adk/agents.py +43 -0
  115. agentex/lib/core/services/adk/events.py +61 -0
  116. agentex/lib/core/services/adk/messages.py +164 -0
  117. agentex/lib/core/services/adk/providers/__init__.py +0 -0
  118. agentex/lib/core/services/adk/providers/litellm.py +256 -0
  119. agentex/lib/core/services/adk/providers/openai.py +723 -0
  120. agentex/lib/core/services/adk/providers/sgp.py +99 -0
  121. agentex/lib/core/services/adk/state.py +120 -0
  122. agentex/lib/core/services/adk/streaming.py +262 -0
  123. agentex/lib/core/services/adk/tasks.py +69 -0
  124. agentex/lib/core/services/adk/tracing.py +36 -0
  125. agentex/lib/core/services/adk/utils/__init__.py +0 -0
  126. agentex/lib/core/services/adk/utils/templating.py +58 -0
  127. agentex/lib/core/temporal/__init__.py +0 -0
  128. agentex/lib/core/temporal/activities/__init__.py +207 -0
  129. agentex/lib/core/temporal/activities/activity_helpers.py +37 -0
  130. agentex/lib/core/temporal/activities/adk/__init__.py +0 -0
  131. agentex/lib/core/temporal/activities/adk/acp/__init__.py +0 -0
  132. agentex/lib/core/temporal/activities/adk/acp/acp_activities.py +86 -0
  133. agentex/lib/core/temporal/activities/adk/agent_task_tracker_activities.py +76 -0
  134. agentex/lib/core/temporal/activities/adk/agents_activities.py +35 -0
  135. agentex/lib/core/temporal/activities/adk/events_activities.py +50 -0
  136. agentex/lib/core/temporal/activities/adk/messages_activities.py +94 -0
  137. agentex/lib/core/temporal/activities/adk/providers/__init__.py +0 -0
  138. agentex/lib/core/temporal/activities/adk/providers/litellm_activities.py +71 -0
  139. agentex/lib/core/temporal/activities/adk/providers/openai_activities.py +210 -0
  140. agentex/lib/core/temporal/activities/adk/providers/sgp_activities.py +42 -0
  141. agentex/lib/core/temporal/activities/adk/state_activities.py +85 -0
  142. agentex/lib/core/temporal/activities/adk/streaming_activities.py +33 -0
  143. agentex/lib/core/temporal/activities/adk/tasks_activities.py +48 -0
  144. agentex/lib/core/temporal/activities/adk/tracing_activities.py +55 -0
  145. agentex/lib/core/temporal/activities/adk/utils/__init__.py +0 -0
  146. agentex/lib/core/temporal/activities/adk/utils/templating_activities.py +41 -0
  147. agentex/lib/core/temporal/services/__init__.py +0 -0
  148. agentex/lib/core/temporal/services/temporal_task_service.py +69 -0
  149. agentex/lib/core/temporal/types/__init__.py +0 -0
  150. agentex/lib/core/temporal/types/workflow.py +5 -0
  151. agentex/lib/core/temporal/workers/__init__.py +0 -0
  152. agentex/lib/core/temporal/workers/worker.py +162 -0
  153. agentex/lib/core/temporal/workflows/workflow.py +26 -0
  154. agentex/lib/core/tracing/__init__.py +5 -0
  155. agentex/lib/core/tracing/processors/agentex_tracing_processor.py +117 -0
  156. agentex/lib/core/tracing/processors/sgp_tracing_processor.py +119 -0
  157. agentex/lib/core/tracing/processors/tracing_processor_interface.py +40 -0
  158. agentex/lib/core/tracing/trace.py +311 -0
  159. agentex/lib/core/tracing/tracer.py +70 -0
  160. agentex/lib/core/tracing/tracing_processor_manager.py +62 -0
  161. agentex/lib/environment_variables.py +87 -0
  162. agentex/lib/py.typed +0 -0
  163. agentex/lib/sdk/__init__.py +0 -0
  164. agentex/lib/sdk/config/__init__.py +0 -0
  165. agentex/lib/sdk/config/agent_config.py +61 -0
  166. agentex/lib/sdk/config/agent_manifest.py +219 -0
  167. agentex/lib/sdk/config/build_config.py +35 -0
  168. agentex/lib/sdk/config/deployment_config.py +117 -0
  169. agentex/lib/sdk/config/local_development_config.py +56 -0
  170. agentex/lib/sdk/config/project_config.py +103 -0
  171. agentex/lib/sdk/fastacp/__init__.py +3 -0
  172. agentex/lib/sdk/fastacp/base/base_acp_server.py +406 -0
  173. agentex/lib/sdk/fastacp/fastacp.py +74 -0
  174. agentex/lib/sdk/fastacp/impl/agentic_base_acp.py +72 -0
  175. agentex/lib/sdk/fastacp/impl/sync_acp.py +109 -0
  176. agentex/lib/sdk/fastacp/impl/temporal_acp.py +97 -0
  177. agentex/lib/sdk/fastacp/tests/README.md +297 -0
  178. agentex/lib/sdk/fastacp/tests/conftest.py +307 -0
  179. agentex/lib/sdk/fastacp/tests/pytest.ini +10 -0
  180. agentex/lib/sdk/fastacp/tests/run_tests.py +227 -0
  181. agentex/lib/sdk/fastacp/tests/test_base_acp_server.py +450 -0
  182. agentex/lib/sdk/fastacp/tests/test_fastacp_factory.py +344 -0
  183. agentex/lib/sdk/fastacp/tests/test_integration.py +477 -0
  184. agentex/lib/sdk/state_machine/__init__.py +6 -0
  185. agentex/lib/sdk/state_machine/noop_workflow.py +21 -0
  186. agentex/lib/sdk/state_machine/state.py +10 -0
  187. agentex/lib/sdk/state_machine/state_machine.py +189 -0
  188. agentex/lib/sdk/state_machine/state_workflow.py +16 -0
  189. agentex/lib/sdk/utils/__init__.py +0 -0
  190. agentex/lib/sdk/utils/messages.py +223 -0
  191. agentex/lib/types/__init__.py +0 -0
  192. agentex/lib/types/acp.py +94 -0
  193. agentex/lib/types/agent_configs.py +79 -0
  194. agentex/lib/types/agent_results.py +29 -0
  195. agentex/lib/types/credentials.py +34 -0
  196. agentex/lib/types/fastacp.py +61 -0
  197. agentex/lib/types/files.py +13 -0
  198. agentex/lib/types/json_rpc.py +49 -0
  199. agentex/lib/types/llm_messages.py +354 -0
  200. agentex/lib/types/task_message_updates.py +171 -0
  201. agentex/lib/types/tracing.py +34 -0
  202. agentex/lib/utils/__init__.py +0 -0
  203. agentex/lib/utils/completions.py +131 -0
  204. agentex/lib/utils/console.py +14 -0
  205. agentex/lib/utils/io.py +29 -0
  206. agentex/lib/utils/iterables.py +14 -0
  207. agentex/lib/utils/json_schema.py +23 -0
  208. agentex/lib/utils/logging.py +31 -0
  209. agentex/lib/utils/mcp.py +17 -0
  210. agentex/lib/utils/model_utils.py +46 -0
  211. agentex/lib/utils/parsing.py +15 -0
  212. agentex/lib/utils/regex.py +6 -0
  213. agentex/lib/utils/temporal.py +13 -0
  214. agentex/py.typed +0 -0
  215. agentex/resources/__init__.py +103 -0
  216. agentex/resources/agents.py +707 -0
  217. agentex/resources/events.py +294 -0
  218. agentex/resources/messages/__init__.py +33 -0
  219. agentex/resources/messages/batch.py +271 -0
  220. agentex/resources/messages/messages.py +492 -0
  221. agentex/resources/spans.py +557 -0
  222. agentex/resources/states.py +544 -0
  223. agentex/resources/tasks.py +615 -0
  224. agentex/resources/tracker.py +384 -0
  225. agentex/types/__init__.py +56 -0
  226. agentex/types/acp_type.py +7 -0
  227. agentex/types/agent.py +29 -0
  228. agentex/types/agent_list_params.py +13 -0
  229. agentex/types/agent_list_response.py +10 -0
  230. agentex/types/agent_rpc_by_name_params.py +21 -0
  231. agentex/types/agent_rpc_params.py +51 -0
  232. agentex/types/agent_rpc_params1.py +21 -0
  233. agentex/types/agent_rpc_response.py +20 -0
  234. agentex/types/agent_rpc_result.py +90 -0
  235. agentex/types/agent_task_tracker.py +34 -0
  236. agentex/types/data_content.py +30 -0
  237. agentex/types/data_content_param.py +31 -0
  238. agentex/types/data_delta.py +14 -0
  239. agentex/types/event.py +29 -0
  240. agentex/types/event_list_params.py +22 -0
  241. agentex/types/event_list_response.py +10 -0
  242. agentex/types/message_author.py +7 -0
  243. agentex/types/message_create_params.py +18 -0
  244. agentex/types/message_list_params.py +14 -0
  245. agentex/types/message_list_response.py +10 -0
  246. agentex/types/message_style.py +7 -0
  247. agentex/types/message_update_params.py +18 -0
  248. agentex/types/messages/__init__.py +8 -0
  249. agentex/types/messages/batch_create_params.py +16 -0
  250. agentex/types/messages/batch_create_response.py +10 -0
  251. agentex/types/messages/batch_update_params.py +16 -0
  252. agentex/types/messages/batch_update_response.py +10 -0
  253. agentex/types/shared/__init__.py +3 -0
  254. agentex/types/shared/task_message_update.py +83 -0
  255. agentex/types/span.py +36 -0
  256. agentex/types/span_create_params.py +40 -0
  257. agentex/types/span_list_params.py +12 -0
  258. agentex/types/span_list_response.py +10 -0
  259. agentex/types/span_update_params.py +37 -0
  260. agentex/types/state.py +25 -0
  261. agentex/types/state_create_params.py +16 -0
  262. agentex/types/state_list_params.py +16 -0
  263. agentex/types/state_list_response.py +10 -0
  264. agentex/types/state_update_params.py +16 -0
  265. agentex/types/task.py +23 -0
  266. agentex/types/task_delete_by_name_response.py +8 -0
  267. agentex/types/task_delete_response.py +8 -0
  268. agentex/types/task_list_response.py +10 -0
  269. agentex/types/task_message.py +33 -0
  270. agentex/types/task_message_content.py +16 -0
  271. agentex/types/task_message_content_param.py +17 -0
  272. agentex/types/task_message_delta.py +16 -0
  273. agentex/types/text_content.py +53 -0
  274. agentex/types/text_content_param.py +54 -0
  275. agentex/types/text_delta.py +14 -0
  276. agentex/types/tool_request_content.py +36 -0
  277. agentex/types/tool_request_content_param.py +37 -0
  278. agentex/types/tool_request_delta.py +18 -0
  279. agentex/types/tool_response_content.py +36 -0
  280. agentex/types/tool_response_content_param.py +36 -0
  281. agentex/types/tool_response_delta.py +18 -0
  282. agentex/types/tracker_list_params.py +16 -0
  283. agentex/types/tracker_list_response.py +10 -0
  284. agentex/types/tracker_update_params.py +19 -0
  285. agentex_sdk-0.1.0.dist-info/METADATA +423 -0
  286. agentex_sdk-0.1.0.dist-info/RECORD +289 -0
  287. agentex_sdk-0.1.0.dist-info/WHEEL +4 -0
  288. agentex_sdk-0.1.0.dist-info/entry_points.txt +2 -0
  289. agentex_sdk-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,544 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Dict, Optional
6
+
7
+ import httpx
8
+
9
+ from ..types import state_list_params, state_create_params, state_update_params
10
+ from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11
+ from .._utils import maybe_transform, async_maybe_transform
12
+ from .._compat import cached_property
13
+ from .._resource import SyncAPIResource, AsyncAPIResource
14
+ from .._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from ..types.state import State
21
+ from .._base_client import make_request_options
22
+ from ..types.state_list_response import StateListResponse
23
+
24
+ __all__ = ["StatesResource", "AsyncStatesResource"]
25
+
26
+
27
+ class StatesResource(SyncAPIResource):
28
+ @cached_property
29
+ def with_raw_response(self) -> StatesResourceWithRawResponse:
30
+ """
31
+ This property can be used as a prefix for any HTTP method call to return
32
+ the raw response object instead of the parsed content.
33
+
34
+ For more information, see https://www.github.com/scaleapi/agentex-python#accessing-raw-response-data-eg-headers
35
+ """
36
+ return StatesResourceWithRawResponse(self)
37
+
38
+ @cached_property
39
+ def with_streaming_response(self) -> StatesResourceWithStreamingResponse:
40
+ """
41
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
42
+
43
+ For more information, see https://www.github.com/scaleapi/agentex-python#with_streaming_response
44
+ """
45
+ return StatesResourceWithStreamingResponse(self)
46
+
47
+ def create(
48
+ self,
49
+ *,
50
+ agent_id: str,
51
+ state: Dict[str, object],
52
+ task_id: str,
53
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
54
+ # The extra values given here take precedence over values defined on the client or passed to this method.
55
+ extra_headers: Headers | None = None,
56
+ extra_query: Query | None = None,
57
+ extra_body: Body | None = None,
58
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
59
+ ) -> State:
60
+ """
61
+ Create Task State
62
+
63
+ Args:
64
+ extra_headers: Send extra headers
65
+
66
+ extra_query: Add additional query parameters to the request
67
+
68
+ extra_body: Add additional JSON properties to the request
69
+
70
+ timeout: Override the client-level default timeout for this request, in seconds
71
+ """
72
+ return self._post(
73
+ "/states",
74
+ body=maybe_transform(
75
+ {
76
+ "agent_id": agent_id,
77
+ "state": state,
78
+ "task_id": task_id,
79
+ },
80
+ state_create_params.StateCreateParams,
81
+ ),
82
+ options=make_request_options(
83
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
84
+ ),
85
+ cast_to=State,
86
+ )
87
+
88
+ def retrieve(
89
+ self,
90
+ state_id: str,
91
+ *,
92
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
93
+ # The extra values given here take precedence over values defined on the client or passed to this method.
94
+ extra_headers: Headers | None = None,
95
+ extra_query: Query | None = None,
96
+ extra_body: Body | None = None,
97
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
98
+ ) -> State:
99
+ """
100
+ Get a state by its unique state ID.
101
+
102
+ Args:
103
+ extra_headers: Send extra headers
104
+
105
+ extra_query: Add additional query parameters to the request
106
+
107
+ extra_body: Add additional JSON properties to the request
108
+
109
+ timeout: Override the client-level default timeout for this request, in seconds
110
+ """
111
+ if not state_id:
112
+ raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}")
113
+ return self._get(
114
+ f"/states/{state_id}",
115
+ options=make_request_options(
116
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
117
+ ),
118
+ cast_to=State,
119
+ )
120
+
121
+ def update(
122
+ self,
123
+ state_id: str,
124
+ *,
125
+ agent_id: str,
126
+ state: Dict[str, object],
127
+ task_id: str,
128
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
129
+ # The extra values given here take precedence over values defined on the client or passed to this method.
130
+ extra_headers: Headers | None = None,
131
+ extra_query: Query | None = None,
132
+ extra_body: Body | None = None,
133
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
134
+ ) -> State:
135
+ """
136
+ Update Task State
137
+
138
+ Args:
139
+ extra_headers: Send extra headers
140
+
141
+ extra_query: Add additional query parameters to the request
142
+
143
+ extra_body: Add additional JSON properties to the request
144
+
145
+ timeout: Override the client-level default timeout for this request, in seconds
146
+ """
147
+ if not state_id:
148
+ raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}")
149
+ return self._put(
150
+ f"/states/{state_id}",
151
+ body=maybe_transform(
152
+ {
153
+ "agent_id": agent_id,
154
+ "state": state,
155
+ "task_id": task_id,
156
+ },
157
+ state_update_params.StateUpdateParams,
158
+ ),
159
+ options=make_request_options(
160
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
161
+ ),
162
+ cast_to=State,
163
+ )
164
+
165
+ def list(
166
+ self,
167
+ *,
168
+ agent_id: Optional[str] | NotGiven = NOT_GIVEN,
169
+ task_id: Optional[str] | NotGiven = NOT_GIVEN,
170
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
171
+ # The extra values given here take precedence over values defined on the client or passed to this method.
172
+ extra_headers: Headers | None = None,
173
+ extra_query: Query | None = None,
174
+ extra_body: Body | None = None,
175
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
176
+ ) -> StateListResponse:
177
+ """
178
+ List all states, optionally filtered by query parameters.
179
+
180
+ Args:
181
+ agent_id: Agent ID
182
+
183
+ task_id: Task ID
184
+
185
+ extra_headers: Send extra headers
186
+
187
+ extra_query: Add additional query parameters to the request
188
+
189
+ extra_body: Add additional JSON properties to the request
190
+
191
+ timeout: Override the client-level default timeout for this request, in seconds
192
+ """
193
+ return self._get(
194
+ "/states",
195
+ options=make_request_options(
196
+ extra_headers=extra_headers,
197
+ extra_query=extra_query,
198
+ extra_body=extra_body,
199
+ timeout=timeout,
200
+ query=maybe_transform(
201
+ {
202
+ "agent_id": agent_id,
203
+ "task_id": task_id,
204
+ },
205
+ state_list_params.StateListParams,
206
+ ),
207
+ ),
208
+ cast_to=StateListResponse,
209
+ )
210
+
211
+ def delete(
212
+ self,
213
+ state_id: str,
214
+ *,
215
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
216
+ # The extra values given here take precedence over values defined on the client or passed to this method.
217
+ extra_headers: Headers | None = None,
218
+ extra_query: Query | None = None,
219
+ extra_body: Body | None = None,
220
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
221
+ ) -> State:
222
+ """
223
+ Delete Task State
224
+
225
+ Args:
226
+ extra_headers: Send extra headers
227
+
228
+ extra_query: Add additional query parameters to the request
229
+
230
+ extra_body: Add additional JSON properties to the request
231
+
232
+ timeout: Override the client-level default timeout for this request, in seconds
233
+ """
234
+ if not state_id:
235
+ raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}")
236
+ return self._delete(
237
+ f"/states/{state_id}",
238
+ options=make_request_options(
239
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
240
+ ),
241
+ cast_to=State,
242
+ )
243
+
244
+
245
+ class AsyncStatesResource(AsyncAPIResource):
246
+ @cached_property
247
+ def with_raw_response(self) -> AsyncStatesResourceWithRawResponse:
248
+ """
249
+ This property can be used as a prefix for any HTTP method call to return
250
+ the raw response object instead of the parsed content.
251
+
252
+ For more information, see https://www.github.com/scaleapi/agentex-python#accessing-raw-response-data-eg-headers
253
+ """
254
+ return AsyncStatesResourceWithRawResponse(self)
255
+
256
+ @cached_property
257
+ def with_streaming_response(self) -> AsyncStatesResourceWithStreamingResponse:
258
+ """
259
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
260
+
261
+ For more information, see https://www.github.com/scaleapi/agentex-python#with_streaming_response
262
+ """
263
+ return AsyncStatesResourceWithStreamingResponse(self)
264
+
265
+ async def create(
266
+ self,
267
+ *,
268
+ agent_id: str,
269
+ state: Dict[str, object],
270
+ task_id: str,
271
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
272
+ # The extra values given here take precedence over values defined on the client or passed to this method.
273
+ extra_headers: Headers | None = None,
274
+ extra_query: Query | None = None,
275
+ extra_body: Body | None = None,
276
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
277
+ ) -> State:
278
+ """
279
+ Create Task State
280
+
281
+ Args:
282
+ extra_headers: Send extra headers
283
+
284
+ extra_query: Add additional query parameters to the request
285
+
286
+ extra_body: Add additional JSON properties to the request
287
+
288
+ timeout: Override the client-level default timeout for this request, in seconds
289
+ """
290
+ return await self._post(
291
+ "/states",
292
+ body=await async_maybe_transform(
293
+ {
294
+ "agent_id": agent_id,
295
+ "state": state,
296
+ "task_id": task_id,
297
+ },
298
+ state_create_params.StateCreateParams,
299
+ ),
300
+ options=make_request_options(
301
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
302
+ ),
303
+ cast_to=State,
304
+ )
305
+
306
+ async def retrieve(
307
+ self,
308
+ state_id: str,
309
+ *,
310
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
311
+ # The extra values given here take precedence over values defined on the client or passed to this method.
312
+ extra_headers: Headers | None = None,
313
+ extra_query: Query | None = None,
314
+ extra_body: Body | None = None,
315
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
316
+ ) -> State:
317
+ """
318
+ Get a state by its unique state ID.
319
+
320
+ Args:
321
+ extra_headers: Send extra headers
322
+
323
+ extra_query: Add additional query parameters to the request
324
+
325
+ extra_body: Add additional JSON properties to the request
326
+
327
+ timeout: Override the client-level default timeout for this request, in seconds
328
+ """
329
+ if not state_id:
330
+ raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}")
331
+ return await self._get(
332
+ f"/states/{state_id}",
333
+ options=make_request_options(
334
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
335
+ ),
336
+ cast_to=State,
337
+ )
338
+
339
+ async def update(
340
+ self,
341
+ state_id: str,
342
+ *,
343
+ agent_id: str,
344
+ state: Dict[str, object],
345
+ task_id: str,
346
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
347
+ # The extra values given here take precedence over values defined on the client or passed to this method.
348
+ extra_headers: Headers | None = None,
349
+ extra_query: Query | None = None,
350
+ extra_body: Body | None = None,
351
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
352
+ ) -> State:
353
+ """
354
+ Update Task State
355
+
356
+ Args:
357
+ extra_headers: Send extra headers
358
+
359
+ extra_query: Add additional query parameters to the request
360
+
361
+ extra_body: Add additional JSON properties to the request
362
+
363
+ timeout: Override the client-level default timeout for this request, in seconds
364
+ """
365
+ if not state_id:
366
+ raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}")
367
+ return await self._put(
368
+ f"/states/{state_id}",
369
+ body=await async_maybe_transform(
370
+ {
371
+ "agent_id": agent_id,
372
+ "state": state,
373
+ "task_id": task_id,
374
+ },
375
+ state_update_params.StateUpdateParams,
376
+ ),
377
+ options=make_request_options(
378
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
379
+ ),
380
+ cast_to=State,
381
+ )
382
+
383
+ async def list(
384
+ self,
385
+ *,
386
+ agent_id: Optional[str] | NotGiven = NOT_GIVEN,
387
+ task_id: Optional[str] | NotGiven = NOT_GIVEN,
388
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
389
+ # The extra values given here take precedence over values defined on the client or passed to this method.
390
+ extra_headers: Headers | None = None,
391
+ extra_query: Query | None = None,
392
+ extra_body: Body | None = None,
393
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
394
+ ) -> StateListResponse:
395
+ """
396
+ List all states, optionally filtered by query parameters.
397
+
398
+ Args:
399
+ agent_id: Agent ID
400
+
401
+ task_id: Task ID
402
+
403
+ extra_headers: Send extra headers
404
+
405
+ extra_query: Add additional query parameters to the request
406
+
407
+ extra_body: Add additional JSON properties to the request
408
+
409
+ timeout: Override the client-level default timeout for this request, in seconds
410
+ """
411
+ return await self._get(
412
+ "/states",
413
+ options=make_request_options(
414
+ extra_headers=extra_headers,
415
+ extra_query=extra_query,
416
+ extra_body=extra_body,
417
+ timeout=timeout,
418
+ query=await async_maybe_transform(
419
+ {
420
+ "agent_id": agent_id,
421
+ "task_id": task_id,
422
+ },
423
+ state_list_params.StateListParams,
424
+ ),
425
+ ),
426
+ cast_to=StateListResponse,
427
+ )
428
+
429
+ async def delete(
430
+ self,
431
+ state_id: str,
432
+ *,
433
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
434
+ # The extra values given here take precedence over values defined on the client or passed to this method.
435
+ extra_headers: Headers | None = None,
436
+ extra_query: Query | None = None,
437
+ extra_body: Body | None = None,
438
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
439
+ ) -> State:
440
+ """
441
+ Delete Task State
442
+
443
+ Args:
444
+ extra_headers: Send extra headers
445
+
446
+ extra_query: Add additional query parameters to the request
447
+
448
+ extra_body: Add additional JSON properties to the request
449
+
450
+ timeout: Override the client-level default timeout for this request, in seconds
451
+ """
452
+ if not state_id:
453
+ raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}")
454
+ return await self._delete(
455
+ f"/states/{state_id}",
456
+ options=make_request_options(
457
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
458
+ ),
459
+ cast_to=State,
460
+ )
461
+
462
+
463
+ class StatesResourceWithRawResponse:
464
+ def __init__(self, states: StatesResource) -> None:
465
+ self._states = states
466
+
467
+ self.create = to_raw_response_wrapper(
468
+ states.create,
469
+ )
470
+ self.retrieve = to_raw_response_wrapper(
471
+ states.retrieve,
472
+ )
473
+ self.update = to_raw_response_wrapper(
474
+ states.update,
475
+ )
476
+ self.list = to_raw_response_wrapper(
477
+ states.list,
478
+ )
479
+ self.delete = to_raw_response_wrapper(
480
+ states.delete,
481
+ )
482
+
483
+
484
+ class AsyncStatesResourceWithRawResponse:
485
+ def __init__(self, states: AsyncStatesResource) -> None:
486
+ self._states = states
487
+
488
+ self.create = async_to_raw_response_wrapper(
489
+ states.create,
490
+ )
491
+ self.retrieve = async_to_raw_response_wrapper(
492
+ states.retrieve,
493
+ )
494
+ self.update = async_to_raw_response_wrapper(
495
+ states.update,
496
+ )
497
+ self.list = async_to_raw_response_wrapper(
498
+ states.list,
499
+ )
500
+ self.delete = async_to_raw_response_wrapper(
501
+ states.delete,
502
+ )
503
+
504
+
505
+ class StatesResourceWithStreamingResponse:
506
+ def __init__(self, states: StatesResource) -> None:
507
+ self._states = states
508
+
509
+ self.create = to_streamed_response_wrapper(
510
+ states.create,
511
+ )
512
+ self.retrieve = to_streamed_response_wrapper(
513
+ states.retrieve,
514
+ )
515
+ self.update = to_streamed_response_wrapper(
516
+ states.update,
517
+ )
518
+ self.list = to_streamed_response_wrapper(
519
+ states.list,
520
+ )
521
+ self.delete = to_streamed_response_wrapper(
522
+ states.delete,
523
+ )
524
+
525
+
526
+ class AsyncStatesResourceWithStreamingResponse:
527
+ def __init__(self, states: AsyncStatesResource) -> None:
528
+ self._states = states
529
+
530
+ self.create = async_to_streamed_response_wrapper(
531
+ states.create,
532
+ )
533
+ self.retrieve = async_to_streamed_response_wrapper(
534
+ states.retrieve,
535
+ )
536
+ self.update = async_to_streamed_response_wrapper(
537
+ states.update,
538
+ )
539
+ self.list = async_to_streamed_response_wrapper(
540
+ states.list,
541
+ )
542
+ self.delete = async_to_streamed_response_wrapper(
543
+ states.delete,
544
+ )