kora-agent 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 (161) hide show
  1. kora_agent-0.1.0/.env.example +34 -0
  2. kora_agent-0.1.0/.gitignore +76 -0
  3. kora_agent-0.1.0/CLAUDE.md +138 -0
  4. kora_agent-0.1.0/PKG-INFO +381 -0
  5. kora_agent-0.1.0/README.md +343 -0
  6. kora_agent-0.1.0/TODO.md +209 -0
  7. kora_agent-0.1.0/agents/kora-code/README.md +35 -0
  8. kora_agent-0.1.0/agents/kora-code/pyproject.toml +34 -0
  9. kora_agent-0.1.0/agents/kora-code/src/kora_code/__about__.py +3 -0
  10. kora_agent-0.1.0/agents/kora-code/src/kora_code/__init__.py +22 -0
  11. kora_agent-0.1.0/agents/kora-code/src/kora_code/agent/AGENT.md +92 -0
  12. kora_agent-0.1.0/agents/kora-code/src/kora_code/agent/config.yaml +9 -0
  13. kora_agent-0.1.0/agents/kora-code/src/kora_code/agent/extensions/commands/status.py +41 -0
  14. kora_agent-0.1.0/agents/kora-code/src/kora_code/agent/instructions/coding.md +29 -0
  15. kora_agent-0.1.0/agents/kora-code/src/kora_code/agent/instructions/communication.md +19 -0
  16. kora_agent-0.1.0/agents/kora-code/src/kora_code/agent/instructions/mode-architect.md +24 -0
  17. kora_agent-0.1.0/agents/kora-code/src/kora_code/agent/instructions/mode-code.md +22 -0
  18. kora_agent-0.1.0/assets/branding/logo.png +0 -0
  19. kora_agent-0.1.0/docs/CURRENT.md +286 -0
  20. kora_agent-0.1.0/docs/PM-REPORT-2026-06-23.md +195 -0
  21. kora_agent-0.1.0/docs/TECH-RADAR.md +327 -0
  22. kora_agent-0.1.0/docs/api.md +633 -0
  23. kora_agent-0.1.0/docs/decisions/000-language-and-core-features.md +73 -0
  24. kora_agent-0.1.0/docs/decisions/001-async-and-tool-definition.md +87 -0
  25. kora_agent-0.1.0/docs/decisions/002-skills-capability-packages.md +148 -0
  26. kora_agent-0.1.0/docs/decisions/003-host-name-and-boundary.md +123 -0
  27. kora_agent-0.1.0/docs/decisions/004-workspace-identity-and-user-agent-state.md +228 -0
  28. kora_agent-0.1.0/docs/decisions/005-kora-code-agent-mvp.md +424 -0
  29. kora_agent-0.1.0/docs/decisions/006-interface-event-rendering.md +250 -0
  30. kora_agent-0.1.0/docs/decisions/007-instruction-layer-and-scope-overlay.md +287 -0
  31. kora_agent-0.1.0/docs/decisions/008-slash-commands-and-context-rebuild.md +238 -0
  32. kora_agent-0.1.0/docs/decisions/008-tool-schema-single-source.md +71 -0
  33. kora_agent-0.1.0/docs/decisions/009-tool-output-folding.md +224 -0
  34. kora_agent-0.1.0/docs/decisions/010-agent-command-extensions.md +185 -0
  35. kora_agent-0.1.0/docs/decisions/011-repl-command-hints.md +45 -0
  36. kora_agent-0.1.0/docs/decisions/012-interaction-requests-and-choice-controls.md +129 -0
  37. kora_agent-0.1.0/docs/decisions/013-agent-package-distribution.md +95 -0
  38. kora_agent-0.1.0/docs/getting-started.md +333 -0
  39. kora_agent-0.1.0/docs/tools.md +439 -0
  40. kora_agent-0.1.0/examples/common.py +163 -0
  41. kora_agent-0.1.0/examples/demo_auto.py +139 -0
  42. kora_agent-0.1.0/examples/demo_kernel.py +205 -0
  43. kora_agent-0.1.0/examples/demo_observability.py +292 -0
  44. kora_agent-0.1.0/examples/demo_quickstart.py +194 -0
  45. kora_agent-0.1.0/examples/demo_real_model.py +249 -0
  46. kora_agent-0.1.0/examples/demo_runtime.py +94 -0
  47. kora_agent-0.1.0/pyproject.toml +82 -0
  48. kora_agent-0.1.0/session-ses_1111.md +12573 -0
  49. kora_agent-0.1.0/src/kora/__init__.py +31 -0
  50. kora_agent-0.1.0/src/kora/_version.py +3 -0
  51. kora_agent-0.1.0/src/kora/cli.py +349 -0
  52. kora_agent-0.1.0/src/kora/host/__init__.py +166 -0
  53. kora_agent-0.1.0/src/kora/host/commands.py +711 -0
  54. kora_agent-0.1.0/src/kora/host/context.py +209 -0
  55. kora_agent-0.1.0/src/kora/host/identity.py +163 -0
  56. kora_agent-0.1.0/src/kora/host/instructions.py +247 -0
  57. kora_agent-0.1.0/src/kora/host/interactions.py +376 -0
  58. kora_agent-0.1.0/src/kora/host/loader.py +539 -0
  59. kora_agent-0.1.0/src/kora/host/permission.py +221 -0
  60. kora_agent-0.1.0/src/kora/host/repl.py +242 -0
  61. kora_agent-0.1.0/src/kora/host/runner.py +204 -0
  62. kora_agent-0.1.0/src/kora/host/storage.py +361 -0
  63. kora_agent-0.1.0/src/kora/host/workspace.py +349 -0
  64. kora_agent-0.1.0/src/kora/interface/__init__.py +34 -0
  65. kora_agent-0.1.0/src/kora/interface/console.py +203 -0
  66. kora_agent-0.1.0/src/kora/interface/interaction.py +72 -0
  67. kora_agent-0.1.0/src/kora/interface/markdown.py +163 -0
  68. kora_agent-0.1.0/src/kora/interface/repl.py +132 -0
  69. kora_agent-0.1.0/src/kora/kernel/__init__.py +23 -0
  70. kora_agent-0.1.0/src/kora/kernel/loop.py +215 -0
  71. kora_agent-0.1.0/src/kora/kernel/model.py +46 -0
  72. kora_agent-0.1.0/src/kora/kernel/tool.py +97 -0
  73. kora_agent-0.1.0/src/kora/kernel/types.py +62 -0
  74. kora_agent-0.1.0/src/kora/providers/__init__.py +205 -0
  75. kora_agent-0.1.0/src/kora/providers/api/__init__.py +22 -0
  76. kora_agent-0.1.0/src/kora/providers/api/anthropic_messages.py +344 -0
  77. kora_agent-0.1.0/src/kora/providers/api/base.py +94 -0
  78. kora_agent-0.1.0/src/kora/providers/api/converters.py +118 -0
  79. kora_agent-0.1.0/src/kora/providers/api/openai_completions.py +280 -0
  80. kora_agent-0.1.0/src/kora/providers/api/registry.py +78 -0
  81. kora_agent-0.1.0/src/kora/providers/auth.py +74 -0
  82. kora_agent-0.1.0/src/kora/providers/builtins/__init__.py +63 -0
  83. kora_agent-0.1.0/src/kora/providers/builtins/anthropic.py +136 -0
  84. kora_agent-0.1.0/src/kora/providers/builtins/cerebras.py +29 -0
  85. kora_agent-0.1.0/src/kora/providers/builtins/cohere.py +119 -0
  86. kora_agent-0.1.0/src/kora/providers/builtins/dashscope.py +213 -0
  87. kora_agent-0.1.0/src/kora/providers/builtins/deepseek.py +81 -0
  88. kora_agent-0.1.0/src/kora/providers/builtins/fireworks.py +101 -0
  89. kora_agent-0.1.0/src/kora/providers/builtins/google.py +98 -0
  90. kora_agent-0.1.0/src/kora/providers/builtins/groq.py +118 -0
  91. kora_agent-0.1.0/src/kora/providers/builtins/jdcloud.py +41 -0
  92. kora_agent-0.1.0/src/kora/providers/builtins/minimax.py +74 -0
  93. kora_agent-0.1.0/src/kora/providers/builtins/mistral.py +131 -0
  94. kora_agent-0.1.0/src/kora/providers/builtins/moonshot.py +74 -0
  95. kora_agent-0.1.0/src/kora/providers/builtins/nvidia.py +179 -0
  96. kora_agent-0.1.0/src/kora/providers/builtins/ollama.py +152 -0
  97. kora_agent-0.1.0/src/kora/providers/builtins/openai.py +193 -0
  98. kora_agent-0.1.0/src/kora/providers/builtins/openrouter.py +86 -0
  99. kora_agent-0.1.0/src/kora/providers/builtins/perplexity.py +55 -0
  100. kora_agent-0.1.0/src/kora/providers/builtins/siliconflow.py +124 -0
  101. kora_agent-0.1.0/src/kora/providers/builtins/stepfun.py +46 -0
  102. kora_agent-0.1.0/src/kora/providers/builtins/tencent.py +50 -0
  103. kora_agent-0.1.0/src/kora/providers/builtins/together.py +145 -0
  104. kora_agent-0.1.0/src/kora/providers/builtins/volcengine.py +82 -0
  105. kora_agent-0.1.0/src/kora/providers/builtins/xai.py +95 -0
  106. kora_agent-0.1.0/src/kora/providers/builtins/xiaomi.py +54 -0
  107. kora_agent-0.1.0/src/kora/providers/builtins/zhipu.py +138 -0
  108. kora_agent-0.1.0/src/kora/providers/errors.py +127 -0
  109. kora_agent-0.1.0/src/kora/providers/model.py +235 -0
  110. kora_agent-0.1.0/src/kora/providers/provider.py +164 -0
  111. kora_agent-0.1.0/src/kora/providers/registry.py +195 -0
  112. kora_agent-0.1.0/src/kora/providers/retry.py +154 -0
  113. kora_agent-0.1.0/src/kora/runtime/__init__.py +44 -0
  114. kora_agent-0.1.0/src/kora/runtime/agent.py +263 -0
  115. kora_agent-0.1.0/src/kora/runtime/events.py +96 -0
  116. kora_agent-0.1.0/src/kora/runtime/run.py +342 -0
  117. kora_agent-0.1.0/src/kora/runtime/session.py +247 -0
  118. kora_agent-0.1.0/src/kora/tools/__init__.py +128 -0
  119. kora_agent-0.1.0/src/kora/tools/base.py +94 -0
  120. kora_agent-0.1.0/src/kora/tools/config.py +50 -0
  121. kora_agent-0.1.0/src/kora/tools/decorator.py +193 -0
  122. kora_agent-0.1.0/src/kora/tools/execution/__init__.py +33 -0
  123. kora_agent-0.1.0/src/kora/tools/execution/code.py +361 -0
  124. kora_agent-0.1.0/src/kora/tools/execution/shell.py +220 -0
  125. kora_agent-0.1.0/src/kora/tools/filesystem/__init__.py +56 -0
  126. kora_agent-0.1.0/src/kora/tools/filesystem/editing.py +240 -0
  127. kora_agent-0.1.0/src/kora/tools/filesystem/listing.py +175 -0
  128. kora_agent-0.1.0/src/kora/tools/filesystem/reading.py +152 -0
  129. kora_agent-0.1.0/src/kora/tools/filesystem/searching.py +265 -0
  130. kora_agent-0.1.0/src/kora/tools/network/__init__.py +38 -0
  131. kora_agent-0.1.0/src/kora/tools/network/fetching.py +131 -0
  132. kora_agent-0.1.0/src/kora/tools/network/http.py +265 -0
  133. kora_agent-0.1.0/src/kora/tools/network/searching.py +119 -0
  134. kora_agent-0.1.0/src/kora/tools/security/__init__.py +45 -0
  135. kora_agent-0.1.0/src/kora/tools/security/patterns.py +248 -0
  136. kora_agent-0.1.0/src/kora/tools/security/validation.py +190 -0
  137. kora_agent-0.1.0/tests/host/test_context.py +257 -0
  138. kora_agent-0.1.0/tests/host/test_identity.py +340 -0
  139. kora_agent-0.1.0/tests/host/test_interactions.py +170 -0
  140. kora_agent-0.1.0/tests/host/test_loader.py +202 -0
  141. kora_agent-0.1.0/tests/host/test_permission.py +330 -0
  142. kora_agent-0.1.0/tests/host/test_storage.py +504 -0
  143. kora_agent-0.1.0/tests/host/test_workspace.py +297 -0
  144. kora_agent-0.1.0/tests/providers/__init__.py +1 -0
  145. kora_agent-0.1.0/tests/providers/test_errors.py +100 -0
  146. kora_agent-0.1.0/tests/providers/test_providers.py +338 -0
  147. kora_agent-0.1.0/tests/providers/test_retry.py +162 -0
  148. kora_agent-0.1.0/tests/test_api.py +140 -0
  149. kora_agent-0.1.0/tests/test_commands.py +436 -0
  150. kora_agent-0.1.0/tests/test_context_runtime.py +154 -0
  151. kora_agent-0.1.0/tests/test_import.py +25 -0
  152. kora_agent-0.1.0/tests/test_instructions.py +347 -0
  153. kora_agent-0.1.0/tests/test_kernel.py +273 -0
  154. kora_agent-0.1.0/tests/test_kernel_types.py +73 -0
  155. kora_agent-0.1.0/tests/test_runtime.py +192 -0
  156. kora_agent-0.1.0/tests/test_tools.py +173 -0
  157. kora_agent-0.1.0/tests/tools/__init__.py +3 -0
  158. kora_agent-0.1.0/tests/tools/test_code_execution.py +216 -0
  159. kora_agent-0.1.0/tests/tools/test_core.py +314 -0
  160. kora_agent-0.1.0/tests/tools/test_shell.py +128 -0
  161. kora_agent-0.1.0/uv.lock +653 -0
