cloudsway-agent 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. cloudsway_agent-1.0.0/LICENSE +21 -0
  2. cloudsway_agent-1.0.0/PKG-INFO +139 -0
  3. cloudsway_agent-1.0.0/README.md +111 -0
  4. cloudsway_agent-1.0.0/pyproject.toml +39 -0
  5. cloudsway_agent-1.0.0/setup.cfg +4 -0
  6. cloudsway_agent-1.0.0/src/agent_api/__init__.py +68 -0
  7. cloudsway_agent-1.0.0/src/agent_api/_http.py +392 -0
  8. cloudsway_agent-1.0.0/src/agent_api/_utils.py +32 -0
  9. cloudsway_agent-1.0.0/src/agent_api/_version.py +8 -0
  10. cloudsway_agent-1.0.0/src/agent_api/async_client.py +57 -0
  11. cloudsway_agent-1.0.0/src/agent_api/client.py +58 -0
  12. cloudsway_agent-1.0.0/src/agent_api/errors.py +167 -0
  13. cloudsway_agent-1.0.0/src/agent_api/local_functions.py +41 -0
  14. cloudsway_agent-1.0.0/src/agent_api/pagination.py +77 -0
  15. cloudsway_agent-1.0.0/src/agent_api/py.typed +1 -0
  16. cloudsway_agent-1.0.0/src/agent_api/resources/catalog.py +51 -0
  17. cloudsway_agent-1.0.0/src/agent_api/resources/responses.py +117 -0
  18. cloudsway_agent-1.0.0/src/agent_api/streaming.py +43 -0
  19. cloudsway_agent-1.0.0/src/agent_api/types/__init__.py +5 -0
  20. cloudsway_agent-1.0.0/src/agent_api/types/common.py +34 -0
  21. cloudsway_agent-1.0.0/src/agent_api/types/input.py +86 -0
  22. cloudsway_agent-1.0.0/src/agent_api/types/responses.py +114 -0
  23. cloudsway_agent-1.0.0/src/agent_api/types/streaming.py +70 -0
  24. cloudsway_agent-1.0.0/src/agent_api/types/tools.py +39 -0
  25. cloudsway_agent-1.0.0/src/cloudsway_agent.egg-info/PKG-INFO +139 -0
  26. cloudsway_agent-1.0.0/src/cloudsway_agent.egg-info/SOURCES.txt +31 -0
  27. cloudsway_agent-1.0.0/src/cloudsway_agent.egg-info/dependency_links.txt +1 -0
  28. cloudsway_agent-1.0.0/src/cloudsway_agent.egg-info/requires.txt +5 -0
  29. cloudsway_agent-1.0.0/src/cloudsway_agent.egg-info/top_level.txt +1 -0
  30. cloudsway_agent-1.0.0/tests/test_agent_api.py +438 -0
  31. cloudsway_agent-1.0.0/tests/test_integration.py +109 -0
  32. cloudsway_agent-1.0.0/tests/test_local_function_integration.py +98 -0
  33. cloudsway_agent-1.0.0/tests/test_local_functions.py +51 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AgentsWay
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: cloudsway-agent
3
+ Version: 1.0.0
4
+ Summary: Production Python SDK for the Managed Agent API
5
+ Author: AgentsWay
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/scalebox-dev/agent-api/tree/dev-core/sdk/python
8
+ Project-URL: Repository, https://github.com/scalebox-dev/agent-api
9
+ Project-URL: Issues, https://github.com/scalebox-dev/agent-api/issues
10
+ Project-URL: Changelog, https://github.com/scalebox-dev/agent-api/blob/dev-core/sdk/python/CHANGELOG.md
11
+ Keywords: cloudsway-agent,cloudsway,agentsway,llm,agent,responses-api
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: httpx>=0.24
24
+ Provides-Extra: dev
25
+ Requires-Dist: httpx>=0.24; extra == "dev"
26
+ Requires-Dist: build>=1.0; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # Python SDK
30
+
31
+ Production Python SDK for the Managed Agent API.
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ pip install cloudsway-agent
37
+ ```
38
+
39
+ For local development from this repository:
40
+
41
+ ```bash
42
+ cd sdk/python
43
+ pip install -e .
44
+ ```
45
+
46
+ ## Quick start
47
+
48
+ ```python
49
+ from agent_api import AgentAPI
50
+
51
+ client = AgentAPI(
52
+ api_key="sk-...",
53
+ base_url="https://api.agentsway.dev",
54
+ )
55
+
56
+ response = client.responses.create(
57
+ preset="pro-search",
58
+ input="What changed in AI this week?",
59
+ )
60
+ print(response["output_text"])
61
+ client.close()
62
+ ```
63
+
64
+ Environment variables `AGENT_API_KEY` and `AGENT_API_BASE_URL` are used by default.
65
+ The default base URL is `https://api.agentsway.dev` when neither argument nor env is set.
66
+ `AsyncAgentAPI` is available for async integrations.
67
+
68
+ ## Package layout
69
+
70
+ ```
71
+ src/agent_api/
72
+ client.py # synchronous AgentAPI
73
+ async_client.py # AsyncAgentAPI
74
+ errors.py # typed exceptions
75
+ pagination.py # cursor pagination
76
+ streaming.py # SSE parser
77
+ _http.py # retries, timeouts, User-Agent
78
+ resources/ # responses, models, presets, tools
79
+ types/ # TypedDict contracts
80
+ ```
81
+
82
+ ## Resources
83
+
84
+ | Resource | Methods |
85
+ |----------|---------|
86
+ | `client.responses` / `client.agent` | `create`, `list`, `list_page`, `list_iterator`, `retrieve`, `cancel`, `list_children`, `list_events` |
87
+ | `client.models` | `list` |
88
+ | `client.presets` | `list` |
89
+ | `client.tools` | `list` |
90
+
91
+ ## Production features
92
+
93
+ - **Retries:** exponential backoff for network failures, 429, and 5xx (default 2 retries).
94
+ - **Timeouts:** 10 minute default; 1 hour for streaming (override with `timeout` / `stream_timeout`).
95
+ - **Typed errors:** `AuthenticationError`, `RateLimitError`, `NotFoundError`, etc.
96
+ - **Pagination:** `list_page()` and `list_iterator()` for cursor-based history.
97
+
98
+ ```python
99
+ for item in client.responses.list_iterator(limit=20):
100
+ print(item["id"], item["status"])
101
+ ```
102
+
103
+ ## Streaming
104
+
105
+ ```python
106
+ for event in client.responses.create(
107
+ preset="fast-search",
108
+ input="Summarize today's AI news.",
109
+ stream=True,
110
+ ):
111
+ if event["type"] == "response.output_text.delta":
112
+ print(event.get("delta", ""), end="")
113
+ ```
114
+
115
+ ## Client options
116
+
117
+ ```python
118
+ client = AgentAPI(
119
+ api_key="sk-...",
120
+ base_url="https://api.agentsway.dev",
121
+ timeout=600.0,
122
+ stream_timeout=3600.0,
123
+ max_retries=2,
124
+ )
125
+ ```
126
+
127
+ ## Tests
128
+
129
+ ```bash
130
+ PYTHONPATH=src python -m unittest discover -s tests -p 'test_agent_api.py' -v
131
+ AGENT_API_INTEGRATION=1 AGENT_API_KEY=sk-... AGENT_API_BASE_URL=https://api.agentsway.dev \
132
+ PYTHONPATH=src python -m unittest tests.test_integration -v
133
+ ```
134
+
135
+ ## Scope
136
+
137
+ The SDK covers the public agent/Responses API and discovery endpoints. Console
138
+ auth, workspace administration, and internal audit records are intentionally
139
+ out of scope.
@@ -0,0 +1,111 @@
1
+ # Python SDK
2
+
3
+ Production Python SDK for the Managed Agent API.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install cloudsway-agent
9
+ ```
10
+
11
+ For local development from this repository:
12
+
13
+ ```bash
14
+ cd sdk/python
15
+ pip install -e .
16
+ ```
17
+
18
+ ## Quick start
19
+
20
+ ```python
21
+ from agent_api import AgentAPI
22
+
23
+ client = AgentAPI(
24
+ api_key="sk-...",
25
+ base_url="https://api.agentsway.dev",
26
+ )
27
+
28
+ response = client.responses.create(
29
+ preset="pro-search",
30
+ input="What changed in AI this week?",
31
+ )
32
+ print(response["output_text"])
33
+ client.close()
34
+ ```
35
+
36
+ Environment variables `AGENT_API_KEY` and `AGENT_API_BASE_URL` are used by default.
37
+ The default base URL is `https://api.agentsway.dev` when neither argument nor env is set.
38
+ `AsyncAgentAPI` is available for async integrations.
39
+
40
+ ## Package layout
41
+
42
+ ```
43
+ src/agent_api/
44
+ client.py # synchronous AgentAPI
45
+ async_client.py # AsyncAgentAPI
46
+ errors.py # typed exceptions
47
+ pagination.py # cursor pagination
48
+ streaming.py # SSE parser
49
+ _http.py # retries, timeouts, User-Agent
50
+ resources/ # responses, models, presets, tools
51
+ types/ # TypedDict contracts
52
+ ```
53
+
54
+ ## Resources
55
+
56
+ | Resource | Methods |
57
+ |----------|---------|
58
+ | `client.responses` / `client.agent` | `create`, `list`, `list_page`, `list_iterator`, `retrieve`, `cancel`, `list_children`, `list_events` |
59
+ | `client.models` | `list` |
60
+ | `client.presets` | `list` |
61
+ | `client.tools` | `list` |
62
+
63
+ ## Production features
64
+
65
+ - **Retries:** exponential backoff for network failures, 429, and 5xx (default 2 retries).
66
+ - **Timeouts:** 10 minute default; 1 hour for streaming (override with `timeout` / `stream_timeout`).
67
+ - **Typed errors:** `AuthenticationError`, `RateLimitError`, `NotFoundError`, etc.
68
+ - **Pagination:** `list_page()` and `list_iterator()` for cursor-based history.
69
+
70
+ ```python
71
+ for item in client.responses.list_iterator(limit=20):
72
+ print(item["id"], item["status"])
73
+ ```
74
+
75
+ ## Streaming
76
+
77
+ ```python
78
+ for event in client.responses.create(
79
+ preset="fast-search",
80
+ input="Summarize today's AI news.",
81
+ stream=True,
82
+ ):
83
+ if event["type"] == "response.output_text.delta":
84
+ print(event.get("delta", ""), end="")
85
+ ```
86
+
87
+ ## Client options
88
+
89
+ ```python
90
+ client = AgentAPI(
91
+ api_key="sk-...",
92
+ base_url="https://api.agentsway.dev",
93
+ timeout=600.0,
94
+ stream_timeout=3600.0,
95
+ max_retries=2,
96
+ )
97
+ ```
98
+
99
+ ## Tests
100
+
101
+ ```bash
102
+ PYTHONPATH=src python -m unittest discover -s tests -p 'test_agent_api.py' -v
103
+ AGENT_API_INTEGRATION=1 AGENT_API_KEY=sk-... AGENT_API_BASE_URL=https://api.agentsway.dev \
104
+ PYTHONPATH=src python -m unittest tests.test_integration -v
105
+ ```
106
+
107
+ ## Scope
108
+
109
+ The SDK covers the public agent/Responses API and discovery endpoints. Console
110
+ auth, workspace administration, and internal audit records are intentionally
111
+ out of scope.
@@ -0,0 +1,39 @@
1
+ [project]
2
+ name = "cloudsway-agent"
3
+ version = "1.0.0"
4
+ description = "Production Python SDK for the Managed Agent API"
5
+ requires-python = ">=3.10"
6
+ dependencies = ["httpx>=0.24"]
7
+ readme = "README.md"
8
+ license = { text = "MIT" }
9
+ authors = [{ name = "AgentsWay" }]
10
+ keywords = ["cloudsway-agent", "cloudsway", "agentsway", "llm", "agent", "responses-api"]
11
+ classifiers = [
12
+ "Development Status :: 5 - Production/Stable",
13
+ "Intended Audience :: Developers",
14
+ "License :: OSI Approved :: MIT License",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.10",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Typing :: Typed",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/scalebox-dev/agent-api/tree/dev-core/sdk/python"
24
+ Repository = "https://github.com/scalebox-dev/agent-api"
25
+ Issues = "https://github.com/scalebox-dev/agent-api/issues"
26
+ Changelog = "https://github.com/scalebox-dev/agent-api/blob/dev-core/sdk/python/CHANGELOG.md"
27
+
28
+ [project.optional-dependencies]
29
+ dev = ["httpx>=0.24", "build>=1.0"]
30
+
31
+ [build-system]
32
+ requires = ["setuptools>=68"]
33
+ build-backend = "setuptools.build_meta"
34
+
35
+ [tool.setuptools.packages.find]
36
+ where = ["src"]
37
+
38
+ [tool.setuptools.package-data]
39
+ agent_api = ["py.typed"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,68 @@
1
+ """Production Python SDK for the Managed Agent API."""
2
+
3
+ from agent_api._version import (
4
+ DEFAULT_MAX_RETRIES,
5
+ DEFAULT_STREAM_TIMEOUT,
6
+ DEFAULT_TIMEOUT,
7
+ USER_AGENT,
8
+ __version__,
9
+ )
10
+ from agent_api.async_client import AsyncAgentAPI
11
+ from agent_api.client import AgentAPI
12
+ from agent_api.errors import (
13
+ APIConnectionError,
14
+ APIError,
15
+ APIStatusError,
16
+ AuthenticationError,
17
+ BadRequestError,
18
+ InternalServerError,
19
+ NotFoundError,
20
+ PermissionDeniedError,
21
+ RateLimitError,
22
+ is_retryable_status,
23
+ parse_response_error,
24
+ )
25
+ from agent_api.local_functions import (
26
+ function_call_output_input,
27
+ pending_function_calls,
28
+ run_local_function_handlers,
29
+ )
30
+ from agent_api.pagination import AsyncPage, Page, PageResult
31
+ from agent_api.types import *
32
+
33
+ __all__ = [
34
+ "AgentAPI",
35
+ "AsyncAgentAPI",
36
+ "APIError",
37
+ "APIConnectionError",
38
+ "APIStatusError",
39
+ "AuthenticationError",
40
+ "BadRequestError",
41
+ "InternalServerError",
42
+ "NotFoundError",
43
+ "PermissionDeniedError",
44
+ "RateLimitError",
45
+ "Page",
46
+ "AsyncPage",
47
+ "PageResult",
48
+ "AgentCapabilityPreference",
49
+ "AgentResponse",
50
+ "Model",
51
+ "ModelCapabilities",
52
+ "Preset",
53
+ "PublicTool",
54
+ "ResponseCreateParams",
55
+ "ResponseStreamEvent",
56
+ "ResponseStatus",
57
+ "ToolInvocationResult",
58
+ "DEFAULT_MAX_RETRIES",
59
+ "DEFAULT_STREAM_TIMEOUT",
60
+ "DEFAULT_TIMEOUT",
61
+ "USER_AGENT",
62
+ "is_retryable_status",
63
+ "parse_response_error",
64
+ "function_call_output_input",
65
+ "pending_function_calls",
66
+ "run_local_function_handlers",
67
+ "__version__",
68
+ ]