apex-ai-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.
@@ -0,0 +1,5 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .mypy_cache/
4
+ dist/
5
+ *.egg-info/
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: apex-ai-sdk
3
+ Version: 0.1.0
4
+ Summary: Python client for the Apex AI Platform API.
5
+ Project-URL: Repository, https://github.com/punarduttrajput/Apex
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown
9
+
10
+ # apex-ai-sdk
11
+
12
+ A Python client for the [Apex AI Platform](../../README.md) HTTP API,
13
+ hand-written from the actual `apex-server` routes (see
14
+ [`docs/09-api/openapi.yaml`](../../docs/09-api/openapi.yaml) for the full
15
+ contract) — the same source [`sdks/typescript`](../typescript) was generated
16
+ from, so the two clients cover identical ground.
17
+
18
+ Zero runtime dependencies: the HTTP layer is built on `urllib` from the
19
+ standard library rather than `requests`/`httpx`, so there's nothing to
20
+ install to use it.
21
+
22
+ ## Install
23
+
24
+ Not yet published; consume from the repo directly (path dependency, or copy
25
+ `apex_sdk/` into your project) until it ships to PyPI.
26
+
27
+ ## Usage
28
+
29
+ ```python
30
+ from apex_sdk import ApexClient
31
+
32
+ client = ApexClient(
33
+ "http://127.0.0.1:8080",
34
+ tenant="acme", # optional, defaults to the server's "default" tenant
35
+ principal="alice", # optional
36
+ )
37
+
38
+ result = client.agents.run({"manifest": my_agent_yaml, "input": {"message": "Hi"}})
39
+ print(result["output"]["message"])
40
+
41
+ # Streaming:
42
+ for frame in client.agents.stream({"manifest": my_agent_yaml, "input": {}}):
43
+ if frame["type"] == "delta":
44
+ print(frame["text"], end="")
45
+ if frame["type"] == "result":
46
+ print("\ndone:", frame["output"]["message"])
47
+ ```
48
+
49
+ Every resource is namespaced on the client: `client.agents`, `client.workflows`,
50
+ `client.memory`, `client.plugins`, `client.marketplace`, `client.secrets`,
51
+ `client.organizations`, `client.projects`, `client.webhooks`, `client.audit`,
52
+ `client.tools`.
53
+
54
+ Errors are raised as `ApexApiError` (`.status`, `.code`, `.request_id`, `.body`)
55
+ mapping the server's `{error: {...}}` envelope.
56
+
57
+ Pagination: every list method returns a `Page` dict (`data`/`has_more`/
58
+ `next_cursor`/`total_estimate`); `paginate_all` drains every page:
59
+
60
+ ```python
61
+ from apex_sdk import paginate_all
62
+
63
+ for agent_id in paginate_all(client.agents.list, limit=25):
64
+ ...
65
+ ```
66
+
67
+ ## Development
68
+
69
+ No package manager is required to run this SDK — it's stdlib-only. To run
70
+ the tests:
71
+
72
+ ```bash
73
+ cargo run -p apex-cli -- dev --addr 127.0.0.1:8080 &
74
+ python3 -m unittest discover -s tests -v
75
+ ```
76
+
77
+ Tests are integration tests against a real, locally running server (skip
78
+ cleanly, not failing, if `APEX_TEST_BASE_URL` — default
79
+ `http://127.0.0.1:8080` — is unreachable), plus a handful of unit tests for
80
+ the retry/backoff logic against a fake opener (no socket).
81
+
82
+ One test (`test_projects_create_with_stale_if_match_is_rejected`) exercises
83
+ organization/project creation, which — unlike agents/workflows/memory — has no
84
+ anonymous-default-tenant back-compat bypass; it needs a real `org.admin` role.
85
+ Start the server with `APEX_PLATFORM_ADMINS=sdk-test-admin` for that test to
86
+ run instead of skip.
87
+
88
+ ## Known gaps (v0.1 of this SDK)
89
+
90
+ - Synchronous only — no `asyncio` client.
91
+ - No `redocly`-style contract test wired against `openapi.yaml` (the
92
+ TypeScript SDK's `npm test` runs one; this package has no npm-equivalent
93
+ tool available in this environment to wire the same check to).
94
+ - Not published to PyPI yet.
@@ -0,0 +1,85 @@
1
+ # apex-ai-sdk
2
+
3
+ A Python client for the [Apex AI Platform](../../README.md) HTTP API,
4
+ hand-written from the actual `apex-server` routes (see
5
+ [`docs/09-api/openapi.yaml`](../../docs/09-api/openapi.yaml) for the full
6
+ contract) — the same source [`sdks/typescript`](../typescript) was generated
7
+ from, so the two clients cover identical ground.
8
+
9
+ Zero runtime dependencies: the HTTP layer is built on `urllib` from the
10
+ standard library rather than `requests`/`httpx`, so there's nothing to
11
+ install to use it.
12
+
13
+ ## Install
14
+
15
+ Not yet published; consume from the repo directly (path dependency, or copy
16
+ `apex_sdk/` into your project) until it ships to PyPI.
17
+
18
+ ## Usage
19
+
20
+ ```python
21
+ from apex_sdk import ApexClient
22
+
23
+ client = ApexClient(
24
+ "http://127.0.0.1:8080",
25
+ tenant="acme", # optional, defaults to the server's "default" tenant
26
+ principal="alice", # optional
27
+ )
28
+
29
+ result = client.agents.run({"manifest": my_agent_yaml, "input": {"message": "Hi"}})
30
+ print(result["output"]["message"])
31
+
32
+ # Streaming:
33
+ for frame in client.agents.stream({"manifest": my_agent_yaml, "input": {}}):
34
+ if frame["type"] == "delta":
35
+ print(frame["text"], end="")
36
+ if frame["type"] == "result":
37
+ print("\ndone:", frame["output"]["message"])
38
+ ```
39
+
40
+ Every resource is namespaced on the client: `client.agents`, `client.workflows`,
41
+ `client.memory`, `client.plugins`, `client.marketplace`, `client.secrets`,
42
+ `client.organizations`, `client.projects`, `client.webhooks`, `client.audit`,
43
+ `client.tools`.
44
+
45
+ Errors are raised as `ApexApiError` (`.status`, `.code`, `.request_id`, `.body`)
46
+ mapping the server's `{error: {...}}` envelope.
47
+
48
+ Pagination: every list method returns a `Page` dict (`data`/`has_more`/
49
+ `next_cursor`/`total_estimate`); `paginate_all` drains every page:
50
+
51
+ ```python
52
+ from apex_sdk import paginate_all
53
+
54
+ for agent_id in paginate_all(client.agents.list, limit=25):
55
+ ...
56
+ ```
57
+
58
+ ## Development
59
+
60
+ No package manager is required to run this SDK — it's stdlib-only. To run
61
+ the tests:
62
+
63
+ ```bash
64
+ cargo run -p apex-cli -- dev --addr 127.0.0.1:8080 &
65
+ python3 -m unittest discover -s tests -v
66
+ ```
67
+
68
+ Tests are integration tests against a real, locally running server (skip
69
+ cleanly, not failing, if `APEX_TEST_BASE_URL` — default
70
+ `http://127.0.0.1:8080` — is unreachable), plus a handful of unit tests for
71
+ the retry/backoff logic against a fake opener (no socket).
72
+
73
+ One test (`test_projects_create_with_stale_if_match_is_rejected`) exercises
74
+ organization/project creation, which — unlike agents/workflows/memory — has no
75
+ anonymous-default-tenant back-compat bypass; it needs a real `org.admin` role.
76
+ Start the server with `APEX_PLATFORM_ADMINS=sdk-test-admin` for that test to
77
+ run instead of skip.
78
+
79
+ ## Known gaps (v0.1 of this SDK)
80
+
81
+ - Synchronous only — no `asyncio` client.
82
+ - No `redocly`-style contract test wired against `openapi.yaml` (the
83
+ TypeScript SDK's `npm test` runs one; this package has no npm-equivalent
84
+ tool available in this environment to wire the same check to).
85
+ - Not published to PyPI yet.
@@ -0,0 +1,13 @@
1
+ from .client import ApexClient
2
+ from .errors import ApexApiError
3
+ from .http import RetryOptions
4
+ from .pagination import paginate_all
5
+ from .sse import SseFrame
6
+
7
+ __all__ = [
8
+ "ApexClient",
9
+ "ApexApiError",
10
+ "RetryOptions",
11
+ "paginate_all",
12
+ "SseFrame",
13
+ ]