ko-tasks-sdk 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 (175) hide show
  1. ko_tasks_sdk-1.0.0/.gitignore +82 -0
  2. ko_tasks_sdk-1.0.0/PKG-INFO +164 -0
  3. ko_tasks_sdk-1.0.0/README.md +123 -0
  4. ko_tasks_sdk-1.0.0/pyproject.toml +71 -0
  5. ko_tasks_sdk-1.0.0/src/komus_tasks/__init__.py +16 -0
  6. ko_tasks_sdk-1.0.0/src/komus_tasks/agent/__init__.py +20 -0
  7. ko_tasks_sdk-1.0.0/src/komus_tasks/agent/__main__.py +114 -0
  8. ko_tasks_sdk-1.0.0/src/komus_tasks/agent/client.py +385 -0
  9. ko_tasks_sdk-1.0.0/src/komus_tasks/agent/provisioner.py +261 -0
  10. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/__init__.py +14 -0
  11. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/__main__.py +5 -0
  12. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ai/__init__.py +0 -0
  13. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ai/llm.py +268 -0
  14. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ai/prompts/system_prompt.md +20 -0
  15. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/app.py +143 -0
  16. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/__init__.py +70 -0
  17. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/activate.py +63 -0
  18. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/agents.py +114 -0
  19. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/artifacts.py +201 -0
  20. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/completion.py +40 -0
  21. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/config.py +193 -0
  22. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/config_remote.py +215 -0
  23. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/credentials.py +224 -0
  24. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/deactivate.py +55 -0
  25. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/delete.py +57 -0
  26. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/deploy.py +135 -0
  27. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/download.py +55 -0
  28. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/environments.py +333 -0
  29. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/files.py +89 -0
  30. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/generate.py +557 -0
  31. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/init.py +98 -0
  32. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/list.py +42 -0
  33. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/local.py +78 -0
  34. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/logs.py +81 -0
  35. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/long_running.py +114 -0
  36. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/package.py +42 -0
  37. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/profile.py +78 -0
  38. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/promote.py +50 -0
  39. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/rollback.py +46 -0
  40. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/run.py +231 -0
  41. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/schedules.py +271 -0
  42. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/schema_cmd.py +30 -0
  43. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/skills.py +288 -0
  44. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/status.py +50 -0
  45. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/threads.py +221 -0
  46. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/commands/webhooks.py +399 -0
  47. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/permissions/agents.md +19 -0
  48. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/permissions/claude.md +31 -0
  49. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/permissions/codex.md +22 -0
  50. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/permissions/cursor.md +16 -0
  51. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/__init__.py +1 -0
  52. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/context.py +102 -0
  53. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/discovery.py +54 -0
  54. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/errors.py +55 -0
  55. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/http.py +200 -0
  56. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/inputs.py +51 -0
  57. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/metadata.py +124 -0
  58. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/output.py +106 -0
  59. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/profile.py +189 -0
  60. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/remote.py +61 -0
  61. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/resolver.py +82 -0
  62. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/tty.py +31 -0
  63. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/runtime/validation.py +479 -0
  64. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/scaffolding/__init__.py +1 -0
  65. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/scaffolding/gitignore.py +45 -0
  66. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/scaffolding/node.py +150 -0
  67. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/scaffolding/python.py +214 -0
  68. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schema.py +52 -0
  69. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/__init__.py +1 -0
  70. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/activate.py +11 -0
  71. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/agents.py +40 -0
  72. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/artifact.py +41 -0
  73. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/common.py +13 -0
  74. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/config.py +17 -0
  75. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/config_remote.py +19 -0
  76. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/credentials.py +30 -0
  77. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/deploy.py +16 -0
  78. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/environments.py +43 -0
  79. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/files.py +26 -0
  80. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/generate.py +42 -0
  81. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/init.py +10 -0
  82. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/local_result.py +14 -0
  83. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/log_event.py +15 -0
  84. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/long_running.py +28 -0
  85. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/package.py +8 -0
  86. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/page.py +23 -0
  87. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/profile.py +11 -0
  88. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/promote.py +11 -0
  89. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/run.py +9 -0
  90. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/schedule.py +47 -0
  91. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/skills.py +27 -0
  92. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/status.py +47 -0
  93. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/task_list.py +12 -0
  94. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/tasks_admin.py +20 -0
  95. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/schemas/webhooks.py +50 -0
  96. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ui/__init__.py +1 -0
  97. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ui/prompts.py +153 -0
  98. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ui/theme.py +31 -0
  99. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ui/widgets.py +40 -0
  100. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ui/writer.py +68 -0
  101. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ui_commands/__init__.py +1 -0
  102. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ui_commands/dashboard.py +578 -0
  103. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ui_commands/generate.py +153 -0
  104. ko_tasks_sdk-1.0.0/src/komus_tasks/cli/ui_commands/monitor.py +170 -0
  105. ko_tasks_sdk-1.0.0/src/komus_tasks/context.py +409 -0
  106. ko_tasks_sdk-1.0.0/src/komus_tasks/decorators.py +136 -0
  107. ko_tasks_sdk-1.0.0/src/komus_tasks/errors.py +74 -0
  108. ko_tasks_sdk-1.0.0/src/komus_tasks/exceptions.py +20 -0
  109. ko_tasks_sdk-1.0.0/src/komus_tasks/logging.py +196 -0
  110. ko_tasks_sdk-1.0.0/src/komus_tasks/models/__init__.py +64 -0
  111. ko_tasks_sdk-1.0.0/src/komus_tasks/models/artifact.py +106 -0
  112. ko_tasks_sdk-1.0.0/src/komus_tasks/models/artifact_download_response.py +13 -0
  113. ko_tasks_sdk-1.0.0/src/komus_tasks/models/artifact_list_response.py +16 -0
  114. ko_tasks_sdk-1.0.0/src/komus_tasks/models/artifact_query_filters.py +18 -0
  115. ko_tasks_sdk-1.0.0/src/komus_tasks/models/artifact_schema.py +198 -0
  116. ko_tasks_sdk-1.0.0/src/komus_tasks/models/credential.py +141 -0
  117. ko_tasks_sdk-1.0.0/src/komus_tasks/models/environment.py +230 -0
  118. ko_tasks_sdk-1.0.0/src/komus_tasks/models/file_upload.py +56 -0
  119. ko_tasks_sdk-1.0.0/src/komus_tasks/models/log_models.py +213 -0
  120. ko_tasks_sdk-1.0.0/src/komus_tasks/models/pagination.py +22 -0
  121. ko_tasks_sdk-1.0.0/src/komus_tasks/models/schedule.py +252 -0
  122. ko_tasks_sdk-1.0.0/src/komus_tasks/models/settings.py +80 -0
  123. ko_tasks_sdk-1.0.0/src/komus_tasks/models/task_definition.py +216 -0
  124. ko_tasks_sdk-1.0.0/src/komus_tasks/models/thread.py +107 -0
  125. ko_tasks_sdk-1.0.0/src/komus_tasks/models/thread_create_request.py +65 -0
  126. ko_tasks_sdk-1.0.0/src/komus_tasks/models/thread_error.py +16 -0
  127. ko_tasks_sdk-1.0.0/src/komus_tasks/models/thread_list_response.py +21 -0
  128. ko_tasks_sdk-1.0.0/src/komus_tasks/models/thread_query_filters.py +83 -0
  129. ko_tasks_sdk-1.0.0/src/komus_tasks/models/thread_retry_request.py +12 -0
  130. ko_tasks_sdk-1.0.0/src/komus_tasks/models/webhook.py +287 -0
  131. ko_tasks_sdk-1.0.0/src/komus_tasks/models/webhook_scoping.py +39 -0
  132. ko_tasks_sdk-1.0.0/src/komus_tasks/observability.py +110 -0
  133. ko_tasks_sdk-1.0.0/src/komus_tasks/observability_otlp.py +10 -0
  134. ko_tasks_sdk-1.0.0/src/komus_tasks/protocols/__init__.py +19 -0
  135. ko_tasks_sdk-1.0.0/src/komus_tasks/protocols/artifact_publisher.py +58 -0
  136. ko_tasks_sdk-1.0.0/src/komus_tasks/protocols/log_configurator.py +56 -0
  137. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/manage-komus-server/SKILL.md +146 -0
  138. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/manage-komus-server/references/commands.md +121 -0
  139. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/manage-komus-server/references/permissions/agents.md +27 -0
  140. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/manage-komus-server/references/permissions/claude.md +16 -0
  141. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/manage-komus-server/references/permissions/codex.md +30 -0
  142. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/manage-komus-server/references/permissions/cursor.md +26 -0
  143. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/manage-komus-server/references/workflows.md +210 -0
  144. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/SKILL.md +94 -0
  145. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/configuration.md +39 -0
  146. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/example-node/input.json +1 -0
  147. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/example-node/task.ts +62 -0
  148. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/example-node/task.yaml +20 -0
  149. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/example-python/input.json +1 -0
  150. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/example-python/task.py +57 -0
  151. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/example-python/task.yaml +20 -0
  152. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/inputs-and-outputs.md +47 -0
  153. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/long-running.md +38 -0
  154. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/packaging.md +52 -0
  155. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/spans.md +56 -0
  156. ko_tasks_sdk-1.0.0/src/komus_tasks/skills/write-komus-task/references/task-contract.md +263 -0
  157. ko_tasks_sdk-1.0.0/src/komus_tasks/testing/__init__.py +21 -0
  158. ko_tasks_sdk-1.0.0/src/komus_tasks/testing/local_context.py +205 -0
  159. ko_tasks_sdk-1.0.0/src/komus_tasks/testing/local_runner.py +436 -0
  160. ko_tasks_sdk-1.0.0/src/komus_tasks/testing/run_result.py +58 -0
  161. ko_tasks_sdk-1.0.0/src/komus_tasks/thread_state.py +17 -0
  162. ko_tasks_sdk-1.0.0/src/komus_tasks/utils/__init__.py +2 -0
  163. ko_tasks_sdk-1.0.0/src/komus_tasks/utils/artifact_validation.py +157 -0
  164. ko_tasks_sdk-1.0.0/src/komus_tasks/utils/id_generator.py +66 -0
  165. ko_tasks_sdk-1.0.0/src/komus_tasks/utils/ref_filtering.py +34 -0
  166. ko_tasks_sdk-1.0.0/src/komus_tasks/utils/sha256.py +55 -0
  167. ko_tasks_sdk-1.0.0/src/komus_tasks/utils/task_packaging.py +909 -0
  168. ko_tasks_sdk-1.0.0/src/komus_tasks/version.py +52 -0
  169. ko_tasks_sdk-1.0.0/src/komus_tasks/worker/__init__.py +8 -0
  170. ko_tasks_sdk-1.0.0/src/komus_tasks/worker/__main__.py +49 -0
  171. ko_tasks_sdk-1.0.0/src/komus_tasks/worker/context.py +247 -0
  172. ko_tasks_sdk-1.0.0/src/komus_tasks/worker/node-runner.js +542 -0
  173. ko_tasks_sdk-1.0.0/src/komus_tasks/worker/protocol.py +269 -0
  174. ko_tasks_sdk-1.0.0/src/komus_tasks/worker/runner.py +689 -0
  175. ko_tasks_sdk-1.0.0/src/komus_tasks/worker/worker-context.js +152 -0
