opus-aaico 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 (54) hide show
  1. opus_aaico-0.1.0/.gitignore +32 -0
  2. opus_aaico-0.1.0/LICENSE +21 -0
  3. opus_aaico-0.1.0/PKG-INFO +136 -0
  4. opus_aaico-0.1.0/README.md +103 -0
  5. opus_aaico-0.1.0/examples/async_polling.py +26 -0
  6. opus_aaico-0.1.0/examples/error_handling.py +37 -0
  7. opus_aaico-0.1.0/examples/file_upload.py +18 -0
  8. opus_aaico-0.1.0/examples/quickstart.py +11 -0
  9. opus_aaico-0.1.0/examples/run_workflow.py +21 -0
  10. opus_aaico-0.1.0/pyproject.toml +66 -0
  11. opus_aaico-0.1.0/src/opus_aaico/__init__.py +32 -0
  12. opus_aaico-0.1.0/src/opus_aaico/_async.py +44 -0
  13. opus_aaico-0.1.0/src/opus_aaico/_client.py +288 -0
  14. opus_aaico-0.1.0/src/opus_aaico/_compat.py +13 -0
  15. opus_aaico-0.1.0/src/opus_aaico/_constants.py +7 -0
  16. opus_aaico-0.1.0/src/opus_aaico/_exceptions.py +125 -0
  17. opus_aaico-0.1.0/src/opus_aaico/_sync.py +48 -0
  18. opus_aaico-0.1.0/src/opus_aaico/_utils/__init__.py +0 -0
  19. opus_aaico-0.1.0/src/opus_aaico/_utils/files.py +42 -0
  20. opus_aaico-0.1.0/src/opus_aaico/_utils/polling.py +76 -0
  21. opus_aaico-0.1.0/src/opus_aaico/py.typed +0 -0
  22. opus_aaico-0.1.0/src/opus_aaico/resources/__init__.py +32 -0
  23. opus_aaico-0.1.0/src/opus_aaico/resources/_base.py +18 -0
  24. opus_aaico-0.1.0/src/opus_aaico/resources/api_keys.py +105 -0
  25. opus_aaico-0.1.0/src/opus_aaico/resources/credits.py +110 -0
  26. opus_aaico-0.1.0/src/opus_aaico/resources/files.py +304 -0
  27. opus_aaico-0.1.0/src/opus_aaico/resources/jobs.py +274 -0
  28. opus_aaico-0.1.0/src/opus_aaico/resources/policies.py +158 -0
  29. opus_aaico-0.1.0/src/opus_aaico/resources/reviews.py +216 -0
  30. opus_aaico-0.1.0/src/opus_aaico/resources/users.py +51 -0
  31. opus_aaico-0.1.0/src/opus_aaico/resources/workflows.py +419 -0
  32. opus_aaico-0.1.0/src/opus_aaico/types/__init__.py +155 -0
  33. opus_aaico-0.1.0/src/opus_aaico/types/api_keys.py +31 -0
  34. opus_aaico-0.1.0/src/opus_aaico/types/credits.py +28 -0
  35. opus_aaico-0.1.0/src/opus_aaico/types/enums.py +57 -0
  36. opus_aaico-0.1.0/src/opus_aaico/types/files.py +49 -0
  37. opus_aaico-0.1.0/src/opus_aaico/types/jobs.py +113 -0
  38. opus_aaico-0.1.0/src/opus_aaico/types/policies.py +55 -0
  39. opus_aaico-0.1.0/src/opus_aaico/types/reviews.py +42 -0
  40. opus_aaico-0.1.0/src/opus_aaico/types/shared.py +63 -0
  41. opus_aaico-0.1.0/src/opus_aaico/types/users.py +19 -0
  42. opus_aaico-0.1.0/src/opus_aaico/types/workflows.py +110 -0
  43. opus_aaico-0.1.0/tests/__init__.py +0 -0
  44. opus_aaico-0.1.0/tests/conftest.py +13 -0
  45. opus_aaico-0.1.0/tests/test_api_keys.py +162 -0
  46. opus_aaico-0.1.0/tests/test_client.py +174 -0
  47. opus_aaico-0.1.0/tests/test_credits.py +137 -0
  48. opus_aaico-0.1.0/tests/test_exceptions.py +77 -0
  49. opus_aaico-0.1.0/tests/test_files.py +202 -0
  50. opus_aaico-0.1.0/tests/test_jobs.py +214 -0
  51. opus_aaico-0.1.0/tests/test_policies.py +197 -0
  52. opus_aaico-0.1.0/tests/test_reviews.py +194 -0
  53. opus_aaico-0.1.0/tests/test_users.py +82 -0
  54. opus_aaico-0.1.0/tests/test_workflows.py +275 -0