@@ -0,0 +1,34 @@
1
+ # Kora Environment Variables Example
2
+ # Copy this file to .env and fill in the keys for the providers you use.
3
+
4
+ # ── OpenAI ───────────────────────────────────────────────────────
5
+ # https://platform.openai.com/api-keys
6
+ OPENAI_API_KEY=your-openai-api-key
7
+
8
+ # ── Anthropic ────────────────────────────────────────────────────
9
+ # https://console.anthropic.com
10
+ # ANTHROPIC_API_KEY=your-anthropic-api-key
11
+
12
+ # ── DashScope (Alibaba Cloud 百炼 / 通义千问) ─────────────────────
13
+ # https://dashscope.console.aliyun.com
14
+ # DASHSCOPE_API_KEY=your-dashscope-api-key
15
+
16
+ # ── JD Cloud Coding (GLM) ───────────────────────────────────────
17
+ # https://modelservice.jdcloud.com
18
+ # JDCLOUD_API_KEY=your-jdcloud-api-key
19
+
20
+ # ── DeepSeek ────────────────────────────────────────────────────
21
+ # https://platform.deepseek.com
22
+ # DEEPSEEK_API_KEY=your-deepseek-api-key
23
+
24
+ # ── Moonshot AI (月之暗面 Kimi) ──────────────────────────────────
25
+ # https://platform.moonshot.cn
26
+ # MOONSHOT_API_KEY=your-moonshot-api-key
27
+
28
+ # ── OpenRouter (multi-provider aggregation) ─────────────────────
29
+ # https://openrouter.ai/keys
30
+ # OPENROUTER_API_KEY=your-openrouter-api-key
31
+
32
+ # ── Ollama (local, no key needed) ───────────────────────────────
33
+ # https://ollama.ai
34
+ # No API key required; ensure Ollama is running on localhost:11434
@@ -0,0 +1,76 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+ env/
28
+
29
+ # IDE
30
+ .idea/
31
+ .vscode/
32
+ *.swp
33
+ *.swo
34
+ *~
35
+ .project
36
+ .pydevproject
37
+ .settings/
38
+
39
+ # Testing
40
+ .pytest_cache/
41
+ .coverage
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+
46
+ # Type checking
47
+ .mypy_cache/
48
+ .pytype/
49
+
50
+ # Linting
51
+ .ruff_cache/
52
+
53
+ # Documentation
54
+ docs/_build/
55
+ site/
56
+
57
+ # Project specific
58
+ .env
59
+ .env.local
60
+ *.local.json
61
+
62
+ # OS
63
+ .DS_Store
64
+ Thumbs.db
65
+
66
+ # Jupyter
67
+ .ipynb_checkpoints/
68
+ *.ipynb
69
+
70
+ # Logs
71
+ *.log
72
+ logs/
73
+
74
+ .kora
75
+
76
+ .claude
@@ -0,0 +1,138 @@
1
+ # Kora Development Constitution
2
+
3
+ Kora is a lightweight Agent framework with an official Code Agent built on top of the same public APIs available to external developers.
4
+
5
+ ## Core principles
6
+
7
+ * Keep Kora simple to use, even when its internal architecture is layered.
8
+ * The framework must absorb common complexity instead of transferring it to Agent authors.
9
+ * Prefer convention over configuration.
10
+ * Prefer composition over inheritance.
11
+ * Prefer ordinary files and explicit protocols over opaque abstractions.
12
+ * Separate mechanism from policy.
13
+ * Add abstractions only when required by a concrete current use case.
14
+ * Keep public APIs small, stable, and unsurprising.
15
+
16
+ ## Architectural boundaries
17
+
18
+ Kora separates execution into three conceptual layers:
19
+
20
+ * **Kernel** executes one model–tool loop.
21
+ * **Runtime** manages Agent, Workspace, Session, Prompt, and Run semantics.
22
+ * **Host** is the trusted outer environment that loads, authorizes,
23
+ persists, and composes Agent definitions before Runtime execution. It
24
+ manages persistence, identity, tenancy, permissions, workspace trust,
25
+ and shared resources.
26
+
27
+ Dependencies must point inward:
28
+
29
+ ```text
30
+ Interface → Host → Runtime → Kernel
31
+ ```
32
+
33
+ Lower layers must not depend on higher layers.
34
+
35
+ Kernel must not know about:
36
+
37
+ * Agent files
38
+ * Workspace discovery
39
+ * Sessions
40
+ * Users or tenants
41
+ * Databases
42
+ * TUI, Web, or Server interfaces
43
+ * Model configuration or API-key resolution
44
+
45
+ Runtime must not know about:
46
+
47
+ * Authentication
48
+ * Tenant ownership
49
+ * Billing
50
+ * Database-specific persistence
51
+ * UI rendering
52
+
53
+ Host must not own:
54
+
55
+ * Kernel model-tool loop semantics
56
+ * Runtime Agent, Session, Run, or event semantics
57
+ * UI rendering
58
+ * A specific CLI, web server, or desktop app
59
+ * Provider protocol internals
60
+ * Tool implementation logic
61
+ * Plugin marketplace distribution
62
+
63
+ ## Public API
64
+
65
+ Normal users should only need concepts such as:
66
+
67
+ * `Agent`
68
+ * `Session`
69
+ * `tool`
70
+ * `run`
71
+
72
+ Internal concepts such as Kernel, Runtime, resolvers, adapters, registries, repositories, and providers must not be required for ordinary Agent definition.
73
+
74
+ A minimal Agent should be definable with an `AGENT.md` file.
75
+
76
+ ## Agent equality
77
+
78
+ The official Kora Code Agent must use the same public loading and execution mechanisms as external Agents.
79
+
80
+ Do not introduce privileged private APIs or special execution branches for the official Code Agent.
81
+
82
+ A requirement belongs in:
83
+
84
+ * Kernel, only if it is universal execution mechanism;
85
+ * Runtime, only if it is reusable Agent runtime semantics;
86
+ * the Code Agent, if it is code-specific behavior or policy.
87
+
88
+ ## Execution rules
89
+
90
+ * Agent behavior must be grounded in actual model and tool results.
91
+ * Security boundaries must be enforced in code, not only through prompts.
92
+ * Workspace access must remain isolated to the configured root.
93
+ * Runs must be observable through structured events.
94
+ * Sessions must remain independent and must survive the completion of individual Runs.
95
+ * Kernel must be independently testable with deterministic fake models and tools.
96
+ * External model responses and tool errors must be normalized before entering core logic.
97
+
98
+ ## Development rules
99
+
100
+ Before making a substantial change:
101
+
102
+ 1. Read `docs/CURRENT.md`.
103
+ 2. Read `TODO.md`.
104
+ 3. Inspect the relevant implementation and tests.
105
+ 4. Identify which architectural layer owns the change.
106
+
107
+ During implementation:
108
+
109
+ * Prefer the smallest complete change.
110
+ * Add tests with behavior changes.
111
+ * Do not implement speculative infrastructure.
112
+ * Do not silently cross established layer boundaries.
113
+ * Do not move framework responsibilities into user code merely to keep framework code small.
114
+
115
+ After substantial work:
116
+
117
+ * Update `TODO.md`.
118
+ * Update `docs/CURRENT.md`.
119
+ * Record durable architectural decisions under `docs/decisions/` when necessary.
120
+
121
+ ## Decision test
122
+
123
+ Before introducing a new abstraction, ask:
124
+
125
+ 1. Is it required by a current real use case?
126
+ 2. Does it materially improve isolation, testing, replacement, or reuse?
127
+ 3. Does it reduce total complexity rather than move complexity elsewhere?
128
+
129
+ If the answers are not clearly yes, defer it.
130
+
131
+ ## Documentation boundaries
132
+
133
+ * `CLAUDE.md`: stable principles and non-negotiable boundaries.
134
+ * `TODO.md`: actionable unfinished work.
135
+ * `docs/CURRENT.md`: current design state, open questions, and next action.
136
+ * `docs/decisions/`: accepted architectural decisions.
137
+
138
+ Do not put temporary progress, detailed implementation plans, or frequently changing directory structures in this file.
@@ -0,0 +1,381 @@
1
+ Metadata-Version: 2.4
2
+ Name: kora-agent
3
+ Version: 0.1.0
4
+ Summary: A lightweight Agent framework with extensible model providers
5
+ Author: xvshiting
6
+ License-Expression: MIT
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
+ Requires-Python: >=3.12
14
+ Requires-Dist: typing-extensions>=4.0.0
15
+ Provides-Extra: all
16
+ Requires-Dist: anthropic>=0.25.0; extra == 'all'
17
+ Requires-Dist: httpx>=0.25.0; extra == 'all'
18
+ Requires-Dist: kora-code>=0.1.0; extra == 'all'
19
+ Requires-Dist: mypy>=1.8.0; extra == 'all'
20
+ Requires-Dist: openai>=1.0.0; extra == 'all'
21
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'all'
22
+ Requires-Dist: pytest>=8.0.0; extra == 'all'
23
+ Requires-Dist: ruff>=0.3.0; extra == 'all'
24
+ Provides-Extra: anthropic
25
+ Requires-Dist: anthropic>=0.25.0; extra == 'anthropic'
26
+ Provides-Extra: code
27
+ Requires-Dist: kora-code>=0.1.0; extra == 'code'
28
+ Provides-Extra: dev
29
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
30
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
31
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.3.0; extra == 'dev'
33
+ Provides-Extra: network
34
+ Requires-Dist: httpx>=0.25.0; extra == 'network'
35
+ Provides-Extra: openai
36
+ Requires-Dist: openai>=1.0.0; extra == 'openai'
37
+ Description-Content-Type: text/markdown
38
+
39
+ <p align="center">
40
+ <img src="assets/branding/logo.png" alt="Kora" width="420">
41
+ </p>
42
+
43
+ <h3 align="center">A lightweight, layered Agent framework for Python</h3>
44
+
45
+ <p align="center">
46
+ <a href="https://www.python.org/downloads/"><img alt="Python" src="https://img.shields.io/badge/python-3.12+-blue.svg"></a>
47
+ <a href="https://opensource.org/licenses/MIT"><img alt="License" src="https://img.shields.io/badge/License-MIT-yellow.svg"></a>
48
+ <img alt="Status" src="https://img.shields.io/badge/status-alpha-orange.svg">
49
+ <img alt="Type checked" src="https://img.shields.io/badge/typed-mypy-blue.svg">
50
+ <img alt="Code style" src="https://img.shields.io/badge/code%20style-ruff-000000.svg">
51
+ </p>
52
+
53
+ ---
54
+
55
+ Kora is a lightweight Agent framework built around a strict three-layer
56
+ architecture: **Kernel → Runtime → Host**. It is designed to absorb common
57
+ agent complexity—model-tool loops, session state, workspace isolation,
58
+ event observability—so that authors can define agents with minimal code
59
+ while retaining full control over execution.
60
+
61
+ A minimal agent is just an `AGENT.md` file plus a handful of `@tool`
62
+ functions. The official Kora Code Agent runs on the same public APIs
63
+ available to every external developer—no privileged branches, no hidden
64
+ hooks.
65
+
66
+ ## Table of Contents
67
+
68
+ - [Highlights](#highlights)
69
+ - [Installation](#installation)
70
+ - [Quick Start](#quick-start)
71
+ - [Built-in Tools](#built-in-tools)
72
+ - [Model Providers](#model-providers)
73
+ - [Architecture](#architecture)
74
+ - [Examples](#examples)
75
+ - [Documentation](#documentation)
76
+ - [Development](#development)
77
+ - [Roadmap](#roadmap)
78
+ - [Contributing](#contributing)
79
+ - [License](#license)
80
+
81
+ ## Highlights
82
+
83
+ - **Small public API.** Everyday work needs only `Agent`, `Session`,
84
+ `tool`, and `run`. Kernel/Runtime internals stay out of the way.
85
+ - **Layered architecture.** Kernel runs one synchronous model-tool loop;
86
+ Runtime manages async Agent/Session/Run semantics; Host handles
87
+ persistence, identity, and permissions. Dependencies point inward.
88
+ - **Extensible model providers.** Built-in provider specs cover OpenAI,
89
+ Anthropic, DashScope, JDCloud, DeepSeek, Moonshot, OpenRouter, and
90
+ Ollama. Providers are resolved through a registry and communicate via
91
+ pluggable API protocols such as OpenAI Completions and Anthropic Messages.
92
+ - **Rich built-in tools.** Filesystem, text processing, shell, network,
93
+ and sandboxed Python execution—each with workspace boundaries.
94
+ - **Security by code, not by prompt.** SSRF protection, command
95
+ filtering, import restrictions, and workspace isolation are enforced
96
+ in implementation, not just in prompts.
97
+ - **Observable runs.** Every Run emits structured events
98
+ (`RunStarted`, `ToolExecuted`, `RunCompleted`, …) for streaming and
99
+ debugging.
100
+ - **Independently testable.** Kernel can be exercised with deterministic
101
+ fake models and tools—no network required.
102
+
103
+ ## Installation
104
+
105
+ ```bash
106
+ # Core framework
107
+ pip install kora-agent
108
+
109
+ # Optional extras
110
+ pip install kora-agent[openai] # OpenAI / OpenAI-compatible providers (openai)
111
+ pip install kora-agent[anthropic] # Anthropic Claude provider (anthropic)
112
+ pip install kora-agent[network] # HTTP / web tools (httpx)
113
+ pip install kora-agent[all] # Everything, including dev tooling
114
+
115
+ # Kora Code Agent (official coding agent)
116
+ pip install kora-agent kora-code
117
+ pip install kora-agent[code] # shortcut for the above
118
+ ```
119
+
120
+ Kora requires Python 3.12 or newer and has zero required runtime
121
+ dependencies beyond the standard library plus `typing-extensions`.
122
+
123
+ ## Quick Start
124
+
125
+ ### 1. Configure environment
126
+
127
+ ```bash
128
+ cp .env.example .env
129
+ # Edit .env and set at least one provider key, e.g.
130
+ # DASHSCOPE_API_KEY=your-api-key
131
+
132
+ # Or export inline
133
+ export DASHSCOPE_API_KEY='your-api-key'
134
+ ```
135
+
136
+ ### 2. Define tools
137
+
138
+ The `@tool` decorator derives name, description, and JSON schema from
139
+ the function signature and docstring:
140
+
141
+ ```python
142
+ from kora import tool
143
+
144
+ @tool
145
+ def echo(message: str) -> str:
146
+ """Echo back a message."""
147
+ return f"Echo: {message}"
148
+
149
+ @tool
150
+ def calculate(expression: str) -> str:
151
+ """Evaluate a math expression."""
152
+ return str(eval(expression, {"__builtins__": {}}, {}))
153
+ ```
154
+
155
+ ### 3. Create an agent
156
+
157
+ ```python
158
+ from kora import Agent
159
+ from kora.providers import get_provider_registry
160
+ from kora.tools import ListFilesTool, ReadFileTool
161
+
162
+ # Resolve a model from the built-in provider registry
163
+ registry = get_provider_registry()
164
+ model = registry.get_model("dashscope", "qwen-max")
165
+
166
+ agent = Agent(
167
+ name="assistant",
168
+ system_prompt="You are a helpful assistant.",
169
+ tools=[
170
+ echo,
171
+ calculate,
172
+ ListFilesTool("."), # filesystem tools are workspace-scoped
173
+ ReadFileTool("."),
174
+ ],
175
+ model=model,
176
+ )
177
+ ```
178
+
179
+ See [Model Providers](#model-providers) below for all built-in providers
180
+ and how to register custom ones.
181
+
182
+ ### 4. Run a session
183
+
184
+ ```python
185
+ import asyncio
186
+
187
+ async def main():
188
+ session = agent.open_session() # persists history
189
+ result = await session.send("What files are here?") # streams events
190
+ print(result)
191
+
192
+ asyncio.run(main())
193
+ ```
194
+
195
+ For a full model-provider implementation and event handling, see
196
+ [`examples/demo_quickstart.py`](examples/demo_quickstart.py) and
197
+ [`docs/getting-started.md`](docs/getting-started.md).
198
+
199
+ ## Built-in Tools
200
+
201
+ Kora's toolset follows a capability-based design: a small number of
202
+ general tools each cover a family of operations. Use `get_core_tools()`
203
+ to get the 6 essential tools for a coding agent.
204
+
205
+ ### File System
206
+
207
+ | Tool | Description |
208
+ |------|-------------|
209
+ | `ListFilesTool` | List files/directories (covers `ls`, `find`, `tree`) |
210
+ | `SearchTextTool` | Search text in files (covers `grep`/`rg`) |
211
+ | `ReadFileTool` | Read file content with line ranges (covers `cat`, `head`, `tail`) |
212
+ | `WriteFileTool` | Create or overwrite files |
213
+ | `ApplyPatchTool` | Apply targeted text patches to existing files |
214
+
215
+ ### Execution
216
+
217
+ | Tool | Description |
218
+ |------|-------------|
219
+ | `RunShellTool` | Execute shell commands with command filtering |
220
+ | `PythonExecutionTool` | Execute Python code in a sandboxed environment |
221
+
222
+ ### Network
223
+
224
+ | Tool | Description |
225
+ |------|-------------|
226
+ | `HTTPRequestTool` | Make HTTP requests with SSRF protection |
227
+ | `WebFetchTool` | Fetch and extract text from web pages |
228
+ | `WebSearchTool` | Search the web via DuckDuckGo |
229
+
230
+ ### Convenience helpers
231
+
232
+ | Helper | Returns |
233
+ |--------|---------|
234
+ | `get_core_tools(workspace)` | The 6 essential tools for a coding agent |
235
+ | `get_filesystem_tools(workspace)` | The 5 filesystem tools |
236
+ | `get_execution_tools(workspace)` | `RunShellTool` + `PythonExecutionTool` |
237
+ | `get_network_tools()` | The 3 network tools |
238
+
239
+ ## Model Providers
240
+
241
+ Built-in providers live in `kora.providers` and are resolved through the
242
+ provider registry:
243
+
244
+ | Provider ID | Example models | API key env |
245
+ |-------------|----------------|-------------|
246
+ | `openai` | `gpt-4o`, `gpt-4-turbo`, `gpt-3.5-turbo` | `OPENAI_API_KEY` |
247
+ | `anthropic` | `claude-3-5-sonnet-20241022`, `claude-3-opus-20240229` | `ANTHROPIC_API_KEY` |
248
+ | `dashscope` | `qwen-max`, `qwen-plus`, `qwen-turbo` | `DASHSCOPE_API_KEY` |
249
+ | `jdcloud` | `glm-5`, `glm-4` | `JDCLOUD_API_KEY` |
250
+ | `deepseek` | `deepseek-chat`, `deepseek-reasoner`, `deepseek-v4-flash` | `DEEPSEEK_API_KEY` |
251
+ | `deepseek-anthropic` | `deepseek-v4-flash`, `deepseek-v4-pro` (via Anthropic API) | `DEEPSEEK_API_KEY` |
252
+ | `moonshot` | `moonshot-v1-8k`, `moonshot-v1-32k`, `moonshot-v1-128k` | `MOONSHOT_API_KEY` |
253
+ | `openrouter` | `anthropic/claude-3.5-sonnet`, `openai/gpt-4o` | `OPENROUTER_API_KEY` |
254
+ | `ollama` | `llama3`, `mistral`, `qwen2` | local (no key) |
255
+
256
+ To register a custom provider, add a `ProviderSpec` to the registry:
257
+
258
+ ```python
259
+ from kora.providers import ProviderSpec, ModelSpec, get_provider_registry
260
+
261
+ registry = get_provider_registry()
262
+ registry.register(ProviderSpec(
263
+ id="my-provider",
264
+ name="My Provider",
265
+ base_url="https://api.example.com/v1",
266
+ api="openai-completions", # or "anthropic-messages"
267
+ api_key="${MY_API_KEY}",
268
+ models=(
269
+ ModelSpec(id="my-model", name="My Model", tool_calling=True),
270
+ ),
271
+ ))
272
+ model = registry.get_model("my-provider", "my-model")
273
+ ```
274
+
275
+ Provider API keys are read from environment variables (via the
276
+ `${VAR_NAME}` pattern in each `ProviderSpec`). See
277
+ [`.env.example`](.env.example) for the full list.
278
+
279
+ ## Architecture
280
+
281
+ Kora separates mechanism from policy across three conceptual layers.
282
+ Dependencies always point inward:
283
+
284
+ ```
285
+ Interface → Host → Runtime → Kernel
286
+ ```
287
+
288
+ | Layer | Responsibility | Style |
289
+ |-------|---------------|------|
290
+ | **Kernel** | Executes one model-tool loop | Synchronous, dependency-injected, fully testable with fakes |
291
+ | **Runtime** | Manages `Agent`, `Session`, `Run`, events | Async, observable, coordinates the Kernel |
292
+ | **Host** | Persistence, identity, tenancy, permissions | Pluggable, framework-defined boundary |
293
+
294
+ The Kernel knows nothing about agents, workspaces, sessions, users, or
295
+ databases. The Runtime knows nothing about authentication, tenancy, or
296
+ UI rendering. This keeps the core small and replaceable.
297
+
298
+ See [`docs/decisions/`](docs/decisions/) for the reasoning behind each
299
+ architectural boundary, and [`CLAUDE.md`](CLAUDE.md) for the
300
+ non-negotiable development constitution.
301
+
302
+ ## Examples
303
+
304
+ The [`examples/`](examples/) directory contains runnable demos:
305
+
306
+ | File | Demonstrates |
307
+ |------|--------------|
308
+ | `demo_quickstart.py` | Basic agent with filesystem tools |
309
+ | `demo_runtime.py` | Session lifecycle and event handling |
310
+ | `demo_observability.py` | Structured event streams |
311
+ | `demo_auto.py` | Auto-mode execution |
312
+ | `demo_kernel.py` | Low-level Kernel loop with fakes |
313
+ | `demo_real_model.py` | End-to-end run with a live provider |
314
+
315
+ ## Documentation
316
+
317
+ - [Getting Started](docs/getting-started.md) — Setup and your first agent
318
+ - [Tools Guide](docs/tools.md) — All built-in tools and usage patterns
319
+ - [API Reference](docs/api.md) — Core public API
320
+ - [Current State](docs/CURRENT.md) — What is implemented today
321
+ - [Decision Records](docs/decisions/) — Durable architectural decisions
322
+
323
+ ## Development
324
+
325
+ ```bash
326
+ # Clone and enter the repo
327
+ git clone https://github.com/xvshiting/kora.git
328
+ cd kora
329
+
330
+ # Isolated environment (Python 3.12+)
331
+ python3.12 -m venv .venv
332
+ source .venv/bin/activate
333
+
334
+ # Editable install with dev tooling
335
+ pip install -e ".[dev]"
336
+
337
+ # Editable install for kora-code agent (if working on it)
338
+ pip install -e ./agents/kora-code
339
+
340
+ # Verify
341
+ pytest # tests
342
+ mypy src/kora # type check
343
+ ruff check src/kora # lint
344
+ ```
345
+
346
+ Before making a substantial change, please read
347
+ [`CLAUDE.md`](CLAUDE.md) (project constitution) and
348
+ [`docs/CURRENT.md`](docs/CURRENT.md) (current design state).
349
+
350
+ ## Roadmap
351
+
352
+ Kora is currently **Alpha**. Active and planned work, summarized from
353
+ [`TODO.md`](TODO.md):
354
+
355
+ - **Host layer** — pluggable persistence, identity, and permissions
356
+ (a basic `load_agent_from_markdown` loader exists; full persistence
357
+ and tenancy are still pending).
358
+ - **Advanced features** — multi-agent collaboration, tool chaining,
359
+ memory/context management, streaming output.
360
+ - **CLI & deployment** — `kora` CLI, server mode, Docker support.
361
+ - **Provider hardening** — the provider-centric architecture is in place,
362
+ including multiple built-in providers, error handling, retries, and
363
+ streaming primitives; it still needs compatibility verification and
364
+ expanded integration coverage.
365
+
366
+ ## Contributing
367
+
368
+ Kora is intentionally small. When proposing changes:
369
+
370
+ 1. Identify which architectural layer owns the change.
371
+ 2. Prefer the smallest complete change; add tests with behavior changes.
372
+ 3. Do not cross established layer boundaries or move framework
373
+ responsibilities into user code.
374
+ 4. Update `TODO.md` and `docs/CURRENT.md` after substantial work, and
375
+ record durable decisions under `docs/decisions/` when necessary.
376
+
377
+ See [`CLAUDE.md`](CLAUDE.md) for the full development constitution.
378
+
379
+ ## License
380
+
381
+ MIT — see `license` field in [`pyproject.toml`](pyproject.toml).