@@ -0,0 +1,82 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ *.egg
7
+ dist/
8
+ build/
9
+ .eggs/
10
+ *.whl
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # IDE
18
+ .vscode/
19
+ .idea/
20
+ *.swp
21
+ *.swo
22
+ *~
23
+
24
+ # Node
25
+ node_modules/
26
+ npm-debug.log*
27
+
28
+ # OS
29
+ .DS_Store
30
+ Thumbs.db
31
+
32
+ # Testing
33
+ .pytest_cache/
34
+ .coverage
35
+ htmlcov/
36
+ .tox/
37
+
38
+ # uv
39
+ uv.lock
40
+
41
+ # Generated scaffold E2E tasks (examples/test_scaffold_combinations_e2e.py)
42
+ examples/_scaffold_e2e/
43
+
44
+ # Data directories (local dev)
45
+ data/
46
+ test-data/
47
+ *.db
48
+ *.sqlite3
49
+
50
+ # Test fixture runtime artefacts (written by test runs)
51
+ packages/server/tests/fixtures/*/environments/
52
+ packages/server/tests/fixtures/*/task_registry.json
53
+ packages/server/tests/fixtures/*/*-data/
54
+ packages/server/tests/fixtures/*/node-test-data/
55
+
56
+ # Package builds
57
+ packages/sdk-python/dist/
58
+ packages/server/dist/
59
+
60
+ # Worktrees
61
+ .worktrees/
62
+
63
+ # Secrets
64
+ .env
65
+ .env.local
66
+ .env.production
67
+ .env.otel
68
+ .env.otel-platform
69
+ .env.prod-e2e
70
+ .gitnexus
71
+ uv.lock
72
+ packages/ui-react/.next
73
+ packages/ui-react/out
74
+ .claude/skills
75
+ .claude/skills/gitnexus
76
+ .claude/skills/gitnexus/gitnexus-cli/SKILL.md
77
+ .claude/skills/gitnexus/gitnexus-debugging/SKILL.md
78
+ .claude/skills/gitnexus/gitnexus-exploring/SKILL.md
79
+ .claude/skills/gitnexus/gitnexus-guide/SKILL.md
80
+ .claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md
81
+ .claude/skills/gitnexus/gitnexus-refactoring/SKILL.md
82
+ .claude/
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.5
2
+ Name: ko-tasks-sdk
3
+ Version: 1.0.0
4
+ Summary: Python SDK for Komus Tasks — define, test, and deploy task workflows
5
+ Project-URL: Documentation, https://github.com/Komus-ai/ko-tasks-platform#readme
6
+ Project-URL: Repository, https://github.com/Komus-ai/ko-tasks-platform
7
+ Project-URL: Issues, https://github.com/Komus-ai/ko-tasks-platform/issues
8
+ Project-URL: Changelog, https://github.com/Komus-ai/ko-tasks-platform/blob/main/CHANGELOG.md
9
+ Author-email: "Komus.ai" <codir@komus.ai>
10
+ License: MIT
11
+ Keywords: async,automation,framework,sdk,task,workflow
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Topic :: System :: Distributed Computing
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.13
22
+ Requires-Dist: aiofiles>=24.1.0
23
+ Requires-Dist: click>=8.1.0
24
+ Requires-Dist: httpx>=0.27.0
25
+ Requires-Dist: inquirerpy>=0.3.4
26
+ Requires-Dist: ko-observability<0.3,>=0.2.0
27
+ Requires-Dist: opentelemetry-api>=1.27.0
28
+ Requires-Dist: opentelemetry-sdk>=1.27.0
29
+ Requires-Dist: pydantic>=2.10.0
30
+ Requires-Dist: pyyaml>=6.0.3
31
+ Requires-Dist: rich>=14.0.0
32
+ Requires-Dist: structlog>=24.4.0
33
+ Provides-Extra: agent
34
+ Requires-Dist: websockets>=12; extra == 'agent'
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
37
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
38
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
39
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # Komus Tasks SDK (Python)
43
+
44
+ Python SDK for building, testing, and deploying tasks with the Komus Tasks.
45
+
46
+ ## Installation
47
+
48
+ First public PyPI release: **1.0.0** (`ko-tasks` CLI and bundled agent skills).
49
+
50
+ ```bash
51
+ pip install ko-tasks-sdk
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ ### 1. Create a new task
57
+
58
+ ```bash
59
+ ko-tasks init my-task --runtime python
60
+ cd my-task
61
+ ```
62
+
63
+ ### 2. Edit `task.py`
64
+
65
+ ```python
66
+ async def run(context):
67
+ context.report_progress(0.0, "Starting...")
68
+
69
+ inputs = context.get_inputs()
70
+ # ... your logic ...
71
+
72
+ context.report_progress(1.0, "Done")
73
+ return [{"kind": "text", "text": "Result"}]
74
+ ```
75
+
76
+ ### 3. Run locally
77
+
78
+ ```bash
79
+ ko-tasks run
80
+ ```
81
+
82
+ ### 4. Deploy
83
+
84
+ ```bash
85
+ ko-tasks deploy --server https://tasks.example.com --admin-key YOUR_ADMIN_KEY
86
+ ```
87
+
88
+ ## CLI Commands
89
+
90
+ | Command | Description |
91
+ |---------|-------------|
92
+ | `ko-tasks init <name>` | Scaffold a new task project |
93
+ | `ko-tasks run` | Start a local dev server |
94
+ | `ko-tasks package --task-dir . -o task.zip` | Package task for deployment |
95
+ | `ko-tasks deploy -s URL --admin-key KEY` | Deploy to remote server |
96
+ | `ko-tasks status <thread_id> -s URL --api-key KEY` | Check thread status |
97
+ | `ko-tasks list -s URL --admin-key KEY` | List deployed tasks |
98
+
99
+ ## TaskContext API
100
+
101
+ The `context` object passed to your task function provides:
102
+
103
+ ### Inputs & Outputs
104
+ - `context.get_inputs()` — Returns list of input artifacts
105
+ - Return a list of output artifacts from your function
106
+
107
+ ### Progress Reporting
108
+ - `context.report_progress(fraction, message)` — Report progress (0.0 to 1.0)
109
+
110
+ ### Cooperative Control
111
+ - `context.check_pause()` — Blocks if task is paused, raises if cancelled
112
+ - `context.is_paused()` — Returns True if pause requested
113
+ - `context.is_cancelled()` — Returns True if cancellation requested
114
+
115
+ ### Artifacts
116
+ - `context.store_artifact(data, filename, media_type)` — Store output artifact
117
+ - `context.get_artifact(artifact_id)` — Retrieve an artifact
118
+
119
+ ### Configuration
120
+ - `context.get_config(key)` — Get a configuration/credential value
121
+
122
+ ## Task Definition (task.yaml)
123
+
124
+ ```yaml
125
+ name: my-task
126
+ version: 1.0.0
127
+ description: "What the task does"
128
+ entry_point: task:run
129
+ runtime: python # python | node
130
+
131
+ input_schemas:
132
+ - ref: input_data
133
+ kind: text
134
+ required: true
135
+ description: "Input description"
136
+
137
+ output_schemas:
138
+ - kind: file
139
+ media_type: application/pdf
140
+ description: "Output description"
141
+
142
+ requirements:
143
+ - name: API_KEY
144
+ required: true
145
+ description: "External API key"
146
+ ```
147
+
148
+ ## Development
149
+
150
+ ```bash
151
+ # Clone the monorepo
152
+ git clone https://github.com/Komus-ai/ko-tasks-platform.git
153
+ cd ko-tasks-platform
154
+
155
+ # Install in development mode
156
+ uv sync
157
+
158
+ # Run SDK tests
159
+ uv run --package ko-tasks-sdk pytest packages/sdk-python/tests/ -v
160
+ ```
161
+
162
+ ## License
163
+
164
+ MIT
@@ -0,0 +1,123 @@
1
+ # Komus Tasks SDK (Python)
2
+
3
+ Python SDK for building, testing, and deploying tasks with the Komus Tasks.
4
+
5
+ ## Installation
6
+
7
+ First public PyPI release: **1.0.0** (`ko-tasks` CLI and bundled agent skills).
8
+
9
+ ```bash
10
+ pip install ko-tasks-sdk
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ### 1. Create a new task
16
+
17
+ ```bash
18
+ ko-tasks init my-task --runtime python
19
+ cd my-task
20
+ ```
21
+
22
+ ### 2. Edit `task.py`
23
+
24
+ ```python
25
+ async def run(context):
26
+ context.report_progress(0.0, "Starting...")
27
+
28
+ inputs = context.get_inputs()
29
+ # ... your logic ...
30
+
31
+ context.report_progress(1.0, "Done")
32
+ return [{"kind": "text", "text": "Result"}]
33
+ ```
34
+
35
+ ### 3. Run locally
36
+
37
+ ```bash
38
+ ko-tasks run
39
+ ```
40
+
41
+ ### 4. Deploy
42
+
43
+ ```bash
44
+ ko-tasks deploy --server https://tasks.example.com --admin-key YOUR_ADMIN_KEY
45
+ ```
46
+
47
+ ## CLI Commands
48
+
49
+ | Command | Description |
50
+ |---------|-------------|
51
+ | `ko-tasks init <name>` | Scaffold a new task project |
52
+ | `ko-tasks run` | Start a local dev server |
53
+ | `ko-tasks package --task-dir . -o task.zip` | Package task for deployment |
54
+ | `ko-tasks deploy -s URL --admin-key KEY` | Deploy to remote server |
55
+ | `ko-tasks status <thread_id> -s URL --api-key KEY` | Check thread status |
56
+ | `ko-tasks list -s URL --admin-key KEY` | List deployed tasks |
57
+
58
+ ## TaskContext API
59
+
60
+ The `context` object passed to your task function provides:
61
+
62
+ ### Inputs & Outputs
63
+ - `context.get_inputs()` — Returns list of input artifacts
64
+ - Return a list of output artifacts from your function
65
+
66
+ ### Progress Reporting
67
+ - `context.report_progress(fraction, message)` — Report progress (0.0 to 1.0)
68
+
69
+ ### Cooperative Control
70
+ - `context.check_pause()` — Blocks if task is paused, raises if cancelled
71
+ - `context.is_paused()` — Returns True if pause requested
72
+ - `context.is_cancelled()` — Returns True if cancellation requested
73
+
74
+ ### Artifacts
75
+ - `context.store_artifact(data, filename, media_type)` — Store output artifact
76
+ - `context.get_artifact(artifact_id)` — Retrieve an artifact
77
+
78
+ ### Configuration
79
+ - `context.get_config(key)` — Get a configuration/credential value
80
+
81
+ ## Task Definition (task.yaml)
82
+
83
+ ```yaml
84
+ name: my-task
85
+ version: 1.0.0
86
+ description: "What the task does"
87
+ entry_point: task:run
88
+ runtime: python # python | node
89
+
90
+ input_schemas:
91
+ - ref: input_data
92
+ kind: text
93
+ required: true
94
+ description: "Input description"
95
+
96
+ output_schemas:
97
+ - kind: file
98
+ media_type: application/pdf
99
+ description: "Output description"
100
+
101
+ requirements:
102
+ - name: API_KEY
103
+ required: true
104
+ description: "External API key"
105
+ ```
106
+
107
+ ## Development
108
+
109
+ ```bash
110
+ # Clone the monorepo
111
+ git clone https://github.com/Komus-ai/ko-tasks-platform.git
112
+ cd ko-tasks-platform
113
+
114
+ # Install in development mode
115
+ uv sync
116
+
117
+ # Run SDK tests
118
+ uv run --package ko-tasks-sdk pytest packages/sdk-python/tests/ -v
119
+ ```
120
+
121
+ ## License
122
+
123
+ MIT
@@ -0,0 +1,71 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "ko-tasks-sdk"
7
+ version = "1.0.0"
8
+ description = "Python SDK for Komus Tasks — define, test, and deploy task workflows"
9
+ readme = "README.md"
10
+ requires-python = ">=3.13"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Komus.ai", email = "codir@komus.ai"}
14
+ ]
15
+ keywords = [
16
+ "task",
17
+ "workflow",
18
+ "sdk",
19
+ "automation",
20
+ "async",
21
+ "framework",
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 4 - Beta",
25
+ "Intended Audience :: Developers",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Operating System :: OS Independent",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Topic :: Software Development :: Libraries :: Python Modules",
31
+ "Topic :: System :: Distributed Computing",
32
+ "Typing :: Typed",
33
+ ]
34
+ dependencies = [
35
+ "aiofiles>=24.1.0",
36
+ "pydantic>=2.10.0",
37
+ "pyyaml>=6.0.3",
38
+ "httpx>=0.27.0",
39
+ "click>=8.1.0",
40
+ "structlog>=24.4.0",
41
+ "rich>=14.0.0",
42
+ "InquirerPy>=0.3.4",
43
+ "ko-observability>=0.2.0,<0.3",
44
+ "opentelemetry-api>=1.27.0",
45
+ "opentelemetry-sdk>=1.27.0",
46
+ ]
47
+
48
+ [project.urls]
49
+ Documentation = "https://github.com/Komus-ai/ko-tasks-platform#readme"
50
+ Repository = "https://github.com/Komus-ai/ko-tasks-platform"
51
+ Issues = "https://github.com/Komus-ai/ko-tasks-platform/issues"
52
+ Changelog = "https://github.com/Komus-ai/ko-tasks-platform/blob/main/CHANGELOG.md"
53
+
54
+ [project.scripts]
55
+ ko-tasks = "komus_tasks.cli:main"
56
+ ko-tasks-agent = "komus_tasks.agent.__main__:main"
57
+
58
+ [project.optional-dependencies]
59
+ agent = ["websockets>=12"]
60
+ dev = [
61
+ "pytest>=8.3.0",
62
+ "pytest-asyncio>=0.24.0",
63
+ "pytest-cov>=4.1.0",
64
+ "ruff>=0.8.0",
65
+ ]
66
+
67
+ [tool.hatch.build.targets.wheel]
68
+ packages = ["src/komus_tasks"]
69
+
70
+ [tool.hatch.build.targets.sdist]
71
+ include = ["src/komus_tasks"]
@@ -0,0 +1,16 @@
1
+ """Komus Tasks Python SDK — Build and run tasks with ease."""
2
+
3
+ from komus_tasks.context import TaskContext
4
+ from komus_tasks.decorators import task, get_task_registry, discover_tasks_in_module
5
+ from komus_tasks.thread_state import ThreadState
6
+ from komus_tasks.version import __version__, get_sdk_version
7
+
8
+ __all__ = [
9
+ "TaskContext",
10
+ "ThreadState",
11
+ "task",
12
+ "get_task_registry",
13
+ "discover_tasks_in_module",
14
+ "__version__",
15
+ "get_sdk_version",
16
+ ]
@@ -0,0 +1,20 @@
1
+ """Remote worker agent (client side).
2
+
3
+ The agent dials *into* the Komus Tasks server over a WebSocket (outbound-only —
4
+ the VM running the agent needs no inbound ports / public IP), registers its
5
+ runtimes and slot capacity, and on demand provisions task bundles and spawns the
6
+ **existing local worker runner** (``python -m komus_tasks.worker`` /
7
+ ``node node-runner.js``). The worker's NDJSON protocol frames are tunnelled over
8
+ the connection; the server's ``NetworkTransport`` is the other end of that pipe.
9
+
10
+ Ships inside ``ko-tasks-sdk`` so ``pip install ko-tasks-sdk[agent]``
11
+ provides the ``ko-tasks-agent`` console script.
12
+
13
+ This package is importable **without** the optional ``websockets`` dependency:
14
+ the import is performed lazily inside :class:`~komus_tasks.agent.client.AgentClient`
15
+ so the SDK keeps importing cleanly when the ``agent`` extra is not installed.
16
+ """
17
+
18
+ from komus_tasks.agent.client import AgentClient, AgentConfig
19
+
20
+ __all__ = ["AgentClient", "AgentConfig"]
@@ -0,0 +1,114 @@
1
+ """``ko-tasks-agent`` CLI — run a remote worker agent.
2
+
3
+ Dials into a Komus Tasks server over WebSocket, registers this host's runtimes
4
+ and slot capacity, then provisions task bundles and runs local workers on demand,
5
+ tunnelling their protocol frames back to the server.
6
+
7
+ Usage:
8
+ python -m komus_tasks.agent \\
9
+ --server-url wss://tasks.example.com/agent/connect \\
10
+ --token "$KO_TASKS_AGENT_TOKEN" \\
11
+ --labels python,node \\
12
+ --max-slots 8 \\
13
+ --work-dir /var/lib/ko-tasks-agent
14
+
15
+ Environment fallbacks:
16
+ KO_TASKS_AGENT_SERVER_URL → --server-url
17
+ KO_TASKS_AGENT_TOKEN → --token
18
+ """
19
+
20
+ import argparse
21
+ import asyncio
22
+ import os
23
+ import sys
24
+ from pathlib import Path
25
+
26
+ from komus_tasks.agent.client import AgentClient, AgentConfig, HelloRejected
27
+ from komus_tasks.logging import configure_logging, logger
28
+
29
+
30
+ def _build_parser() -> argparse.ArgumentParser:
31
+ parser = argparse.ArgumentParser(
32
+ prog="ko-tasks-agent",
33
+ description=(
34
+ "Run a Komus Tasks remote worker agent. The agent dials into the "
35
+ "server (outbound-only), registers its runtimes/slots, and runs "
36
+ "task workers on this host on demand."
37
+ ),
38
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
39
+ )
40
+ parser.add_argument(
41
+ "--server-url",
42
+ default=os.environ.get("KO_TASKS_AGENT_SERVER_URL"),
43
+ help="WebSocket URL of the server agent gateway "
44
+ "(e.g. wss://host/agent/connect). Env: KO_TASKS_AGENT_SERVER_URL.",
45
+ )
46
+ parser.add_argument(
47
+ "--token",
48
+ default=os.environ.get("KO_TASKS_AGENT_TOKEN"),
49
+ help="Shared agent auth token presented in `hello`. Env: KO_TASKS_AGENT_TOKEN.",
50
+ )
51
+ parser.add_argument(
52
+ "--labels",
53
+ default="python",
54
+ help="Comma-separated runtimes this agent can run (e.g. python,node).",
55
+ )
56
+ parser.add_argument(
57
+ "--max-slots",
58
+ type=int,
59
+ default=4,
60
+ help="Maximum concurrent worker leases this agent will accept.",
61
+ )
62
+ parser.add_argument(
63
+ "--work-dir",
64
+ type=Path,
65
+ default=Path.home() / ".ko-tasks-agent" / "work",
66
+ help="Directory for unpacked task bundles and per-lease venvs.",
67
+ )
68
+ parser.add_argument(
69
+ "--agent-id",
70
+ default=None,
71
+ help="Stable agent identifier (defaults to host-pid).",
72
+ )
73
+ return parser
74
+
75
+
76
+ def main() -> None:
77
+ configure_logging()
78
+ parser = _build_parser()
79
+ args = parser.parse_args()
80
+
81
+ if not args.server_url:
82
+ parser.error("--server-url is required (or set KO_TASKS_AGENT_SERVER_URL)")
83
+ if not args.token:
84
+ parser.error("--token is required (or set KO_TASKS_AGENT_TOKEN)")
85
+
86
+ runtimes = [r.strip() for r in args.labels.split(",") if r.strip()]
87
+ if not runtimes:
88
+ runtimes = ["python"]
89
+
90
+ config_kwargs: dict = {
91
+ "server_url": args.server_url,
92
+ "token": args.token,
93
+ "runtimes": runtimes,
94
+ "max_slots": args.max_slots,
95
+ "work_dir": args.work_dir,
96
+ }
97
+ if args.agent_id:
98
+ config_kwargs["agent_id"] = args.agent_id
99
+
100
+ config = AgentConfig(**config_kwargs)
101
+ client = AgentClient(config)
102
+
103
+ try:
104
+ asyncio.run(client.run_forever())
105
+ except HelloRejected as exc:
106
+ logger.error("agent.rejected", reason=str(exc))
107
+ sys.exit(2)
108
+ except KeyboardInterrupt:
109
+ logger.info("agent.shutdown")
110
+ sys.exit(0)
111
+
112
+
113
+ if __name__ == "__main__":
114
+ main()