@@ -0,0 +1,32 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ *.egg
6
+ dist/
7
+ build/
8
+ .eggs/
9
+
10
+ # Virtual environments
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # IDE
16
+ .idea/
17
+ .vscode/
18
+ *.swp
19
+ *.swo
20
+
21
+ # Testing
22
+ .pytest_cache/
23
+ .coverage
24
+ htmlcov/
25
+
26
+ # Linting
27
+ .ruff_cache/
28
+ .mypy_cache/
29
+
30
+ # OS
31
+ .DS_Store
32
+ Thumbs.db
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AAICO
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,136 @@
1
+ Metadata-Version: 2.4
2
+ Name: opus-aaico
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the OPUS workflow automation platform
5
+ Project-URL: Homepage, https://opus.com
6
+ Project-URL: Documentation, https://docs.opus.com/sdk/python
7
+ Project-URL: Repository, https://github.com/aaico/opus-aaico-python
8
+ Author-email: AAICO <support@aaico.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: aaico,ai,automation,opus,sdk,workflow
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.9
23
+ Requires-Dist: httpx<1,>=0.24
24
+ Requires-Dist: pydantic<3,>=2.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: build>=1.0; extra == 'dev'
27
+ Requires-Dist: mypy>=1.0; extra == 'dev'
28
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
29
+ Requires-Dist: pytest-httpx>=0.21; extra == 'dev'
30
+ Requires-Dist: pytest>=7.0; extra == 'dev'
31
+ Requires-Dist: ruff>=0.1; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # opus-aaico
35
+
36
+ Official Python SDK for the [OPUS](https://opus.com) workflow automation platform.
37
+
38
+ Features:
39
+ - Full coverage of all OPUS API endpoints (64 endpoints)
40
+ - Sync and async clients
41
+ - Type-safe with Pydantic models
42
+ - Automatic retry with exponential backoff
43
+ - High-level `workflows.run()` orchestrator
44
+
45
+ ## Installation
46
+
47
+ ```
48
+ pip install opus-aaico
49
+ ```
50
+
51
+ ## Quick Start
52
+
53
+ ```python
54
+ from opus_aaico import OpusClient
55
+
56
+ client = OpusClient(api_key="your-api-key")
57
+
58
+ # Run a workflow end-to-end (initiate -> execute -> poll -> results)
59
+ result = client.workflows.run(
60
+ workflow_id="wf-123",
61
+ payload={"query": {"value": "Analyze this", "type": "str"}},
62
+ )
63
+ print(result.outputs)
64
+ ```
65
+
66
+ ## Authentication
67
+
68
+ ```python
69
+ # Pass directly
70
+ client = OpusClient(api_key="sk-...")
71
+
72
+ # Or set environment variables
73
+ # OPUS_API_KEY=sk-...
74
+ # OPUS_WORKSPACE_ID=ws-... (optional)
75
+ # OPUS_BASE_URL=https://custom.opus.com (optional)
76
+ client = OpusClient()
77
+ ```
78
+
79
+ ## Resources
80
+
81
+ | Resource | Methods | Description |
82
+ |----------|---------|-------------|
83
+ | `client.workflows` | get, list, list_public, generate, run, share, send_email... | Workflow management + orchestration |
84
+ | `client.jobs` | initiate, execute, get_status, get_results, poll, search... | Job lifecycle management |
85
+ | `client.files` | upload, download, search, generate, multipart_upload... | File operations |
86
+ | `client.reviews` | initiate, list, get, pick, submit_result, submit_output... | Human review management |
87
+ | `client.api_keys` | create, list, rotate, revoke, delete... | API key management |
88
+ | `client.credits` | get_balance, get_usage, record_usage... | Credit tracking |
89
+ | `client.policies` | upload, list, get, get_summary, set_active... | Policy management |
90
+ | `client.users` | list, list_projects, get_projects | User & project lookups |
91
+
92
+ ## Async Usage
93
+
94
+ ```python
95
+ from opus_aaico import AsyncOpusClient
96
+
97
+ async with AsyncOpusClient(api_key="sk-...") as client:
98
+ result = await client.workflows.run("wf-123", payload={...})
99
+ ```
100
+
101
+ ## Error Handling
102
+
103
+ ```python
104
+ from opus_aaico import OpusClient, NotFoundError, RateLimitError, OpusError
105
+
106
+ try:
107
+ result = client.workflows.run("wf-123", payload={...})
108
+ except NotFoundError:
109
+ print("Workflow not found")
110
+ except RateLimitError as e:
111
+ print(f"Rate limited, retry after {e.retry_after}s")
112
+ except OpusError as e:
113
+ print(f"API error: {e.message}")
114
+ ```
115
+
116
+ ## Configuration
117
+
118
+ ```python
119
+ client = OpusClient(
120
+ api_key="sk-...",
121
+ workspace_id="ws-...",
122
+ base_url="https://operator.opus.com",
123
+ timeout=30.0,
124
+ max_retries=3,
125
+ )
126
+ ```
127
+
128
+ ## Requirements
129
+
130
+ - Python 3.9+
131
+ - httpx
132
+ - pydantic v2
133
+
134
+ ## License
135
+
136
+ MIT
@@ -0,0 +1,103 @@
1
+ # opus-aaico
2
+
3
+ Official Python SDK for the [OPUS](https://opus.com) workflow automation platform.
4
+
5
+ Features:
6
+ - Full coverage of all OPUS API endpoints (64 endpoints)
7
+ - Sync and async clients
8
+ - Type-safe with Pydantic models
9
+ - Automatic retry with exponential backoff
10
+ - High-level `workflows.run()` orchestrator
11
+
12
+ ## Installation
13
+
14
+ ```
15
+ pip install opus-aaico
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ ```python
21
+ from opus_aaico import OpusClient
22
+
23
+ client = OpusClient(api_key="your-api-key")
24
+
25
+ # Run a workflow end-to-end (initiate -> execute -> poll -> results)
26
+ result = client.workflows.run(
27
+ workflow_id="wf-123",
28
+ payload={"query": {"value": "Analyze this", "type": "str"}},
29
+ )
30
+ print(result.outputs)
31
+ ```
32
+
33
+ ## Authentication
34
+
35
+ ```python
36
+ # Pass directly
37
+ client = OpusClient(api_key="sk-...")
38
+
39
+ # Or set environment variables
40
+ # OPUS_API_KEY=sk-...
41
+ # OPUS_WORKSPACE_ID=ws-... (optional)
42
+ # OPUS_BASE_URL=https://custom.opus.com (optional)
43
+ client = OpusClient()
44
+ ```
45
+
46
+ ## Resources
47
+
48
+ | Resource | Methods | Description |
49
+ |----------|---------|-------------|
50
+ | `client.workflows` | get, list, list_public, generate, run, share, send_email... | Workflow management + orchestration |
51
+ | `client.jobs` | initiate, execute, get_status, get_results, poll, search... | Job lifecycle management |
52
+ | `client.files` | upload, download, search, generate, multipart_upload... | File operations |
53
+ | `client.reviews` | initiate, list, get, pick, submit_result, submit_output... | Human review management |
54
+ | `client.api_keys` | create, list, rotate, revoke, delete... | API key management |
55
+ | `client.credits` | get_balance, get_usage, record_usage... | Credit tracking |
56
+ | `client.policies` | upload, list, get, get_summary, set_active... | Policy management |
57
+ | `client.users` | list, list_projects, get_projects | User & project lookups |
58
+
59
+ ## Async Usage
60
+
61
+ ```python
62
+ from opus_aaico import AsyncOpusClient
63
+
64
+ async with AsyncOpusClient(api_key="sk-...") as client:
65
+ result = await client.workflows.run("wf-123", payload={...})
66
+ ```
67
+
68
+ ## Error Handling
69
+
70
+ ```python
71
+ from opus_aaico import OpusClient, NotFoundError, RateLimitError, OpusError
72
+
73
+ try:
74
+ result = client.workflows.run("wf-123", payload={...})
75
+ except NotFoundError:
76
+ print("Workflow not found")
77
+ except RateLimitError as e:
78
+ print(f"Rate limited, retry after {e.retry_after}s")
79
+ except OpusError as e:
80
+ print(f"API error: {e.message}")
81
+ ```
82
+
83
+ ## Configuration
84
+
85
+ ```python
86
+ client = OpusClient(
87
+ api_key="sk-...",
88
+ workspace_id="ws-...",
89
+ base_url="https://operator.opus.com",
90
+ timeout=30.0,
91
+ max_retries=3,
92
+ )
93
+ ```
94
+
95
+ ## Requirements
96
+
97
+ - Python 3.9+
98
+ - httpx
99
+ - pydantic v2
100
+
101
+ ## License
102
+
103
+ MIT
@@ -0,0 +1,26 @@
1
+ """Poll multiple jobs concurrently with async client."""
2
+ import asyncio
3
+
4
+ from opus_aaico import AsyncOpusClient
5
+
6
+
7
+ async def main():
8
+ async with AsyncOpusClient(api_key="your-api-key-here") as client:
9
+ # Run multiple workflows concurrently
10
+ tasks = [
11
+ client.workflows.run(
12
+ workflow_id="your-workflow-id",
13
+ payload={"query": {"value": f"Task {i}", "type": "str"}},
14
+ title=f"Concurrent Job {i}",
15
+ )
16
+ for i in range(5)
17
+ ]
18
+
19
+ results = await asyncio.gather(*tasks)
20
+
21
+ for i, result in enumerate(results):
22
+ print(f"Job {i}: {result.status} in {result.execution_time:.1f}s")
23
+
24
+
25
+ if __name__ == "__main__":
26
+ asyncio.run(main())
@@ -0,0 +1,37 @@
1
+ """Demonstrate error handling patterns."""
2
+ from opus_aaico import (
3
+ AuthenticationError,
4
+ NotFoundError,
5
+ OpusClient,
6
+ OpusError,
7
+ RateLimitError,
8
+ )
9
+
10
+ # Bad API key
11
+ try:
12
+ client = OpusClient(api_key="invalid-key")
13
+ client.workflows.get("wf-123")
14
+ except AuthenticationError:
15
+ print("Invalid API key")
16
+
17
+ # Workflow not found
18
+ try:
19
+ client = OpusClient(api_key="your-api-key-here")
20
+ client.workflows.get("nonexistent-workflow")
21
+ except NotFoundError:
22
+ print("Workflow not found")
23
+
24
+ # Rate limiting
25
+ try:
26
+ client = OpusClient(api_key="your-api-key-here")
27
+ # SDK automatically retries on 429, but if retries exhausted:
28
+ client.jobs.search()
29
+ except RateLimitError as e:
30
+ print(f"Rate limited. Retry after: {e.retry_after}s")
31
+
32
+ # Catch-all for any OPUS error
33
+ try:
34
+ client = OpusClient(api_key="your-api-key-here")
35
+ client.workflows.run("wf-123", payload={})
36
+ except OpusError as e:
37
+ print(f"OPUS error: {e.message} (status={e.status_code})")
@@ -0,0 +1,18 @@
1
+ """Upload a file and use it in a workflow."""
2
+ from opus_aaico import OpusClient
3
+
4
+ client = OpusClient(api_key="your-api-key-here")
5
+
6
+ # Upload a file (handles presigned URL flow automatically)
7
+ file_url = client.files.upload("./report.pdf")
8
+ print(f"Uploaded: {file_url}")
9
+
10
+ # Use the uploaded file in a workflow
11
+ result = client.workflows.run(
12
+ workflow_id="your-workflow-id",
13
+ payload={
14
+ "document": {"value": file_url, "type": "file"},
15
+ "query": {"value": "Summarize this report", "type": "str"},
16
+ },
17
+ )
18
+ print(f"Result: {result.outputs}")
@@ -0,0 +1,11 @@
1
+ """Quickstart -- get workflow details in 4 lines."""
2
+ from opus_aaico import OpusClient
3
+
4
+ client = OpusClient(api_key="your-api-key-here")
5
+
6
+ # Get workflow details
7
+ workflow = client.workflows.get("your-workflow-id")
8
+ print(f"Workflow: {workflow.name}")
9
+ print(f"Active: {workflow.active}")
10
+ if workflow.job_payload_schema:
11
+ print(f"Expected inputs: {list(workflow.job_payload_schema.keys())}")
@@ -0,0 +1,21 @@
1
+ """Run a workflow end-to-end with the high-level run() method."""
2
+ from opus_aaico import OpusClient
3
+
4
+ client = OpusClient(api_key="your-api-key-here")
5
+
6
+ # The run() method handles: initiate -> execute -> poll -> results
7
+ result = client.workflows.run(
8
+ workflow_id="your-workflow-id",
9
+ payload={
10
+ "query": {"value": "Analyze this document", "type": "str"},
11
+ },
12
+ title="My Analysis Job",
13
+ poll_interval=2.0, # Check every 2 seconds
14
+ timeout=300, # Wait up to 5 minutes
15
+ )
16
+
17
+ print(f"Status: {result.status}")
18
+ print(f"Job ID: {result.job_id}")
19
+ print(f"Execution time: {result.execution_time:.1f}s")
20
+ if result.outputs:
21
+ print(f"Outputs: {result.outputs}")
@@ -0,0 +1,66 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "opus-aaico"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for the OPUS workflow automation platform"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ { name = "AAICO", email = "support@aaico.com" },
14
+ ]
15
+ keywords = ["opus", "workflow", "automation", "ai", "sdk", "aaico"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Typing :: Typed",
27
+ ]
28
+ dependencies = [
29
+ "httpx>=0.24,<1",
30
+ "pydantic>=2.0,<3",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest>=7.0",
36
+ "pytest-asyncio>=0.21",
37
+ "pytest-httpx>=0.21",
38
+ "ruff>=0.1",
39
+ "mypy>=1.0",
40
+ "build>=1.0",
41
+ ]
42
+
43
+ [project.urls]
44
+ Homepage = "https://opus.com"
45
+ Documentation = "https://docs.opus.com/sdk/python"
46
+ Repository = "https://github.com/aaico/opus-aaico-python"
47
+
48
+ [tool.hatch.build.targets.wheel]
49
+ packages = ["src/opus_aaico"]
50
+
51
+ [tool.ruff]
52
+ target-version = "py39"
53
+ line-length = 100
54
+
55
+ [tool.ruff.lint]
56
+ select = ["E", "F", "I", "UP", "B"]
57
+
58
+ [tool.mypy]
59
+ python_version = "3.9"
60
+ strict = true
61
+ warn_return_any = true
62
+ warn_unused_configs = true
63
+
64
+ [tool.pytest.ini_options]
65
+ asyncio_mode = "auto"
66
+ testpaths = ["tests"]
@@ -0,0 +1,32 @@
1
+ """Official Python SDK for the OPUS workflow automation platform."""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ from opus_aaico._async import AsyncOpusClient
6
+ from opus_aaico._exceptions import (
7
+ APIError,
8
+ AuthenticationError,
9
+ ConnectionError,
10
+ NotFoundError,
11
+ OpusError,
12
+ PermissionDeniedError,
13
+ RateLimitError,
14
+ TimeoutError,
15
+ ValidationError,
16
+ )
17
+ from opus_aaico._sync import OpusClient
18
+
19
+ __all__ = [
20
+ "__version__",
21
+ "OpusClient",
22
+ "AsyncOpusClient",
23
+ "OpusError",
24
+ "AuthenticationError",
25
+ "PermissionDeniedError",
26
+ "NotFoundError",
27
+ "ValidationError",
28
+ "RateLimitError",
29
+ "APIError",
30
+ "TimeoutError",
31
+ "ConnectionError",
32
+ ]
@@ -0,0 +1,44 @@
1
+ """Asynchronous OPUS client."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ from opus_aaico._client import AsyncHTTPClient
8
+ from opus_aaico.resources.api_keys import AsyncApiKeys
9
+ from opus_aaico.resources.credits import AsyncCredits
10
+ from opus_aaico.resources.files import AsyncFiles
11
+ from opus_aaico.resources.jobs import AsyncJobs
12
+ from opus_aaico.resources.policies import AsyncPolicies
13
+ from opus_aaico.resources.reviews import AsyncReviews
14
+ from opus_aaico.resources.users import AsyncUsers
15
+ from opus_aaico.resources.workflows import AsyncWorkflows
16
+
17
+
18
+ class AsyncOpusClient:
19
+ """Asynchronous client for the OPUS API.
20
+
21
+ Usage:
22
+ async with AsyncOpusClient(api_key="sk-...") as client:
23
+ result = await client.workflows.run("wf-123", payload={...})
24
+ """
25
+
26
+ def __init__(self, **kwargs: Any) -> None:
27
+ self._http = AsyncHTTPClient(**kwargs)
28
+ self.jobs = AsyncJobs(self._http)
29
+ self.workflows = AsyncWorkflows(self._http, self.jobs)
30
+ self.files = AsyncFiles(self._http)
31
+ self.reviews = AsyncReviews(self._http)
32
+ self.api_keys = AsyncApiKeys(self._http)
33
+ self.credits = AsyncCredits(self._http)
34
+ self.policies = AsyncPolicies(self._http)
35
+ self.users = AsyncUsers(self._http)
36
+
37
+ async def close(self) -> None:
38
+ await self._http.close()
39
+
40
+ async def __aenter__(self) -> AsyncOpusClient:
41
+ return self
42
+
43
+ async def __aexit__(self, *args: Any) -> None:
44
+ await self.close()