a3s-code 0.6.0__tar.gz → 0.9.1__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 (270) hide show
  1. a3s_code-0.9.1/PKG-INFO +35 -0
  2. a3s_code-0.9.1/README.md +21 -0
  3. a3s_code-0.9.1/code/Cargo.toml +19 -0
  4. a3s_code-0.9.1/code/core/.gitignore +5 -0
  5. a3s_code-0.9.1/code/core/Cargo.toml +115 -0
  6. a3s_code-0.9.1/code/core/examples/01_basic_send.rs +83 -0
  7. a3s_code-0.9.1/code/core/examples/02_streaming.rs +108 -0
  8. a3s_code-0.9.1/code/core/examples/03_multi_turn.rs +106 -0
  9. a3s_code-0.9.1/code/core/examples/04_model_switching.rs +87 -0
  10. a3s_code-0.9.1/code/core/examples/05_planning.rs +126 -0
  11. a3s_code-0.9.1/code/core/examples/06_skills_security.rs +125 -0
  12. a3s_code-0.9.1/code/core/examples/07_direct_tools.rs +162 -0
  13. a3s_code-0.9.1/code/core/examples/08_hooks.rs +114 -0
  14. a3s_code-0.9.1/code/core/examples/09_queue_lanes.rs +139 -0
  15. a3s_code-0.9.1/code/core/examples/10_resilience.rs +116 -0
  16. a3s_code-0.9.1/code/core/examples/agentic_loop_demo.rs +465 -0
  17. a3s_code-0.9.1/code/core/examples/default_implementations.rs +154 -0
  18. a3s_code-0.9.1/code/core/examples/integration_tests.rs +286 -0
  19. a3s_code-0.9.1/code/core/examples/news-radar/agent.hcl +84 -0
  20. a3s_code-0.9.1/code/core/examples/news-radar/main.py +532 -0
  21. a3s_code-0.9.1/code/core/examples/news_radar.rs +441 -0
  22. a3s_code-0.9.1/code/core/examples/sdk_basic.rs +490 -0
  23. a3s_code-0.9.1/code/core/examples/sdk_chat.rs +225 -0
  24. a3s_code-0.9.1/code/core/examples/session_workspace.rs +223 -0
  25. a3s_code-0.9.1/code/core/examples/skills_demo.rs +198 -0
  26. a3s_code-0.9.1/code/core/examples/test_auto_compact.rs +51 -0
  27. a3s_code-0.9.1/code/core/examples/test_batch_tool.rs +53 -0
  28. a3s_code-0.9.1/code/core/examples/test_builtin_skills.rs +218 -0
  29. a3s_code-0.9.1/code/core/examples/test_custom_skills_agents.rs +209 -0
  30. a3s_code-0.9.1/code/core/examples/test_external_task_handler.rs +291 -0
  31. a3s_code-0.9.1/code/core/examples/test_git_worktree.rs +161 -0
  32. a3s_code-0.9.1/code/core/examples/test_hooks.rs +76 -0
  33. a3s_code-0.9.1/code/core/examples/test_lane_features.rs +370 -0
  34. a3s_code-0.9.1/code/core/examples/test_parallel_processing.rs +301 -0
  35. a3s_code-0.9.1/code/core/examples/test_prompt_slots.rs +124 -0
  36. a3s_code-0.9.1/code/core/examples/test_search_config.rs +335 -0
  37. a3s_code-0.9.1/code/core/examples/test_security.rs +51 -0
  38. a3s_code-0.9.1/code/core/examples/test_task_priority.rs +384 -0
  39. a3s_code-0.9.1/code/core/examples/test_vector_rag.rs +92 -0
  40. a3s_code-0.9.1/code/core/prompts/context_compact.md +37 -0
  41. a3s_code-0.9.1/code/core/prompts/continuation.md +4 -0
  42. a3s_code-0.9.1/code/core/prompts/llm_goal_check_system.md +2 -0
  43. a3s_code-0.9.1/code/core/prompts/llm_goal_extract_system.md +2 -0
  44. a3s_code-0.9.1/code/core/prompts/llm_plan_system.md +2 -0
  45. a3s_code-0.9.1/code/core/prompts/subagent_explore.md +14 -0
  46. a3s_code-0.9.1/code/core/prompts/subagent_plan.md +13 -0
  47. a3s_code-0.9.1/code/core/prompts/subagent_summary.md +8 -0
  48. a3s_code-0.9.1/code/core/prompts/subagent_title.md +3 -0
  49. a3s_code-0.9.1/code/core/prompts/system_default.md +51 -0
  50. a3s_code-0.9.1/code/core/prompts/title_generate.md +3 -0
  51. a3s_code-0.9.1/code/core/skills/builtin-tools.md +325 -0
  52. a3s_code-0.9.1/code/core/skills/delegate-task.md +58 -0
  53. a3s_code-0.9.1/code/core/skills/find-skills.md +134 -0
  54. a3s_code-0.9.1/code/core/src/agent.rs +5660 -0
  55. a3s_code-0.9.1/code/core/src/agent_api.rs +2045 -0
  56. a3s_code-0.9.1/code/core/src/agent_teams.rs +1180 -0
  57. a3s_code-0.9.1/code/core/src/commands.rs +578 -0
  58. a3s_code-0.9.1/code/core/src/config.rs +1554 -0
  59. a3s_code-0.9.1/code/core/src/context/embedding.rs +297 -0
  60. a3s_code-0.9.1/code/core/src/context/fs_provider.rs +337 -0
  61. a3s_code-0.9.1/code/core/src/context/mod.rs +807 -0
  62. a3s_code-0.9.1/code/core/src/context/vector_provider.rs +799 -0
  63. a3s_code-0.9.1/code/core/src/context/vector_store.rs +465 -0
  64. a3s_code-0.9.1/code/core/src/error.rs +233 -0
  65. a3s_code-0.9.1/code/core/src/file_history.rs +612 -0
  66. a3s_code-0.9.1/code/core/src/hitl.rs +989 -0
  67. a3s_code-0.9.1/code/core/src/hooks/engine.rs +763 -0
  68. a3s_code-0.9.1/code/core/src/hooks/events.rs +698 -0
  69. a3s_code-0.9.1/code/core/src/hooks/matcher.rs +480 -0
  70. a3s_code-0.9.1/code/core/src/hooks/mod.rs +186 -0
  71. a3s_code-0.9.1/code/core/src/lib.rs +112 -0
  72. a3s_code-0.9.1/code/core/src/llm/anthropic.rs +517 -0
  73. a3s_code-0.9.1/code/core/src/llm/factory.rs +139 -0
  74. a3s_code-0.9.1/code/core/src/llm/http.rs +239 -0
  75. a3s_code-0.9.1/code/core/src/llm/mod.rs +47 -0
  76. a3s_code-0.9.1/code/core/src/llm/openai.rs +637 -0
  77. a3s_code-0.9.1/code/core/src/llm/tests.rs +3128 -0
  78. a3s_code-0.9.1/code/core/src/llm/types.rs +408 -0
  79. a3s_code-0.9.1/code/core/src/mcp/client.rs +374 -0
  80. a3s_code-0.9.1/code/core/src/mcp/manager.rs +545 -0
  81. a3s_code-0.9.1/code/core/src/mcp/mod.rs +72 -0
  82. a3s_code-0.9.1/code/core/src/mcp/protocol.rs +1161 -0
  83. a3s_code-0.9.1/code/core/src/mcp/tools.rs +148 -0
  84. a3s_code-0.9.1/code/core/src/mcp/transport/http_sse.rs +508 -0
  85. a3s_code-0.9.1/code/core/src/mcp/transport/mod.rs +32 -0
  86. a3s_code-0.9.1/code/core/src/mcp/transport/stdio.rs +361 -0
  87. a3s_code-0.9.1/code/core/src/memory.rs +436 -0
  88. a3s_code-0.9.1/code/core/src/permissions.rs +1076 -0
  89. a3s_code-0.9.1/code/core/src/planning/llm_planner.rs +483 -0
  90. a3s_code-0.9.1/code/core/src/planning/mod.rs +692 -0
  91. a3s_code-0.9.1/code/core/src/prompts.rs +396 -0
  92. a3s_code-0.9.1/code/core/src/queue.rs +509 -0
  93. a3s_code-0.9.1/code/core/src/retry.rs +516 -0
  94. a3s_code-0.9.1/code/core/src/sandbox.rs +339 -0
  95. a3s_code-0.9.1/code/core/src/security/config.rs +147 -0
  96. a3s_code-0.9.1/code/core/src/security/default.rs +364 -0
  97. a3s_code-0.9.1/code/core/src/security/mod.rs +70 -0
  98. a3s_code-0.9.1/code/core/src/session/compaction.rs +407 -0
  99. a3s_code-0.9.1/code/core/src/session/manager.rs +1230 -0
  100. a3s_code-0.9.1/code/core/src/session/mod.rs +603 -0
  101. a3s_code-0.9.1/code/core/src/session/tests.rs +1967 -0
  102. a3s_code-0.9.1/code/core/src/session_lane_queue.rs +905 -0
  103. a3s_code-0.9.1/code/core/src/skills/builtin.rs +427 -0
  104. a3s_code-0.9.1/code/core/src/skills/feedback.rs +390 -0
  105. a3s_code-0.9.1/code/core/src/skills/manage.rs +804 -0
  106. a3s_code-0.9.1/code/core/src/skills/mod.rs +290 -0
  107. a3s_code-0.9.1/code/core/src/skills/registry.rs +642 -0
  108. a3s_code-0.9.1/code/core/src/skills/validator.rs +437 -0
  109. a3s_code-0.9.1/code/core/src/store.rs +791 -0
  110. a3s_code-0.9.1/code/core/src/subagent.rs +799 -0
  111. a3s_code-0.9.1/code/core/src/telemetry.rs +958 -0
  112. a3s_code-0.9.1/code/core/src/telemetry_otel.rs +199 -0
  113. a3s_code-0.9.1/code/core/src/tool_search.rs +418 -0
  114. a3s_code-0.9.1/code/core/src/tools/builtin/bash.rs +262 -0
  115. a3s_code-0.9.1/code/core/src/tools/builtin/batch.rs +375 -0
  116. a3s_code-0.9.1/code/core/src/tools/builtin/codesearch.rs +342 -0
  117. a3s_code-0.9.1/code/core/src/tools/builtin/edit.rs +221 -0
  118. a3s_code-0.9.1/code/core/src/tools/builtin/git_worktree.rs +495 -0
  119. a3s_code-0.9.1/code/core/src/tools/builtin/glob_tool.rs +172 -0
  120. a3s_code-0.9.1/code/core/src/tools/builtin/grep.rs +266 -0
  121. a3s_code-0.9.1/code/core/src/tools/builtin/ls.rs +181 -0
  122. a3s_code-0.9.1/code/core/src/tools/builtin/mod.rs +54 -0
  123. a3s_code-0.9.1/code/core/src/tools/builtin/patch.rs +348 -0
  124. a3s_code-0.9.1/code/core/src/tools/builtin/read.rs +174 -0
  125. a3s_code-0.9.1/code/core/src/tools/builtin/sandbox_tool.rs +219 -0
  126. a3s_code-0.9.1/code/core/src/tools/builtin/web_fetch.rs +221 -0
  127. a3s_code-0.9.1/code/core/src/tools/builtin/web_search.rs +365 -0
  128. a3s_code-0.9.1/code/core/src/tools/builtin/write.rs +167 -0
  129. a3s_code-0.9.1/code/core/src/tools/mod.rs +418 -0
  130. a3s_code-0.9.1/code/core/src/tools/process.rs +74 -0
  131. a3s_code-0.9.1/code/core/src/tools/registry.rs +447 -0
  132. a3s_code-0.9.1/code/core/src/tools/task.rs +944 -0
  133. a3s_code-0.9.1/code/core/src/tools/types.rs +240 -0
  134. a3s_code-0.9.1/code/core/tests/integration.rs +702 -0
  135. a3s_code-0.9.1/code/core/tests/skill_permissions_test.rs +194 -0
  136. a3s_code-0.9.1/code/core/tests/skill_system_prompt_test.rs +140 -0
  137. a3s_code-0.9.1/code/sdk/python/.gitignore +9 -0
  138. a3s_code-0.9.1/code/sdk/python/Cargo.lock +3967 -0
  139. a3s_code-0.9.1/code/sdk/python/Cargo.toml +21 -0
  140. a3s_code-0.9.1/code/sdk/python/README.md +21 -0
  141. a3s_code-0.9.1/code/sdk/python/examples/advanced_features_demo.py +314 -0
  142. a3s_code-0.9.1/code/sdk/python/examples/agentic_loop_demo.py +363 -0
  143. a3s_code-0.9.1/code/sdk/python/examples/integration_tests.py +249 -0
  144. a3s_code-0.9.1/code/sdk/python/examples/quick_test.py +41 -0
  145. a3s_code-0.9.1/code/sdk/python/examples/test_advanced_features.py +224 -0
  146. a3s_code-0.9.1/code/sdk/python/examples/test_agent_teams.py +202 -0
  147. a3s_code-0.9.1/code/sdk/python/examples/test_custom_skills_agents.py +190 -0
  148. a3s_code-0.9.1/code/sdk/python/examples/test_external_task_handler.py +232 -0
  149. a3s_code-0.9.1/code/sdk/python/examples/test_git_worktree.py +112 -0
  150. a3s_code-0.9.1/code/sdk/python/examples/test_parallel_processing.py +274 -0
  151. a3s_code-0.9.1/code/sdk/python/examples/test_prompt_slots.py +95 -0
  152. a3s_code-0.9.1/code/sdk/python/examples/test_search_config.py +224 -0
  153. a3s_code-0.9.1/code/sdk/python/examples/test_task_priority.py +284 -0
  154. a3s_code-0.9.1/code/sdk/python/src/lib.rs +2364 -0
  155. a3s_code-0.9.1/common/Cargo.lock +979 -0
  156. a3s_code-0.9.1/common/Cargo.toml +25 -0
  157. a3s_code-0.9.1/common/src/lib.rs +15 -0
  158. a3s_code-0.9.1/common/src/privacy.rs +461 -0
  159. a3s_code-0.9.1/common/src/tools.rs +96 -0
  160. a3s_code-0.9.1/common/src/transport/codec.rs +274 -0
  161. a3s_code-0.9.1/common/src/transport/frame.rs +192 -0
  162. a3s_code-0.9.1/common/src/transport/mod.rs +257 -0
  163. a3s_code-0.9.1/common/src/transport/tee.rs +133 -0
  164. a3s_code-0.9.1/common/src/transport/unix.rs +183 -0
  165. a3s_code-0.9.1/lane/.github/setup-workspace.sh +58 -0
  166. a3s_code-0.9.1/lane/.github/workflows/ci.yml +30 -0
  167. a3s_code-0.9.1/lane/.github/workflows/publish-node.yml +138 -0
  168. a3s_code-0.9.1/lane/.github/workflows/publish-python.yml +95 -0
  169. a3s_code-0.9.1/lane/.github/workflows/release.yml +112 -0
  170. a3s_code-0.9.1/lane/.gitignore +35 -0
  171. a3s_code-0.9.1/lane/Cargo.lock +1453 -0
  172. a3s_code-0.9.1/lane/Cargo.toml +68 -0
  173. a3s_code-0.9.1/lane/README.md +380 -0
  174. a3s_code-0.9.1/lane/benches/queue_benchmark.rs +277 -0
  175. a3s_code-0.9.1/lane/examples/basic_usage.rs +104 -0
  176. a3s_code-0.9.1/lane/examples/observability.rs +198 -0
  177. a3s_code-0.9.1/lane/examples/priority_preemption.rs +313 -0
  178. a3s_code-0.9.1/lane/examples/priority_scheduling.rs +389 -0
  179. a3s_code-0.9.1/lane/examples/reliability.rs +219 -0
  180. a3s_code-0.9.1/lane/examples/scalability.rs +195 -0
  181. a3s_code-0.9.1/lane/justfile +509 -0
  182. a3s_code-0.9.1/lane/src/alerts.rs +583 -0
  183. a3s_code-0.9.1/lane/src/boost.rs +330 -0
  184. a3s_code-0.9.1/lane/src/config.rs +375 -0
  185. a3s_code-0.9.1/lane/src/distributed.rs +457 -0
  186. a3s_code-0.9.1/lane/src/dlq.rs +236 -0
  187. a3s_code-0.9.1/lane/src/error.rs +145 -0
  188. a3s_code-0.9.1/lane/src/event.rs +376 -0
  189. a3s_code-0.9.1/lane/src/lib.rs +206 -0
  190. a3s_code-0.9.1/lane/src/manager.rs +901 -0
  191. a3s_code-0.9.1/lane/src/metrics.rs +718 -0
  192. a3s_code-0.9.1/lane/src/monitor.rs +497 -0
  193. a3s_code-0.9.1/lane/src/partition.rs +295 -0
  194. a3s_code-0.9.1/lane/src/queue.rs +1737 -0
  195. a3s_code-0.9.1/lane/src/ratelimit.rs +429 -0
  196. a3s_code-0.9.1/lane/src/retry.rs +191 -0
  197. a3s_code-0.9.1/lane/src/storage.rs +383 -0
  198. a3s_code-0.9.1/lane/src/telemetry.rs +396 -0
  199. a3s_code-0.9.1/memory/.github/workflows/ci.yml +41 -0
  200. a3s_code-0.9.1/memory/.github/workflows/release.yml +77 -0
  201. a3s_code-0.9.1/memory/.gitignore +1 -0
  202. a3s_code-0.9.1/memory/Cargo.lock +710 -0
  203. a3s_code-0.9.1/memory/Cargo.toml +26 -0
  204. a3s_code-0.9.1/memory/README.md +122 -0
  205. a3s_code-0.9.1/memory/src/lib.rs +1055 -0
  206. a3s_code-0.9.1/memory/tests/integration.rs +402 -0
  207. a3s_code-0.9.1/pyproject.toml +23 -0
  208. a3s_code-0.9.1/search/.github/setup-workspace.sh +92 -0
  209. a3s_code-0.9.1/search/.github/workflows/publish-node.yml +153 -0
  210. a3s_code-0.9.1/search/.github/workflows/publish-python.yml +97 -0
  211. a3s_code-0.9.1/search/.github/workflows/release.yml +311 -0
  212. a3s_code-0.9.1/search/.gitignore +5 -0
  213. a3s_code-0.9.1/search/Cargo.lock +3229 -0
  214. a3s_code-0.9.1/search/Cargo.toml +100 -0
  215. a3s_code-0.9.1/search/LICENSE +21 -0
  216. a3s_code-0.9.1/search/README.md +981 -0
  217. a3s_code-0.9.1/search/examples/basic_search.rs +55 -0
  218. a3s_code-0.9.1/search/examples/chinese_search.rs +58 -0
  219. a3s_code-0.9.1/search/justfile +538 -0
  220. a3s_code-0.9.1/search/src/aggregator.rs +293 -0
  221. a3s_code-0.9.1/search/src/browser.rs +435 -0
  222. a3s_code-0.9.1/search/src/browser_setup.rs +640 -0
  223. a3s_code-0.9.1/search/src/config.rs +346 -0
  224. a3s_code-0.9.1/search/src/engine.rs +215 -0
  225. a3s_code-0.9.1/search/src/engines/baidu.rs +194 -0
  226. a3s_code-0.9.1/search/src/engines/bing.rs +323 -0
  227. a3s_code-0.9.1/search/src/engines/bing_china.rs +214 -0
  228. a3s_code-0.9.1/search/src/engines/brave.rs +194 -0
  229. a3s_code-0.9.1/search/src/engines/duckduckgo.rs +325 -0
  230. a3s_code-0.9.1/search/src/engines/google.rs +370 -0
  231. a3s_code-0.9.1/search/src/engines/mod.rs +34 -0
  232. a3s_code-0.9.1/search/src/engines/so360.rs +187 -0
  233. a3s_code-0.9.1/search/src/engines/sogou.rs +183 -0
  234. a3s_code-0.9.1/search/src/engines/wikipedia.rs +278 -0
  235. a3s_code-0.9.1/search/src/error.rs +128 -0
  236. a3s_code-0.9.1/search/src/fetcher.rs +149 -0
  237. a3s_code-0.9.1/search/src/fetcher_http.rs +235 -0
  238. a3s_code-0.9.1/search/src/health.rs +201 -0
  239. a3s_code-0.9.1/search/src/html_engine.rs +110 -0
  240. a3s_code-0.9.1/search/src/lib.rs +130 -0
  241. a3s_code-0.9.1/search/src/main.rs +655 -0
  242. a3s_code-0.9.1/search/src/proxy.rs +696 -0
  243. a3s_code-0.9.1/search/src/query.rs +210 -0
  244. a3s_code-0.9.1/search/src/result.rs +388 -0
  245. a3s_code-0.9.1/search/src/search.rs +615 -0
  246. a3s_code-0.9.1/search/tests/integration.rs +586 -0
  247. a3s_code-0.9.1/updater/Cargo.toml +18 -0
  248. a3s_code-0.9.1/updater/src/download.rs +86 -0
  249. a3s_code-0.9.1/updater/src/github.rs +85 -0
  250. a3s_code-0.9.1/updater/src/install.rs +66 -0
  251. a3s_code-0.9.1/updater/src/lib.rs +193 -0
  252. a3s_code-0.9.1/updater/src/platform.rs +22 -0
  253. a3s_code-0.6.0/.gitignore +0 -93
  254. a3s_code-0.6.0/MANIFEST.in +0 -31
  255. a3s_code-0.6.0/PKG-INFO +0 -717
  256. a3s_code-0.6.0/README.md +0 -683
  257. a3s_code-0.6.0/a3s_code/__init__.py +0 -205
  258. a3s_code-0.6.0/a3s_code/client.py +0 -2600
  259. a3s_code-0.6.0/a3s_code/provider.py +0 -63
  260. a3s_code-0.6.0/a3s_code/py.typed +0 -1
  261. a3s_code-0.6.0/a3s_code/session.py +0 -625
  262. a3s_code-0.6.0/a3s_code/types.py +0 -757
  263. a3s_code-0.6.0/justfile +0 -292
  264. a3s_code-0.6.0/proto/code_agent.proto +0 -1851
  265. a3s_code-0.6.0/pyproject.toml +0 -63
  266. a3s_code-0.6.0/pytest.ini +0 -6
  267. a3s_code-0.6.0/tests/conftest.py +0 -16
  268. a3s_code-0.6.0/tests/test_client.py +0 -593
  269. a3s_code-0.6.0/tests/test_e2e.py +0 -789
  270. {a3s_code-0.6.0 → a3s_code-0.9.1/lane}/LICENSE +0 -0
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.4
2
+ Name: a3s-code
3
+ Version: 0.9.1
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Summary: A3S Code - Native Python bindings for the AI coding agent
10
+ License: MIT
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
13
+
14
+ # A3S Code - Native Python Bindings
15
+
16
+ Native Python module for the A3S Code AI coding agent, built with PyO3.
17
+
18
+ ```python
19
+ from a3s_code import Agent
20
+
21
+ agent = Agent(model="claude-sonnet-4-20250514", api_key="sk-ant-...", workspace="/project")
22
+ result = agent.send("What files handle auth?")
23
+ print(result.text)
24
+ ```
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install a3s-code
30
+ ```
31
+
32
+ ## License
33
+
34
+ MIT
35
+
@@ -0,0 +1,21 @@
1
+ # A3S Code - Native Python Bindings
2
+
3
+ Native Python module for the A3S Code AI coding agent, built with PyO3.
4
+
5
+ ```python
6
+ from a3s_code import Agent
7
+
8
+ agent = Agent(model="claude-sonnet-4-20250514", api_key="sk-ant-...", workspace="/project")
9
+ result = agent.send("What files handle auth?")
10
+ print(result.text)
11
+ ```
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install a3s-code
17
+ ```
18
+
19
+ ## License
20
+
21
+ MIT
@@ -0,0 +1,19 @@
1
+ [workspace]
2
+ resolver = "2"
3
+ members = [
4
+ "core",
5
+ "cli",
6
+ ]
7
+ # Native SDK crates require special toolchains (Python/Node.js)
8
+ # Build them individually: cargo build -p a3s-code-node / a3s-code-py
9
+ exclude = [
10
+ "sdk/node",
11
+ "sdk/python",
12
+ ]
13
+
14
+ [profile.release]
15
+ opt-level = "z"
16
+ lto = "fat"
17
+ codegen-units = 1
18
+ strip = true
19
+ panic = "abort"
@@ -0,0 +1,5 @@
1
+ /target
2
+ Cargo.lock
3
+ .a3s/
4
+ .cargo/
5
+ .claude/
@@ -0,0 +1,115 @@
1
+ [package]
2
+ name = "a3s-code-core"
3
+ version = "0.9.1"
4
+ edition = "2021"
5
+ authors = ["A3S Lab Team"]
6
+ license = "MIT"
7
+ repository = "https://github.com/A3S-Lab/Code"
8
+ description = "A3S Code Core - Embeddable AI agent library with tool execution"
9
+
10
+ [lib]
11
+ name = "a3s_code_core"
12
+ path = "src/lib.rs"
13
+
14
+ [dependencies]
15
+ # Internal crates
16
+ a3s-common = { version = "0.1", path = "../../common" }
17
+ a3s-memory = { version = "0.1", path = "../../memory" }
18
+ a3s-lane = { version = "0.4", path = "../../lane" }
19
+ a3s-search = { version = "0.8", path = "../../search", default-features = false }
20
+ # Sandbox integration (optional — requires `sandbox` feature)
21
+ a3s-box-sdk = { version = "0.6", path = "../../box/src/sdk", optional = true }
22
+
23
+ # Async runtime
24
+ tokio = { version = "1.35", features = [
25
+ "rt-multi-thread", "sync", "time", "io-util",
26
+ "process", "fs", "macros"
27
+ ] }
28
+ tokio-stream = { version = "0.1", features = ["net"] }
29
+ tokio-util = { version = "0.7", features = ["codec"] }
30
+
31
+ # Serialization
32
+ serde = { version = "1.0", features = ["derive"] }
33
+ serde_json = "1.0"
34
+ serde_yaml = "0.9"
35
+
36
+ # HCL config parsing
37
+ hcl-rs = "0.18"
38
+
39
+ # Error handling
40
+ anyhow = "1.0"
41
+ thiserror = "1.0"
42
+
43
+ # Logging (tracing only — no OTel)
44
+ tracing = "0.1"
45
+ tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
46
+
47
+ # OpenTelemetry (optional — requires `telemetry` feature)
48
+ opentelemetry = { version = "0.27", optional = true }
49
+ opentelemetry_sdk = { version = "0.27", features = ["rt-tokio"], optional = true }
50
+ opentelemetry-otlp = { version = "0.27", features = ["tonic"], optional = true }
51
+ tracing-opentelemetry = { version = "0.28", optional = true }
52
+
53
+ # Async utilities
54
+ futures = "0.3"
55
+ async-trait = "0.1"
56
+ async-stream = "0.3"
57
+
58
+ # HTTP client for LLM APIs
59
+ reqwest = { version = "0.11", default-features = false, features = ["json", "stream", "rustls-tls"] }
60
+
61
+ # File operations
62
+ glob = "0.3"
63
+ ignore = "0.4"
64
+
65
+ # Diff for edit tool
66
+ similar = "2.4"
67
+
68
+ # Home directory for project memory
69
+ dirs = "5.0"
70
+
71
+ # Regex for template substitution
72
+ regex = "1.10"
73
+
74
+ # SHA256 for security provider
75
+ sha256 = "1.5"
76
+
77
+ # Shell argument parsing
78
+ shell-words = "1.1"
79
+
80
+ # HTML to text/markdown conversion
81
+ html2text = "0.16"
82
+ htmd = "0.5"
83
+
84
+ # Base64 for image encoding
85
+ base64 = "0.21"
86
+
87
+ # Bytes for streaming
88
+ bytes = "1.5"
89
+
90
+ # Pin for futures
91
+ pin-project-lite = "0.2"
92
+
93
+ # UUID
94
+ uuid = { version = "1.6", features = ["v4", "serde"] }
95
+
96
+ # Time handling
97
+ chrono = { version = "0.4", features = ["serde"] }
98
+
99
+ [features]
100
+ default = []
101
+ # Enable A3S Box sandbox integration for the `bash` tool.
102
+ # When active, `SessionOptions::with_sandbox()` routes bash commands through
103
+ # a MicroVM sandbox instead of `std::process::Command`.
104
+ sandbox = ["dep:a3s-box-sdk"]
105
+ # Enable OpenTelemetry OTLP export for traces and metrics.
106
+ # When active, `TelemetryConfig::init()` sets up OTLP exporter + tracing subscriber.
107
+ telemetry = [
108
+ "dep:opentelemetry",
109
+ "dep:opentelemetry_sdk",
110
+ "dep:opentelemetry-otlp",
111
+ "dep:tracing-opentelemetry",
112
+ ]
113
+
114
+ [dev-dependencies]
115
+ tempfile = "3.10"
@@ -0,0 +1,83 @@
1
+ //! # Basic Send — Non-Streaming Agent Execution
2
+ //!
3
+ //! The simplest possible A3S Code example: create an agent from config,
4
+ //! bind to a workspace, send a prompt, and print the result.
5
+ //!
6
+ //! ```bash
7
+ //! cd crates/code
8
+ //! cargo run --example 01_basic_send
9
+ //! ```
10
+
11
+ use a3s_code_core::Agent;
12
+ use std::path::PathBuf;
13
+ use tempfile::TempDir;
14
+
15
+ fn find_config() -> PathBuf {
16
+ if let Ok(p) = std::env::var("A3S_CONFIG") {
17
+ return PathBuf::from(p);
18
+ }
19
+ let home = dirs::home_dir().expect("no home dir");
20
+ let home_cfg = home.join(".a3s/config.hcl");
21
+ if home_cfg.exists() {
22
+ return home_cfg;
23
+ }
24
+ // Project root
25
+ let project_cfg = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../.a3s/config.hcl");
26
+ if project_cfg.exists() {
27
+ return project_cfg;
28
+ }
29
+ panic!("Config not found. Create ~/.a3s/config.hcl or set A3S_CONFIG");
30
+ }
31
+
32
+ #[tokio::main]
33
+ async fn main() -> anyhow::Result<()> {
34
+ tracing_subscriber::fmt()
35
+ .with_env_filter("a3s_code_core=info")
36
+ .init();
37
+
38
+ let config = find_config();
39
+ println!("Config: {}", config.display());
40
+
41
+ // 1. Create agent from config
42
+ let agent = Agent::new(config.to_str().unwrap()).await?;
43
+ println!("Agent created ✓");
44
+
45
+ // 2. Create a temp workspace
46
+ let workspace = TempDir::new()?;
47
+ let session = agent.session(workspace.path().to_str().unwrap(), None)?;
48
+ println!("Session bound to: {}\n", workspace.path().display());
49
+
50
+ // 3. Send a prompt (non-streaming)
51
+ let result = session
52
+ .send(
53
+ "Create a file called hello.rs with a main function that prints 'Hello, A3S!'.\n\
54
+ Then read the file back and confirm it looks correct.",
55
+ None,
56
+ )
57
+ .await?;
58
+
59
+ println!("─── Result ───");
60
+ println!("Text: {}", truncate(&result.text, 200));
61
+ println!("Tool calls: {}", result.tool_calls_count);
62
+ println!("Tokens: {} total", result.usage.total_tokens);
63
+
64
+ // 4. Verify the file
65
+ let hello = workspace.path().join("hello.rs");
66
+ if hello.exists() {
67
+ println!(
68
+ "\n✓ hello.rs created ({} bytes)",
69
+ std::fs::metadata(&hello)?.len()
70
+ );
71
+ }
72
+
73
+ Ok(())
74
+ }
75
+
76
+ fn truncate(s: &str, max: usize) -> String {
77
+ let s = s.trim();
78
+ if s.len() <= max {
79
+ s.to_string()
80
+ } else {
81
+ format!("{}…", &s[..max])
82
+ }
83
+ }
@@ -0,0 +1,108 @@
1
+ //! # Streaming Events — Real-Time Agent Visibility
2
+ //!
3
+ //! Subscribe to the agent's event stream to watch it think and act in real time.
4
+ //! Demonstrates all event types: TextDelta, ToolStart, ToolEnd, TurnStart, etc.
5
+ //!
6
+ //! ```bash
7
+ //! cargo run --example 02_streaming
8
+ //! ```
9
+
10
+ use a3s_code_core::{Agent, AgentEvent};
11
+ use std::path::PathBuf;
12
+ use tempfile::TempDir;
13
+
14
+ fn find_config() -> PathBuf {
15
+ if let Ok(p) = std::env::var("A3S_CONFIG") {
16
+ return PathBuf::from(p);
17
+ }
18
+ let home = dirs::home_dir().expect("no home dir");
19
+ let candidates = [
20
+ home.join(".a3s/config.hcl"),
21
+ PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../.a3s/config.hcl"),
22
+ ];
23
+ candidates
24
+ .into_iter()
25
+ .find(|p| p.exists())
26
+ .expect("Config not found. Set A3S_CONFIG or create ~/.a3s/config.hcl")
27
+ }
28
+
29
+ #[tokio::main]
30
+ async fn main() -> anyhow::Result<()> {
31
+ let agent = Agent::new(find_config().to_str().unwrap()).await?;
32
+ let workspace = TempDir::new()?;
33
+
34
+ // Pre-create a file for the agent to work with
35
+ std::fs::write(
36
+ workspace.path().join("users.json"),
37
+ r#"[{"name":"Alice","role":"admin"},{"name":"Bob","role":"viewer"},{"name":"Carol","role":"editor"}]"#,
38
+ )?;
39
+
40
+ let session = agent.session(workspace.path().to_str().unwrap(), None)?;
41
+ println!(
42
+ "Streaming example — workspace: {}\n",
43
+ workspace.path().display()
44
+ );
45
+
46
+ // Stream returns (receiver, join_handle)
47
+ let (mut rx, _handle) = session
48
+ .stream(
49
+ "Read users.json, then create a Markdown table in users.md listing each user's name and role.",
50
+ None,
51
+ )
52
+ .await?;
53
+
54
+ let mut tool_count = 0usize;
55
+ let mut text_chars = 0usize;
56
+
57
+ while let Some(event) = rx.recv().await {
58
+ match event {
59
+ AgentEvent::Start { .. } => {
60
+ println!("▶ Agent started");
61
+ }
62
+ AgentEvent::TurnStart { turn } => {
63
+ println!("┌─ Turn {turn}");
64
+ }
65
+ AgentEvent::ToolStart { name, .. } => {
66
+ tool_count += 1;
67
+ print!("│ 🔧 {name}...");
68
+ }
69
+ AgentEvent::ToolEnd { exit_code, .. } => {
70
+ let icon = if exit_code == 0 { "✓" } else { "✗" };
71
+ println!(" {icon}");
72
+ }
73
+ AgentEvent::ToolInputDelta { .. } => {
74
+ // Tool argument streaming — could show partial JSON here
75
+ }
76
+ AgentEvent::TextDelta { text } => {
77
+ text_chars += text.len();
78
+ }
79
+ AgentEvent::TurnEnd { turn, usage } => {
80
+ println!("└─ Turn {turn} done ({} tokens)", usage.total_tokens);
81
+ }
82
+ AgentEvent::End { usage, .. } => {
83
+ println!("\n■ Agent finished");
84
+ println!(
85
+ " Tools: {tool_count}, Text: {text_chars} chars, Tokens: {}",
86
+ usage.total_tokens
87
+ );
88
+ break;
89
+ }
90
+ AgentEvent::Error { message } => {
91
+ eprintln!("✗ Error: {message}");
92
+ break;
93
+ }
94
+ _ => {} // #[non_exhaustive] — always include wildcard
95
+ }
96
+ }
97
+
98
+ // Verify output
99
+ let md = workspace.path().join("users.md");
100
+ if md.exists() {
101
+ println!(
102
+ "\n✓ users.md created ({} bytes)",
103
+ std::fs::metadata(&md)?.len()
104
+ );
105
+ }
106
+
107
+ Ok(())
108
+ }
@@ -0,0 +1,106 @@
1
+ //! # Multi-Turn Conversation — Context Preservation
2
+ //!
3
+ //! Demonstrates that the session preserves conversation history across
4
+ //! multiple send() calls, so the LLM remembers what happened earlier.
5
+ //!
6
+ //! ```bash
7
+ //! cargo run --example 03_multi_turn
8
+ //! ```
9
+
10
+ use a3s_code_core::Agent;
11
+ use std::path::PathBuf;
12
+ use tempfile::TempDir;
13
+
14
+ fn find_config() -> PathBuf {
15
+ if let Ok(p) = std::env::var("A3S_CONFIG") {
16
+ return PathBuf::from(p);
17
+ }
18
+ let home = dirs::home_dir().expect("no home dir");
19
+ let candidates = [
20
+ home.join(".a3s/config.hcl"),
21
+ PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../.a3s/config.hcl"),
22
+ ];
23
+ candidates
24
+ .into_iter()
25
+ .find(|p| p.exists())
26
+ .expect("Config not found. Set A3S_CONFIG or create ~/.a3s/config.hcl")
27
+ }
28
+
29
+ #[tokio::main]
30
+ async fn main() -> anyhow::Result<()> {
31
+ let agent = Agent::new(find_config().to_str().unwrap()).await?;
32
+ let workspace = TempDir::new()?;
33
+ let session = agent.session(workspace.path().to_str().unwrap(), None)?;
34
+
35
+ println!(
36
+ "Multi-turn example — workspace: {}\n",
37
+ workspace.path().display()
38
+ );
39
+
40
+ // ── Turn 1: Create a config file ──
41
+ println!("[Turn 1] Create a config file");
42
+ let r1 = session
43
+ .send(
44
+ "Create a file called `config.toml` with:\n\
45
+ [server]\nhost = \"0.0.0.0\"\nport = 8080\n\n\
46
+ [database]\nurl = \"postgres://localhost/mydb\"\npool_size = 5",
47
+ None,
48
+ )
49
+ .await?;
50
+ println!(
51
+ " Tools: {}, Tokens: {}",
52
+ r1.tool_calls_count, r1.usage.total_tokens
53
+ );
54
+
55
+ // ── Turn 2: Ask about the file (tests context memory) ──
56
+ println!("\n[Turn 2] Ask about the file");
57
+ let r2 = session
58
+ .send(
59
+ "What port is the server configured to use? Read the config file to confirm.",
60
+ None,
61
+ )
62
+ .await?;
63
+ println!(
64
+ " Tools: {}, Tokens: {}",
65
+ r2.tool_calls_count, r2.usage.total_tokens
66
+ );
67
+ println!(" Answer: {}", truncate(&r2.text, 120));
68
+
69
+ // ── Turn 3: Modify based on context ──
70
+ println!("\n[Turn 3] Modify based on previous context");
71
+ let r3 = session
72
+ .send(
73
+ "Change the server port to 3000 and increase pool_size to 10.",
74
+ None,
75
+ )
76
+ .await?;
77
+ println!(
78
+ " Tools: {}, Tokens: {}",
79
+ r3.tool_calls_count, r3.usage.total_tokens
80
+ );
81
+
82
+ // ── Verify ──
83
+ let history = session.history();
84
+ println!("\nHistory: {} messages across 3 turns", history.len());
85
+
86
+ let config_path = workspace.path().join("config.toml");
87
+ if config_path.exists() {
88
+ let content = std::fs::read_to_string(&config_path)?;
89
+ println!(
90
+ "✓ config.toml: port=3000? {} pool=10? {}",
91
+ content.contains("3000"),
92
+ content.contains("10")
93
+ );
94
+ }
95
+
96
+ Ok(())
97
+ }
98
+
99
+ fn truncate(s: &str, max: usize) -> String {
100
+ let s = s.trim();
101
+ if s.len() <= max {
102
+ s.to_string()
103
+ } else {
104
+ format!("{}…", &s[..max])
105
+ }
106
+ }
@@ -0,0 +1,87 @@
1
+ //! # Model Switching — Use Different Providers Per Session
2
+ //!
3
+ //! Shows how to override the default model on a per-session basis.
4
+ //! Each session can target a different provider/model from the config.
5
+ //!
6
+ //! ```bash
7
+ //! cargo run --example 04_model_switching
8
+ //! ```
9
+
10
+ use a3s_code_core::{Agent, SessionOptions};
11
+ use std::path::PathBuf;
12
+ use tempfile::TempDir;
13
+
14
+ fn find_config() -> PathBuf {
15
+ if let Ok(p) = std::env::var("A3S_CONFIG") {
16
+ return PathBuf::from(p);
17
+ }
18
+ let home = dirs::home_dir().expect("no home dir");
19
+ let candidates = [
20
+ home.join(".a3s/config.hcl"),
21
+ PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../.a3s/config.hcl"),
22
+ ];
23
+ candidates
24
+ .into_iter()
25
+ .find(|p| p.exists())
26
+ .expect("Config not found. Set A3S_CONFIG or create ~/.a3s/config.hcl")
27
+ }
28
+
29
+ #[tokio::main]
30
+ async fn main() -> anyhow::Result<()> {
31
+ let agent = Agent::new(find_config().to_str().unwrap()).await?;
32
+
33
+ let prompt = "What model are you? Reply in one short sentence.";
34
+
35
+ // ── Session 1: Default model (from config's default_model) ──
36
+ println!("─── Session 1: Default model ───");
37
+ let ws1 = TempDir::new()?;
38
+ let s1 = agent.session(ws1.path().to_str().unwrap(), None)?;
39
+ let r1 = s1.send(prompt, None).await?;
40
+ println!(" Response: {}", r1.text.trim());
41
+ println!(" Tokens: {}\n", r1.usage.total_tokens);
42
+
43
+ // ── Session 2: Override to a specific model ──
44
+ // Use the model specified by A3S_ALT_MODEL env var, or try "anthropic/claude-sonnet-4-20250514"
45
+ let alt_model = std::env::var("A3S_ALT_MODEL")
46
+ .unwrap_or_else(|_| "anthropic/claude-sonnet-4-20250514".to_string());
47
+
48
+ println!("─── Session 2: Override to {alt_model} ───");
49
+ let ws2 = TempDir::new()?;
50
+ let opts = SessionOptions::new().with_model(&alt_model);
51
+ match agent.session(ws2.path().to_str().unwrap(), Some(opts)) {
52
+ Ok(s2) => {
53
+ let r2 = s2.send(prompt, None).await?;
54
+ println!(" Response: {}", r2.text.trim());
55
+ println!(" Tokens: {}\n", r2.usage.total_tokens);
56
+ }
57
+ Err(e) => {
58
+ println!(" Skipped (model not in config): {e}\n");
59
+ }
60
+ }
61
+
62
+ // ── Session 3: Override with temperature=0.0 (deterministic) ──
63
+ println!("─── Session 3: With temperature=0.0 (deterministic) ───");
64
+ // Use the default model but with temperature override
65
+ // Note: temperature/thinking_budget require a model override to take effect
66
+ let default_model =
67
+ std::env::var("A3S_MODEL").unwrap_or_else(|_| "openai/kimi-k2.5".to_string());
68
+
69
+ let ws3 = TempDir::new()?;
70
+ let opts = SessionOptions::new()
71
+ .with_model(&default_model)
72
+ .with_temperature(0.0);
73
+ match agent.session(ws3.path().to_str().unwrap(), Some(opts)) {
74
+ Ok(s3) => {
75
+ let r3 = s3
76
+ .send("What is 2 + 2? Reply with just the number.", None)
77
+ .await?;
78
+ println!(" Response: {}", r3.text.trim());
79
+ println!(" Tokens: {}", r3.usage.total_tokens);
80
+ }
81
+ Err(e) => {
82
+ println!(" Skipped: {e}");
83
+ }
84
+ }
85
+
86
+ Ok(())
87
+ }