sagent 0.2.1__tar.gz → 0.2.3__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 (549) hide show
  1. {sagent-0.2.1 → sagent-0.2.3}/.pre-commit-config.yaml +23 -24
  2. {sagent-0.2.1 → sagent-0.2.3}/CHANGELOG.md +45 -3
  3. {sagent-0.2.1 → sagent-0.2.3}/PKG-INFO +70 -43
  4. {sagent-0.2.1 → sagent-0.2.3}/README.md +30 -28
  5. sagent-0.2.3/docs/api.md +159 -0
  6. sagent-0.2.3/docs/architecture.md +78 -0
  7. {sagent-0.2.1 → sagent-0.2.3}/docs/cli.md +47 -61
  8. sagent-0.2.3/docs/compaction.md +119 -0
  9. sagent-0.2.3/docs/concepts.md +51 -0
  10. sagent-0.2.3/docs/providers.md +187 -0
  11. {sagent-0.2.1 → sagent-0.2.3}/docs/security.md +6 -13
  12. {sagent-0.2.1 → sagent-0.2.3}/docs/selfhosted.md +14 -16
  13. sagent-0.2.3/docs/sessions.md +84 -0
  14. sagent-0.2.3/docs/streaming.md +108 -0
  15. sagent-0.2.3/docs/tools.md +265 -0
  16. {sagent-0.2.1 → sagent-0.2.3}/docs/tutorial.md +51 -35
  17. {sagent-0.2.1 → sagent-0.2.3}/pyproject.toml +128 -55
  18. {sagent-0.2.1 → sagent-0.2.3}/sagent/__main__.py +1 -1
  19. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/agent.py +207 -148
  20. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/agent_test.py +846 -50
  21. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/agents_md.py +12 -11
  22. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/agents_md_test.py +234 -9
  23. sagent-0.2.3/sagent/agent/assets/compactor_cut_off.md +1 -0
  24. sagent-0.2.3/sagent/agent/assets/compactor_partial_up_to.md +3 -0
  25. sagent-0.2.3/sagent/agent/assets/compactor_recent_from.md +1 -0
  26. sagent-0.2.3/sagent/agent/assets/compactor_recent_up_to.md +1 -0
  27. sagent-0.2.3/sagent/agent/assets/compactor_resume.md +1 -0
  28. sagent-0.2.3/sagent/agent/assets/compactor_resume_proactive.md +1 -0
  29. sagent-0.2.3/sagent/agent/assets/compactor_skill_elided.md +1 -0
  30. sagent-0.2.3/sagent/agent/assets/compactor_user_guidance.md +8 -0
  31. sagent-0.2.3/sagent/agent/assets/compactor_verify.md +7 -0
  32. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/cache_test.py +14 -5
  33. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/compactor.py +454 -606
  34. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/compactor_test.py +1569 -217
  35. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/environment_test.py +4 -1
  36. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/pruner.py +35 -47
  37. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/pruner_test.py +210 -17
  38. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/scrunch.py +4 -2
  39. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/scrunch_test.py +161 -1
  40. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/team.py +358 -150
  41. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/team_test.py +620 -52
  42. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/types.py +29 -7
  43. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/types_test.py +4 -4
  44. sagent-0.2.3/sagent/host/__init__.py +1 -0
  45. sagent-0.2.3/sagent/host/daemon.py +263 -0
  46. sagent-0.2.3/sagent/host/daemon_test.py +2038 -0
  47. sagent-0.2.3/sagent/host/server.py +1214 -0
  48. sagent-0.2.3/sagent/host/server_test.py +1489 -0
  49. sagent-0.2.3/sagent/host/session.py +484 -0
  50. sagent-0.2.3/sagent/host/session_test.py +520 -0
  51. sagent-0.2.3/sagent/host/settings.py +285 -0
  52. sagent-0.2.3/sagent/host/settings_test.py +198 -0
  53. sagent-0.2.3/sagent/host/strings.py +433 -0
  54. sagent-0.2.3/sagent/host/strings_test.py +338 -0
  55. sagent-0.2.3/sagent/host/testing.py +181 -0
  56. sagent-0.2.3/sagent/host/testing_test.py +75 -0
  57. sagent-0.2.3/sagent/host/tls.py +134 -0
  58. sagent-0.2.3/sagent/host/tls_test.py +91 -0
  59. sagent-0.2.3/sagent/host/wire.py +402 -0
  60. sagent-0.2.3/sagent/host/wire_test.py +204 -0
  61. {sagent-0.2.1 → sagent-0.2.3}/sagent/layering_test.py +14 -9
  62. sagent-0.2.3/sagent/lib/asyncio_stalls.py +88 -0
  63. sagent-0.2.3/sagent/lib/asyncio_stalls_test.py +80 -0
  64. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/files/glob.py +8 -11
  65. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/files/glob_test.py +76 -4
  66. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/files/grep.py +275 -90
  67. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/files/grep_test.py +696 -25
  68. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/files/owner_only.py +4 -1
  69. sagent-0.2.3/sagent/lib/files/owner_only_test.py +191 -0
  70. sagent-0.2.3/sagent/lib/files/source_version.py +61 -0
  71. sagent-0.2.3/sagent/lib/files/source_version_test.py +73 -0
  72. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/files/walk_test.py +33 -0
  73. sagent-0.2.3/sagent/lib/posix/attach.py +333 -0
  74. sagent-0.2.3/sagent/lib/posix/attach_test.py +1132 -0
  75. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/posix/child.py +42 -13
  76. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/posix/child_test.py +101 -4
  77. sagent-0.2.3/sagent/lib/posix/detached.py +138 -0
  78. sagent-0.2.3/sagent/lib/posix/detached_test.py +161 -0
  79. sagent-0.2.3/sagent/lib/posix/host.py +598 -0
  80. sagent-0.2.3/sagent/lib/posix/host_test.py +1196 -0
  81. sagent-0.2.3/sagent/lib/posix/pids.py +239 -0
  82. sagent-0.2.3/sagent/lib/posix/pids_test.py +462 -0
  83. sagent-0.2.3/sagent/lib/posix/relay.py +707 -0
  84. sagent-0.2.3/sagent/lib/posix/relay_test.py +1936 -0
  85. sagent-0.2.3/sagent/lib/posix/sockets.py +117 -0
  86. sagent-0.2.3/sagent/lib/posix/sockets_test.py +241 -0
  87. sagent-0.2.3/sagent/lib/posix/terminal.py +659 -0
  88. sagent-0.2.3/sagent/lib/posix/terminal_test.py +1555 -0
  89. sagent-0.2.3/sagent/lib/testing/checks.py +134 -0
  90. sagent-0.2.3/sagent/lib/testing/checks_test.py +187 -0
  91. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/testing/resources.py +43 -13
  92. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/testing/resources_test.py +254 -4
  93. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/testing/wheel.py +12 -5
  94. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/yaml.py +13 -7
  95. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/yaml_test.py +66 -3
  96. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/capability.py +24 -14
  97. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/capability_test.py +112 -26
  98. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/context.py +1 -1
  99. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/context_test.py +3 -7
  100. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/cost.py +21 -32
  101. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/cost_test.py +71 -8
  102. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/exceptions_test.py +8 -0
  103. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/image.py +4 -1
  104. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/image_test.py +27 -3
  105. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/scripted.py +4 -4
  106. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/scripted_test.py +14 -4
  107. sagent-0.2.3/sagent/model/token_accounting.py +302 -0
  108. sagent-0.2.3/sagent/model/token_accounting_test.py +449 -0
  109. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/types.py +11 -2
  110. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/types_test.py +2 -0
  111. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/api.py +99 -37
  112. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/api_test.py +99 -4
  113. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/cli.py +26 -25
  114. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/cli_test.py +128 -4
  115. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/login.py +40 -26
  116. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/login_test.py +135 -6
  117. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/wire.py +18 -19
  118. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/wire_test.py +58 -4
  119. sagent-0.2.3/sagent/providers/azure/__init__.py +1 -0
  120. sagent-0.2.3/sagent/providers/azure/api.py +28 -0
  121. sagent-0.2.3/sagent/providers/azure/api_test.py +97 -0
  122. sagent-0.2.3/sagent/providers/azure/azure.yaml +8 -0
  123. sagent-0.2.3/sagent/providers/bedrock/__init__.py +1 -0
  124. sagent-0.2.3/sagent/providers/bedrock/api.py +40 -0
  125. sagent-0.2.3/sagent/providers/bedrock/api_test.py +106 -0
  126. sagent-0.2.3/sagent/providers/bedrock/bedrock.yaml +10 -0
  127. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/catalog.py +47 -10
  128. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/catalog_test.py +193 -57
  129. sagent-0.2.3/sagent/providers/cerebras/__init__.py +1 -0
  130. sagent-0.2.3/sagent/providers/cerebras/api.py +28 -0
  131. sagent-0.2.3/sagent/providers/cerebras/api_test.py +64 -0
  132. sagent-0.2.3/sagent/providers/cerebras/cerebras.yaml +41 -0
  133. sagent-0.2.3/sagent/providers/cloudflare/__init__.py +1 -0
  134. sagent-0.2.3/sagent/providers/cloudflare/api.py +33 -0
  135. sagent-0.2.3/sagent/providers/cloudflare/api_test.py +44 -0
  136. sagent-0.2.3/sagent/providers/cloudflare/cloudflare.yaml +25 -0
  137. sagent-0.2.3/sagent/providers/cohere/__init__.py +1 -0
  138. sagent-0.2.3/sagent/providers/cohere/api.py +186 -0
  139. sagent-0.2.3/sagent/providers/cohere/api_test.py +310 -0
  140. sagent-0.2.3/sagent/providers/cohere/cohere.yaml +36 -0
  141. sagent-0.2.3/sagent/providers/deepinfra/__init__.py +1 -0
  142. sagent-0.2.3/sagent/providers/deepinfra/api.py +28 -0
  143. sagent-0.2.3/sagent/providers/deepinfra/api_test.py +63 -0
  144. sagent-0.2.3/sagent/providers/deepinfra/deepinfra.yaml +38 -0
  145. sagent-0.2.3/sagent/providers/deepseek/__init__.py +1 -0
  146. sagent-0.2.3/sagent/providers/deepseek/api.py +38 -0
  147. sagent-0.2.3/sagent/providers/deepseek/api_test.py +65 -0
  148. sagent-0.2.3/sagent/providers/deepseek/deepseek.yaml +49 -0
  149. sagent-0.2.3/sagent/providers/fireworks/__init__.py +1 -0
  150. sagent-0.2.3/sagent/providers/fireworks/api.py +37 -0
  151. sagent-0.2.3/sagent/providers/fireworks/api_test.py +66 -0
  152. sagent-0.2.3/sagent/providers/fireworks/fireworks.yaml +41 -0
  153. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/google/api.py +40 -31
  154. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/google/api_test.py +38 -3
  155. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/google/cli.py +28 -7
  156. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/google/cli_test.py +532 -11
  157. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/google/wire.py +2 -1
  158. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/google/wire_test.py +15 -6
  159. sagent-0.2.3/sagent/providers/groq/__init__.py +1 -0
  160. sagent-0.2.3/sagent/providers/groq/api.py +37 -0
  161. sagent-0.2.3/sagent/providers/groq/api_test.py +72 -0
  162. sagent-0.2.3/sagent/providers/groq/groq.yaml +39 -0
  163. sagent-0.2.3/sagent/providers/huggingface/__init__.py +1 -0
  164. sagent-0.2.3/sagent/providers/huggingface/api.py +32 -0
  165. sagent-0.2.3/sagent/providers/huggingface/api_test.py +65 -0
  166. sagent-0.2.3/sagent/providers/huggingface/huggingface.yaml +40 -0
  167. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/llamacpp/server.py +47 -37
  168. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/llamacpp/server_test.py +122 -6
  169. sagent-0.2.3/sagent/providers/lmstudio/__init__.py +1 -0
  170. sagent-0.2.3/sagent/providers/lmstudio/api.py +25 -0
  171. sagent-0.2.3/sagent/providers/lmstudio/api_test.py +32 -0
  172. sagent-0.2.3/sagent/providers/lmstudio/lmstudio.yaml +23 -0
  173. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/login.py +82 -30
  174. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/login_test.py +302 -8
  175. sagent-0.2.3/sagent/providers/mistral/__init__.py +1 -0
  176. sagent-0.2.3/sagent/providers/mistral/api.py +38 -0
  177. sagent-0.2.3/sagent/providers/mistral/api_test.py +91 -0
  178. sagent-0.2.3/sagent/providers/mistral/mistral.yaml +38 -0
  179. sagent-0.2.3/sagent/providers/nvidia/__init__.py +1 -0
  180. sagent-0.2.3/sagent/providers/nvidia/api.py +34 -0
  181. sagent-0.2.3/sagent/providers/nvidia/api_test.py +35 -0
  182. sagent-0.2.3/sagent/providers/nvidia/nvidia.yaml +13 -0
  183. sagent-0.2.3/sagent/providers/ollama/__init__.py +1 -0
  184. sagent-0.2.3/sagent/providers/ollama/api.py +25 -0
  185. sagent-0.2.3/sagent/providers/ollama/api_test.py +37 -0
  186. sagent-0.2.3/sagent/providers/ollama/ollama.yaml +23 -0
  187. sagent-0.2.3/sagent/providers/openai/api.py +137 -0
  188. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/api_test.py +63 -0
  189. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/chat.py +168 -14
  190. sagent-0.2.3/sagent/providers/openai/chat_test.py +1028 -0
  191. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/compat.py +104 -39
  192. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/compat_test.py +173 -4
  193. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/lease.py +15 -7
  194. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/lease_test.py +29 -1
  195. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/login.py +122 -123
  196. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/login_test.py +269 -68
  197. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/responses.py +16 -24
  198. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/responses_test.py +176 -14
  199. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/sub.py +3 -3
  200. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/sub_test.py +48 -3
  201. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/token_count.py +4 -12
  202. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/token_count_test.py +133 -0
  203. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/wire.py +40 -10
  204. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/wire_test.py +168 -0
  205. sagent-0.2.3/sagent/providers/openrouter/__init__.py +1 -0
  206. sagent-0.2.3/sagent/providers/openrouter/api.py +42 -0
  207. sagent-0.2.3/sagent/providers/openrouter/api_test.py +50 -0
  208. sagent-0.2.3/sagent/providers/openrouter/openrouter.yaml +37 -0
  209. sagent-0.2.3/sagent/providers/perplexity/__init__.py +1 -0
  210. sagent-0.2.3/sagent/providers/perplexity/api.py +51 -0
  211. sagent-0.2.3/sagent/providers/perplexity/api_test.py +55 -0
  212. sagent-0.2.3/sagent/providers/perplexity/perplexity.yaml +43 -0
  213. sagent-0.2.3/sagent/providers/replicate/__init__.py +1 -0
  214. sagent-0.2.3/sagent/providers/replicate/api.py +168 -0
  215. sagent-0.2.3/sagent/providers/replicate/api_test.py +262 -0
  216. sagent-0.2.3/sagent/providers/replicate/replicate.yaml +9 -0
  217. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/resources.py +3 -2
  218. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/resources_test.py +114 -24
  219. sagent-0.2.3/sagent/providers/retry.py +61 -0
  220. sagent-0.2.3/sagent/providers/retry_test.py +133 -0
  221. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/selfhosted/calls.py +7 -7
  222. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/selfhosted/calls_test.py +15 -0
  223. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/selfhosted/server.py +13 -16
  224. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/selfhosted/server_test.py +281 -4
  225. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/selfhosted/vision.py +15 -12
  226. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/selfhosted/vision_test.py +114 -0
  227. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/table.py +63 -14
  228. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/table_test.py +415 -8
  229. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/testing.py +28 -3
  230. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/testing_test.py +18 -3
  231. sagent-0.2.3/sagent/providers/together/__init__.py +1 -0
  232. sagent-0.2.3/sagent/providers/together/api.py +28 -0
  233. sagent-0.2.3/sagent/providers/together/api_test.py +66 -0
  234. sagent-0.2.3/sagent/providers/together/together.yaml +41 -0
  235. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/tool_server.py +4 -4
  236. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/tool_server_test.py +26 -2
  237. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/types.py +12 -6
  238. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/types_test.py +28 -11
  239. sagent-0.2.3/sagent/providers/vertex/__init__.py +1 -0
  240. sagent-0.2.3/sagent/providers/vertex/api.py +117 -0
  241. sagent-0.2.3/sagent/providers/vertex/api_test.py +211 -0
  242. sagent-0.2.3/sagent/providers/vertex/vertex.yaml +33 -0
  243. sagent-0.2.3/sagent/providers/workload_identity.py +162 -0
  244. sagent-0.2.3/sagent/providers/workload_identity_test.py +216 -0
  245. sagent-0.2.3/sagent/providers/xai/__init__.py +1 -0
  246. sagent-0.2.3/sagent/providers/xai/api.py +31 -0
  247. sagent-0.2.3/sagent/providers/xai/api_test.py +67 -0
  248. sagent-0.2.3/sagent/providers/xai/xai.yaml +42 -0
  249. sagent-0.2.3/sagent/providers/zai/__init__.py +1 -0
  250. sagent-0.2.3/sagent/providers/zai/api.py +39 -0
  251. sagent-0.2.3/sagent/providers/zai/api_test.py +66 -0
  252. sagent-0.2.3/sagent/providers/zai/zai.yaml +41 -0
  253. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/context.py +10 -6
  254. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/context_test.py +42 -5
  255. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/runtime.py +57 -83
  256. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/runtime_test.py +262 -59
  257. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/tape.py +9 -8
  258. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/tape_test.py +6 -5
  259. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/types_test.py +2 -2
  260. {sagent-0.2.1 → sagent-0.2.3}/sagent/scripts/check_wheel.py +4 -11
  261. {sagent-0.2.1 → sagent-0.2.3}/sagent/scripts/check_wheel_test.py +44 -1
  262. {sagent-0.2.1 → sagent-0.2.3}/sagent/scripts/convert_sessions.py +20 -1
  263. {sagent-0.2.1 → sagent-0.2.3}/sagent/scripts/convert_sessions_test.py +51 -2
  264. {sagent-0.2.1 → sagent-0.2.3}/sagent/scripts/swebench.py +7 -6
  265. {sagent-0.2.1 → sagent-0.2.3}/sagent/scripts/swebench_test.py +444 -44
  266. sagent-0.2.3/sagent/session/jsonl.py +332 -0
  267. {sagent-0.2.1 → sagent-0.2.3}/sagent/session/jsonl_test.py +203 -8
  268. {sagent-0.2.1 → sagent-0.2.3}/sagent/session/legacy_journal.py +44 -34
  269. {sagent-0.2.1 → sagent-0.2.3}/sagent/session/legacy_journal_test.py +428 -2
  270. {sagent-0.2.1 → sagent-0.2.3}/sagent/session/projects.py +35 -27
  271. {sagent-0.2.1 → sagent-0.2.3}/sagent/session/projects_test.py +41 -12
  272. {sagent-0.2.1 → sagent-0.2.3}/sagent/session/recording.py +9 -5
  273. {sagent-0.2.1 → sagent-0.2.3}/sagent/session/recording_test.py +10 -0
  274. {sagent-0.2.1 → sagent-0.2.3}/sagent/session/types.py +543 -50
  275. sagent-0.2.3/sagent/session/types_test.py +592 -0
  276. sagent-0.2.3/sagent/settings/exceptions.py +32 -0
  277. sagent-0.2.3/sagent/settings/exceptions_test.py +27 -0
  278. {sagent-0.2.1 → sagent-0.2.3}/sagent/settings/flags.py +60 -6
  279. {sagent-0.2.1 → sagent-0.2.3}/sagent/settings/flags_test.py +9 -1
  280. {sagent-0.2.1 → sagent-0.2.3}/sagent/settings/types.py +4 -7
  281. {sagent-0.2.1 → sagent-0.2.3}/sagent/settings/types_test.py +2 -10
  282. {sagent-0.2.1 → sagent-0.2.3}/sagent/skills/watch/SKILL.md +6 -5
  283. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/agent_self.py +41 -23
  284. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/agent_self_test.py +109 -9
  285. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/agent_send.py +41 -21
  286. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/agent_send_test.py +144 -4
  287. sagent-0.2.1/sagent/tools/session.py → sagent-0.2.3/sagent/tools/agent_session.py +75 -59
  288. sagent-0.2.1/sagent/tools/session_test.py → sagent-0.2.3/sagent/tools/agent_session_test.py +171 -52
  289. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/agent_spawn.py +71 -39
  290. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/agent_spawn_test.py +768 -67
  291. sagent-0.2.3/sagent/tools/agent_tool.py +56 -0
  292. sagent-0.2.3/sagent/tools/agent_tool_test.py +409 -0
  293. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/agentself.md +3 -1
  294. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/agentspawn.md +7 -3
  295. sagent-0.2.3/sagent/tools/assets/grep.md +12 -0
  296. sagent-0.2.3/sagent/tools/assets/remotetool.md +11 -0
  297. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/session.md +5 -2
  298. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/background_task.py +20 -10
  299. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/background_task_test.py +16 -5
  300. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/bash.py +29 -21
  301. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/bash_test.py +244 -37
  302. sagent-0.2.3/sagent/tools/builtin.py +133 -0
  303. sagent-0.2.3/sagent/tools/builtin_test.py +81 -0
  304. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/command_analyzer.py +87 -77
  305. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/command_analyzer_test.py +226 -16
  306. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/display.py +4 -4
  307. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/edit.py +23 -24
  308. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/edit_test.py +15 -6
  309. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/function.py +118 -22
  310. sagent-0.2.3/sagent/tools/function_test.py +390 -0
  311. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/glob_tool.py +19 -8
  312. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/grep.py +269 -64
  313. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/grep_test.py +387 -14
  314. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/list.py +8 -8
  315. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/mcp.py +169 -52
  316. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/mcp_auth.py +83 -36
  317. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/mcp_auth_test.py +226 -42
  318. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/mcp_settings.py +10 -24
  319. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/mcp_settings_test.py +97 -31
  320. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/mcp_test.py +764 -85
  321. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/memory.py +12 -6
  322. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/memory_test.py +45 -2
  323. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_author.py +44 -28
  324. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_author_test.py +125 -17
  325. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_common.py +4 -4
  326. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_common_test.py +3 -3
  327. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_details.py +24 -22
  328. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_details_test.py +17 -13
  329. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_fetch.py +18 -14
  330. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_fetch_test.py +11 -19
  331. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_search.py +10 -14
  332. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/paper_search_test.py +5 -10
  333. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/play_audio.py +13 -8
  334. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/read.py +53 -35
  335. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/read_test.py +149 -22
  336. sagent-0.2.3/sagent/tools/remote.py +806 -0
  337. sagent-0.2.3/sagent/tools/remote_settings.py +164 -0
  338. sagent-0.2.3/sagent/tools/remote_settings_test.py +99 -0
  339. sagent-0.2.3/sagent/tools/remote_test.py +1024 -0
  340. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/skill.py +24 -15
  341. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/skill_test.py +55 -14
  342. sagent-0.2.3/sagent/tools/testing.py +60 -0
  343. sagent-0.2.3/sagent/tools/testing_test.py +95 -0
  344. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/types.py +25 -12
  345. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/types_test.py +32 -10
  346. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/watch.py +6 -8
  347. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/watch_test.py +122 -3
  348. sagent-0.2.3/sagent/tools/web_browser.py +136 -0
  349. sagent-0.2.3/sagent/tools/web_browser_test.py +324 -0
  350. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/web_fetch.py +9 -12
  351. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/web_fetch_test.py +19 -27
  352. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/web_search.py +12 -16
  353. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/web_search_test.py +18 -23
  354. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/write.py +8 -8
  355. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/write_test.py +4 -4
  356. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/assets/holidays.yaml +38 -64
  357. sagent-0.2.3/sagent/tui/assets/themes/dark.yaml +27 -0
  358. sagent-0.2.3/sagent/tui/assets/themes/default.yaml +58 -0
  359. sagent-0.2.3/sagent/tui/assets/themes/light.yaml +27 -0
  360. sagent-0.2.3/sagent/tui/assets/themes/terminal.yaml +42 -0
  361. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/console.py +289 -98
  362. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/console_test.py +606 -122
  363. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/diff.py +68 -79
  364. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/diff_test.py +266 -10
  365. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/holiday.py +160 -49
  366. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/holiday_test.py +361 -37
  367. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/main.py +342 -145
  368. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/main_test.py +1996 -230
  369. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/markdown.py +40 -7
  370. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/markdown_test.py +83 -4
  371. sagent-0.2.3/sagent/tui/peers_test.py +76 -0
  372. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/prompt.py +21 -13
  373. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/prompt_test.py +65 -0
  374. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/recording.py +31 -6
  375. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/recording_test.py +9 -3
  376. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/render.py +40 -49
  377. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/render_test.py +212 -45
  378. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/replay_test.py +9 -18
  379. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/settings/model.py +8 -17
  380. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/settings/model_test.py +109 -2
  381. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/settings/runtime.py +2 -1
  382. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/settings/runtime_test.py +32 -0
  383. sagent-0.2.3/sagent/tui/settings/screen.py +113 -0
  384. sagent-0.2.3/sagent/tui/settings/screen_test.py +140 -0
  385. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/settings/tool.py +3 -2
  386. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/settings/tool_test.py +9 -0
  387. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/slash.py +179 -58
  388. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/slash_test.py +380 -17
  389. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/status_test.py +1 -1
  390. sagent-0.2.3/sagent/tui/theme.py +555 -0
  391. sagent-0.2.3/sagent/tui/theme_test.py +741 -0
  392. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/tree.py +28 -26
  393. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/tree_test.py +224 -5
  394. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/types.py +5 -2
  395. sagent-0.2.3/sagent/tui/types_test.py +339 -0
  396. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/views.py +14 -9
  397. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/views_test.py +292 -49
  398. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/welcome.py +65 -47
  399. sagent-0.2.3/sagent/tui/welcome_test.py +929 -0
  400. {sagent-0.2.1 → sagent-0.2.3}/tests/wheel_test.py +56 -1
  401. {sagent-0.2.1 → sagent-0.2.3}/tools/gate/__main__.py +1 -1
  402. {sagent-0.2.1 → sagent-0.2.3}/tools/gate/fakes.py +31 -7
  403. {sagent-0.2.1 → sagent-0.2.3}/tools/gate/fakes_test.py +47 -5
  404. {sagent-0.2.1 → sagent-0.2.3}/tools/gate/gate.py +163 -73
  405. sagent-0.2.3/tools/gate/gate_test.py +628 -0
  406. {sagent-0.2.1 → sagent-0.2.3}/tools/gate/spool_test.py +15 -1
  407. {sagent-0.2.1 → sagent-0.2.3}/tools/gate/worker_count.py +9 -4
  408. {sagent-0.2.1 → sagent-0.2.3}/tools/gate/worker_count_test.py +116 -2
  409. {sagent-0.2.1 → sagent-0.2.3}/tools/testing/__main__.py +1 -1
  410. {sagent-0.2.1 → sagent-0.2.3}/tools/testing/coverage_summary.py +5 -4
  411. {sagent-0.2.1 → sagent-0.2.3}/tools/testing/coverage_summary_test.py +18 -13
  412. sagent-0.2.3/tools/testing/listing.py +285 -0
  413. sagent-0.2.3/tools/testing/listing_test.py +722 -0
  414. {sagent-0.2.1 → sagent-0.2.3}/tools/testing/testing.py +52 -47
  415. sagent-0.2.3/tools/testing/testing_test.py +1045 -0
  416. {sagent-0.2.1 → sagent-0.2.3}/tools/typecheck/__main__.py +1 -1
  417. {sagent-0.2.1 → sagent-0.2.3}/tools/typecheck/scope_test.py +5 -0
  418. {sagent-0.2.1 → sagent-0.2.3}/tools/typecheck/typecheck.py +40 -19
  419. {sagent-0.2.1 → sagent-0.2.3}/tools/typecheck/typecheck_test.py +164 -5
  420. {sagent-0.2.1 → sagent-0.2.3}/uv.lock +1553 -1432
  421. sagent-0.2.1/docs/api.md +0 -184
  422. sagent-0.2.1/docs/architecture.md +0 -89
  423. sagent-0.2.1/docs/compaction.md +0 -152
  424. sagent-0.2.1/docs/concepts.md +0 -55
  425. sagent-0.2.1/docs/providers.md +0 -176
  426. sagent-0.2.1/docs/sessions.md +0 -89
  427. sagent-0.2.1/docs/streaming.md +0 -101
  428. sagent-0.2.1/docs/tools.md +0 -254
  429. sagent-0.2.1/sagent/lib/files/owner_only_test.py +0 -92
  430. sagent-0.2.1/sagent/lib/posix/pids.py +0 -116
  431. sagent-0.2.1/sagent/lib/posix/pids_test.py +0 -165
  432. sagent-0.2.1/sagent/providers/openai/api.py +0 -89
  433. sagent-0.2.1/sagent/providers/openai/chat_test.py +0 -447
  434. sagent-0.2.1/sagent/session/jsonl.py +0 -229
  435. sagent-0.2.1/sagent/session/types_test.py +0 -342
  436. sagent-0.2.1/sagent/tools/assets/grep.md +0 -10
  437. sagent-0.2.1/sagent/tools/function_test.py +0 -191
  438. sagent-0.2.1/sagent/tui/settings/screen.py +0 -58
  439. sagent-0.2.1/sagent/tui/settings/screen_test.py +0 -46
  440. sagent-0.2.1/sagent/tui/types_test.py +0 -110
  441. sagent-0.2.1/sagent/tui/welcome_test.py +0 -492
  442. sagent-0.2.1/tools/gate/gate_test.py +0 -283
  443. sagent-0.2.1/tools/testing/testing_test.py +0 -549
  444. {sagent-0.2.1 → sagent-0.2.3}/.gitignore +0 -0
  445. {sagent-0.2.1 → sagent-0.2.3}/.python-version +0 -0
  446. {sagent-0.2.1 → sagent-0.2.3}/AI_POLICY.md +0 -0
  447. {sagent-0.2.1 → sagent-0.2.3}/CODE_OF_CONDUCT.md +0 -0
  448. {sagent-0.2.1 → sagent-0.2.3}/CONTRIBUTING.md +0 -0
  449. {sagent-0.2.1 → sagent-0.2.3}/LICENSE +0 -0
  450. {sagent-0.2.1 → sagent-0.2.3}/RELEASING.md +0 -0
  451. {sagent-0.2.1 → sagent-0.2.3}/SECURITY.md +0 -0
  452. {sagent-0.2.1 → sagent-0.2.3}/assets/logo-custom.webp +0 -0
  453. {sagent-0.2.1 → sagent-0.2.3}/conftest.py +0 -0
  454. {sagent-0.2.1 → sagent-0.2.3}/docs/showcase.md +0 -0
  455. {sagent-0.2.1 → sagent-0.2.3}/sagent/__init__.py +0 -0
  456. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/__init__.py +0 -0
  457. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/assets/compactor.md +0 -0
  458. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/assets/compactor_continuation.md +0 -0
  459. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/assets/compactor_no_tools.md +0 -0
  460. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/assets/compactor_no_tools_reminder.md +0 -0
  461. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/assets/compactor_partial.md +0 -0
  462. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/assets/compactor_session_audit.md +0 -0
  463. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/assets/compactor_system.md +0 -0
  464. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/assets/system_prompt.md +0 -0
  465. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/environment.py +0 -0
  466. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/fold.py +0 -0
  467. {sagent-0.2.1 → sagent-0.2.3}/sagent/agent/fold_test.py +0 -0
  468. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/__init__.py +0 -0
  469. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/files/__init__.py +0 -0
  470. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/files/walk.py +0 -0
  471. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/posix/__init__.py +0 -0
  472. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/testing/__init__.py +0 -0
  473. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/testing/runner.py +0 -0
  474. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/testing/runner_test.py +0 -0
  475. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/userdirs.py +0 -0
  476. {sagent-0.2.1 → sagent-0.2.3}/sagent/lib/userdirs_test.py +0 -0
  477. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/__init__.py +0 -0
  478. {sagent-0.2.1 → sagent-0.2.3}/sagent/model/exceptions.py +0 -0
  479. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/__init__.py +0 -0
  480. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/__init__.py +0 -0
  481. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/anthropic/anthropic.yaml +0 -0
  482. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/dashscope/__init__.py +0 -0
  483. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/dashscope/api.py +0 -0
  484. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/dashscope/api_test.py +0 -0
  485. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/dashscope/dashscope.yaml +0 -0
  486. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/google/__init__.py +0 -0
  487. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/google/google.yaml +0 -0
  488. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/llamacpp/__init__.py +0 -0
  489. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/llamacpp/llamacpp.yaml +0 -0
  490. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/minimax/__init__.py +0 -0
  491. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/minimax/api.py +0 -0
  492. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/minimax/api_test.py +0 -0
  493. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/minimax/minimax.yaml +0 -0
  494. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/moonshot/__init__.py +0 -0
  495. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/moonshot/api.py +0 -0
  496. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/moonshot/api_test.py +0 -0
  497. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/moonshot/moonshot.yaml +0 -0
  498. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/__init__.py +0 -0
  499. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/openai/openai.yaml +0 -0
  500. {sagent-0.2.1 → sagent-0.2.3}/sagent/providers/selfhosted/__init__.py +0 -0
  501. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/__init__.py +0 -0
  502. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/exceptions.py +0 -0
  503. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/exceptions_test.py +0 -0
  504. {sagent-0.2.1 → sagent-0.2.3}/sagent/runtime/types.py +0 -0
  505. {sagent-0.2.1 → sagent-0.2.3}/sagent/scripts/__init__.py +0 -0
  506. {sagent-0.2.1 → sagent-0.2.3}/sagent/session/__init__.py +0 -0
  507. {sagent-0.2.1 → sagent-0.2.3}/sagent/settings/__init__.py +0 -0
  508. {sagent-0.2.1 → sagent-0.2.3}/sagent/settings/harvest.py +0 -0
  509. {sagent-0.2.1 → sagent-0.2.3}/sagent/settings/harvest_test.py +0 -0
  510. {sagent-0.2.1 → sagent-0.2.3}/sagent/settings/match.py +0 -0
  511. {sagent-0.2.1 → sagent-0.2.3}/sagent/settings/match_test.py +0 -0
  512. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/__init__.py +0 -0
  513. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/agentsend.md +0 -0
  514. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/backgroundtask.md +0 -0
  515. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/bash.md +0 -0
  516. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/bash.yaml +0 -0
  517. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/edit.md +0 -0
  518. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/glob.md +0 -0
  519. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/list.md +0 -0
  520. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/memory.md +0 -0
  521. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/paperauthor.md +0 -0
  522. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/paperdetails.md +0 -0
  523. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/paperfetch.md +0 -0
  524. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/papersearch.md +0 -0
  525. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/playaudio.md +0 -0
  526. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/read.md +0 -0
  527. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/skill.md +0 -0
  528. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/webfetch.md +0 -0
  529. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/websearch.md +0 -0
  530. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/assets/write.md +0 -0
  531. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/display_test.py +0 -0
  532. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/glob_tool_test.py +0 -0
  533. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/list_test.py +0 -0
  534. {sagent-0.2.1 → sagent-0.2.3}/sagent/tools/play_audio_test.py +0 -0
  535. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/__init__.py +0 -0
  536. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/replay.py +0 -0
  537. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/settings/__init__.py +0 -0
  538. {sagent-0.2.1 → sagent-0.2.3}/sagent/tui/status.py +0 -0
  539. {sagent-0.2.1 → sagent-0.2.3}/sagent/types.py +0 -0
  540. {sagent-0.2.1 → sagent-0.2.3}/sagent/types_test.py +0 -0
  541. {sagent-0.2.1 → sagent-0.2.3}/tools/__init__.py +0 -0
  542. {sagent-0.2.1 → sagent-0.2.3}/tools/gate/__init__.py +0 -0
  543. {sagent-0.2.1 → sagent-0.2.3}/tools/gate/spool.py +0 -0
  544. {sagent-0.2.1 → sagent-0.2.3}/tools/testing/__init__.py +0 -0
  545. {sagent-0.2.1 → sagent-0.2.3}/tools/testing/tiers.py +0 -0
  546. {sagent-0.2.1 → sagent-0.2.3}/tools/testing/tiers_test.py +0 -0
  547. {sagent-0.2.1 → sagent-0.2.3}/tools/typecheck/__init__.py +0 -0
  548. {sagent-0.2.1 → sagent-0.2.3}/tools/typecheck/scope.py +0 -0
  549. {sagent-0.2.1 → sagent-0.2.3}/typings/.gitkeep +0 -0
@@ -283,14 +283,33 @@ repos:
283
283
  alias: superseded-at-pre-push
284
284
  types_or: [python, pyi]
285
285
  entry: uv --quiet run --frozen --group pre-commit python -m tools.typecheck ty-check
286
- # Off: `pyrefly-check` is the checker. Run with `--hook-stage manual`.
286
+ # Default type checker; `basedpyright` below is an additional opt-in.
287
+ - id: pyrefly-check-spool
288
+ name: pyrefly-check-spool
289
+ alias: pyrefly-check
290
+ language: system
291
+ stages: [pre-commit]
292
+ require_serial: true
293
+ types_or: [python, pyi]
294
+ entry: uv --quiet run --frozen --group pre-commit python -m tools.gate spool pyrefly-check
295
+ - id: pyrefly-check
296
+ name: pyrefly-check
297
+ language: system
298
+ stages: [pre-commit]
299
+ require_serial: true
300
+ pass_filenames: false
301
+ # See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
302
+ alias: superseded-at-pre-push
303
+ types_or: [python, pyi]
304
+ entry: uv --quiet run --frozen --group pre-commit python -m tools.typecheck pyrefly-check
305
+ # Opt in with PRECOMMIT_BASEDPYRIGHT=1; unset or 0 is off.
287
306
  # Named files bypass pyproject's `[tool.basedpyright] exclude`, so the
288
307
  # twin's exclude mirrors it.
289
308
  - id: basedpyright-spool
290
309
  name: basedpyright-spool
291
310
  alias: basedpyright
292
311
  language: system
293
- stages: [manual]
312
+ stages: [pre-commit]
294
313
  require_serial: true
295
314
  types_or: [python, pyi]
296
315
  entry: uv --quiet run --frozen --group pre-commit python -m tools.gate spool basedpyright
@@ -302,7 +321,7 @@ repos:
302
321
  - id: basedpyright
303
322
  name: basedpyright
304
323
  language: system
305
- stages: [manual]
324
+ stages: [pre-commit]
306
325
  # Pre-commit discards a PASSING hook's output (see the Pre-Push Gates
307
326
  # note on `verbose`); this keeps basedpyright's summary line visible.
308
327
  verbose: true
@@ -312,27 +331,7 @@ repos:
312
331
  entry: >-
313
332
  env NODE_OPTIONS=--max-old-space-size=2048
314
333
  uv --quiet run --frozen --group pre-commit python -m tools.typecheck
315
- basedpyright
316
- # Default type checker; `basedpyright` above runs only under
317
- # `--hook-stage manual`.
318
- - id: pyrefly-check-spool
319
- name: pyrefly-check-spool
320
- alias: pyrefly-check
321
- language: system
322
- stages: [pre-commit]
323
- require_serial: true
324
- types_or: [python, pyi]
325
- entry: uv --quiet run --frozen --group pre-commit python -m tools.gate spool pyrefly-check
326
- - id: pyrefly-check
327
- name: pyrefly-check
328
- language: system
329
- stages: [pre-commit]
330
- require_serial: true
331
- pass_filenames: false
332
- # See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
333
- alias: superseded-at-pre-push
334
- types_or: [python, pyi]
335
- entry: uv --quiet run --frozen --group pre-commit python -m tools.typecheck pyrefly-check
334
+ basedpyright --when PRECOMMIT_BASEDPYRIGHT
336
335
  - repo: local
337
336
  hooks:
338
337
  # Each heavy hook below is a `-spool` twin, which collects pre-commit's
@@ -3,13 +3,55 @@
3
3
  All notable sagent changes are documented here. This project follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
+ ## 0.2.3 - 2026-11-06
7
+
8
+ ### Changed
9
+
10
+ - The welcome frame greets by holiday name.
11
+
12
+ ## 0.2.2 - 2026-11-06
13
+
14
+ ### Changed
15
+
16
+ - An MCP sign-in belongs to one configuration file's entry: two projects, or a
17
+ project and the user's file, naming the same server keep separate sign-ins,
18
+ and removing one leaves the other signed in. `sagent mcp remove` and
19
+ `sagent mcp logout` also forget every sign-in of that file whose entry it no
20
+ longer has, as after a URL edited by hand; a file that does not read, and
21
+ JSON given inline to `--mcp-config`, are left alone. Sign-ins made before
22
+ this are not found; sign in again.
23
+ - `sagent mcp remove` with no `--scope` skips a configuration file that does
24
+ not read and removes the server from the other.
25
+ - `sagent.tools.mcp.logout` is a coroutine.
26
+
27
+ - Functions are named for what they return: `sagent.tools.types.schema_of` is
28
+ `json_schema`, `sagent.providers.openai.login.account_of` is
29
+ `codex_account`, `sagent.providers.testing.port_of` is `bound_port`,
30
+ `sagent.tui.render.header_of` is `call_header`, `Team.label_for` is
31
+ `Team.child_label`, and `Commands.commands_for` is `child_commands`.
32
+ - `Agent(cwd=, root=, max_result_chars=, columns=)` is
33
+ `Agent(tool_context=ToolContext(...))`. Every `ToolContext` field has a
34
+ default; the agent fixes where it started from the context's `origin`, and a
35
+ spawned agent takes a copy of its parent's context, with its own file
36
+ tracker.
37
+ - `ToolContext.fetch_session` carries the fetch session the web and paper
38
+ tools use; `WebFetch`, `WebSearch`, `PaperSearch`, `PaperDetails`,
39
+ `PaperAuthor` and `PaperFetch` take no `session`. Unset, it is wesearch's
40
+ process-wide session.
41
+ - `ProviderSharedResources` is `ProviderResources`.
42
+
43
+ ### Added
44
+
45
+ - `sagent.agent.agent.spent_by_model` reads what a journal says its agent spent
46
+ on each model, as each `TurnContext` names it; its sums add up to `spent`'s.
47
+
6
48
  ## 0.2.1 - 2026-10-30
7
49
 
8
50
  ### Added
9
51
 
10
- - The welcome logo becomes a holiday icon around 26 holidays, from the last
11
- workday before each through its last day; overlapping holidays are picked
12
- at random. Dates follow US observance: computed for seasons, Lunar New
52
+ - The welcome logo becomes a holiday icon on 26 holidays, for that day, or
53
+ Friday to Sunday when it falls on a weekend (Easter: Saturday to Monday);
54
+ overlapping holidays are picked at random. Dates follow US observance: computed for seasons, Lunar New
13
55
  Year, Mid-Autumn, Holi, Diwali, Vaisakhi, Easter, Thanksgiving and the
14
56
  Hebrew holidays; announced for the Eids and Vesak. Terminals without 256
15
57
  colors, or with `NO_COLOR`, keep the logo.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sagent
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Python-first Coding Agent API and CLI.
5
5
  Project-URL: Homepage, https://www.rekursiv.ai
6
6
  Project-URL: Repository, https://github.com/rekursiv-ai/sagent
@@ -23,36 +23,61 @@ Classifier: Programming Language :: Python :: 3.14
23
23
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
24
  Requires-Python: >=3.12
25
25
  Requires-Dist: bashlex>=0.18
26
- Requires-Dist: cachetools>=7.2.1
27
- Requires-Dist: httpx2>=2.12
26
+ Requires-Dist: cachetools>=7.2.7
27
+ Requires-Dist: cryptography>=50.0.2
28
+ Requires-Dist: httpx2>=2.16.0
28
29
  Requires-Dist: markdown-it-py>=4.2
29
- Requires-Dist: mcp>=2.0.0
30
+ Requires-Dist: mcp>=2.3.0
30
31
  Requires-Dist: pillow>=11.3.0
31
32
  Requires-Dist: prompt-toolkit>=3.0.53
32
33
  Requires-Dist: pygments>=2.21.0
33
34
  Requires-Dist: pypdfium2>=5.14.0
34
- Requires-Dist: pyyaml>=6.0
35
+ Requires-Dist: pyyaml>=6.0.3
35
36
  Requires-Dist: rich>=15.0.0
36
37
  Requires-Dist: rignore>=0.8.1
37
- Requires-Dist: starlette>=0.40
38
- Requires-Dist: tiktoken>=0.12.0
38
+ Requires-Dist: starlette>=1.10.0
39
+ Requires-Dist: tiktoken>=0.14.0
39
40
  Requires-Dist: treekle>=0.4.1
40
- Requires-Dist: uvicorn>=0.30.0
41
+ Requires-Dist: uvicorn>=0.54.0
41
42
  Requires-Dist: wesearch>=0.1.15
42
- Requires-Dist: wrapt>=2.5.0
43
+ Requires-Dist: wrapt>=2.5.2
44
+ Provides-Extra: cpu
45
+ Requires-Dist: torch; extra == 'cpu'
46
+ Requires-Dist: torchao; extra == 'cpu'
47
+ Requires-Dist: torchvision; extra == 'cpu'
48
+ Provides-Extra: cu126
49
+ Requires-Dist: torch; extra == 'cu126'
50
+ Requires-Dist: torchao; extra == 'cu126'
51
+ Requires-Dist: torchvision; extra == 'cu126'
52
+ Provides-Extra: cu128
53
+ Requires-Dist: torch; extra == 'cu128'
54
+ Requires-Dist: torchao; extra == 'cu128'
55
+ Requires-Dist: torchvision; extra == 'cu128'
56
+ Provides-Extra: cu130
57
+ Requires-Dist: torch; extra == 'cu130'
58
+ Requires-Dist: torchao; extra == 'cu130'
59
+ Requires-Dist: torchvision; extra == 'cu130'
60
+ Provides-Extra: cu132
61
+ Requires-Dist: torch; extra == 'cu132'
62
+ Requires-Dist: torchao; extra == 'cu132'
63
+ Requires-Dist: torchvision; extra == 'cu132'
64
+ Provides-Extra: cu134
65
+ Requires-Dist: torch; extra == 'cu134'
66
+ Requires-Dist: torchao; extra == 'cu134'
67
+ Requires-Dist: torchvision; extra == 'cu134'
43
68
  Provides-Extra: selfhosted
44
- Requires-Dist: accelerate>=1.13.0; extra == 'selfhosted'
45
- Requires-Dist: auto-round>=0.12.3; extra == 'selfhosted'
46
- Requires-Dist: compressed-tensors>=0.19.0; extra == 'selfhosted'
47
- Requires-Dist: kernels>=0.13.0; extra == 'selfhosted'
69
+ Requires-Dist: accelerate>=1.15.0; extra == 'selfhosted'
70
+ Requires-Dist: auto-round>=0.16.1; extra == 'selfhosted'
71
+ Requires-Dist: compressed-tensors>=0.20.1; extra == 'selfhosted'
72
+ Requires-Dist: kernels>=0.18.0; extra == 'selfhosted'
48
73
  Requires-Dist: nvidia-cudnn-cu13>=9.19.0.56; (sys_platform == 'linux') and extra == 'selfhosted'
49
- Requires-Dist: nvidia-cudnn-frontend>=1.30.0; (sys_platform == 'linux') and extra == 'selfhosted'
74
+ Requires-Dist: nvidia-cudnn-frontend>=1.32.1; (sys_platform == 'linux') and extra == 'selfhosted'
50
75
  Requires-Dist: protobuf>=6.33.6; extra == 'selfhosted'
51
76
  Requires-Dist: safetensors>=0.8.0; extra == 'selfhosted'
52
77
  Requires-Dist: sentencepiece>=0.2.2; extra == 'selfhosted'
53
78
  Requires-Dist: torch>=2.11.0; extra == 'selfhosted'
54
79
  Requires-Dist: torchvision>=0.26.0; extra == 'selfhosted'
55
- Requires-Dist: transformers>=5.8.0; extra == 'selfhosted'
80
+ Requires-Dist: transformers>=5.22.1; extra == 'selfhosted'
56
81
  Description-Content-Type: text/markdown
57
82
 
58
83
  # sagent🪄
@@ -100,7 +125,7 @@ A coding-agent CLI and strongly-typed Python library -- self-mutating, hot-swapp
100
125
  ## Quick Start
101
126
 
102
127
  ```bash
103
- uvx sagent
128
+ uvx sagent@latest
104
129
  ```
105
130
 
106
131
  See [Install](#install) for additional details.
@@ -122,12 +147,12 @@ See [Install](#install) for additional details.
122
147
 
123
148
  4. Unified cost tracking.
124
149
  - One USD total across every provider in a session.
125
- - Pricing base don API costs when on sub.
150
+ - Pricing based on API costs when on sub.
126
151
  - Sub-agent costs roll up to the root. `--max-budget-usd N` caps the whole tree.
127
152
 
128
153
  5. Self-directing agent fleets.
129
154
  - Agents retune their own runtime -- provider, model, thinking, context -- mid-task.
130
- - A coordinator can do it to its workers over `AgentSend`: *"switch to o1, crank thinking, recompact and drop the file reads."*
155
+ - A coordinator can do it to its workers over `AgentSend`: *"switch to luna, crank thinking, recompact and drop the file reads."*
131
156
 
132
157
  6. Recursive agent messaging.
133
158
  - Any spawned agent can spawn and `AgentSend` to any peer, so coordination is a tree, not a star.
@@ -135,7 +160,7 @@ See [Install](#install) for additional details.
135
160
 
136
161
  7. Richer built-in tools.
137
162
  - WebSearch/Fetch use headed or headless chrome.
138
- - `PaperSearch`/`PaperFetch` walk citation graphs and fetch PDFs.
163
+ - `PaperDetails` walks citation graphs; `PaperFetch` fetches PDFs.
139
164
  - Multi-backend `WebSearch`, `WebFetch` with markdown extraction, atomic read/write tracking on file tools.
140
165
 
141
166
  8. Unix-aligned and pipeable.
@@ -146,7 +171,7 @@ See [Install](#install) for additional details.
146
171
  - Example: `ls files/` is auto-promoted to `List(files/)` tool call.
147
172
 
148
173
  10. Universal session format.
149
- - Convert claude/codex sessions to from sagent format and vice versa.
174
+ - Typed session records keep whatever no field names in `extra`.
150
175
 
151
176
  11. All spawns' sessions (ancestors and/or descendants) can be focused.
152
177
 
@@ -160,30 +185,32 @@ See [Install](#install) for additional details.
160
185
  - The same `Agent` class powers the CLI, your application code, and recursive sub-agents.
161
186
 
162
187
  15. Typed Python objects.
163
- - `Agent`, `Tool`, `Model`, `Provider`, and `Message` are protocols and dataclasses you import, compose, and unit-test.
188
+ - `Agent`, `Tool`, `Model`, `Provider`, and the session records are protocols and dataclasses you import, compose, and unit-test.
164
189
  - Passes strict: `basedpyright`, `pyrefly`, and `ty`.
165
190
 
166
191
  Example:
167
192
 
168
193
  ```python
169
- from sagent import tools
170
- from sagent.agent import Agent
171
- from sagent.lib.codec import immutable
172
- from sagent.providers import Google
173
-
174
- agent = Agent(
175
- model=Google.from_env().model("gemini-pro-3.1"),
176
- system="You are a scientist.",
177
- tools=[tools.Read(), tools.Glob(), tools.Grep()],
178
- )
179
- result = await agent.run(immutable({"prompt": "analyze the CSV in ./data/"}))
180
- print(result.content)
194
+ from sagent.agent.agent import Agent
195
+ from sagent.providers.catalog import ModelCatalog
196
+ from sagent.tools.glob_tool import Glob
197
+ from sagent.tools.grep import Grep
198
+ from sagent.tools.read import Read
199
+
200
+ async with ModelCatalog() as catalog:
201
+ async with Agent(
202
+ model=catalog["google"]["gemini-pro-3.1"],
203
+ system_prompt="You are a scientist.",
204
+ tools=[Read(), Glob(), Grep()],
205
+ ) as agent:
206
+ print(await agent.send("analyze the CSV in ./data/"))
181
207
  ```
182
208
 
183
209
  ## Install
184
210
 
185
211
  ```bash
186
212
  uv tool install sagent && sagent
213
+ # Later: uv tool upgrade sagent
187
214
  ```
188
215
 
189
216
  If you're missing `uvx`/`uv`,
@@ -225,9 +252,9 @@ Sagent supports all subscriptions and API KEYs.
225
252
 
226
253
  | Provider | Env variable / Command |
227
254
  | -------------- | ------------------------------ |
228
- | `Anthropic` | `ANTHROPIC_API_KEY` |
255
+ | `Anthropic` | `ANTHROPIC_API_KEY`, or workload identity |
229
256
  | `AnthropicCLI` | `sagent login --provider acli` |
230
- | `OpenAI` | `OPENAI_API_KEY` |
257
+ | `OpenAI` | `OPENAI_API_KEY`, or workload identity |
231
258
  | `Google` | `GOOGLE_API_KEY` |
232
259
  | `GoogleCLI` | `sagent login --provider gcli` |
233
260
  | `Moonshot` | `MOONSHOT_API_KEY` |
@@ -263,7 +290,7 @@ For a small smoke test:
263
290
 
264
291
  ```bash
265
292
  sagent --provider SelfHosted --model Qwen/Qwen3-0.6B+float16+cuda \
266
- --effort none --max-response-tokens 32 --max-tool-call-rounds 1
293
+ --effort none --max-tool-call-rounds 1
267
294
  ```
268
295
 
269
296
  SelfHosted options use `+` suffixes after the model name. Device, dtype, and `compile` can appear in any order, but each category can appear once.
@@ -316,14 +343,14 @@ In code, open the servers and pass their tools:
316
343
  ```python
317
344
  from pathlib import Path
318
345
 
319
- from sagent import tools
320
- from sagent.agent import Agent
321
- from sagent.providers import Google
346
+ from sagent.agent.agent import Agent
347
+ from sagent.providers.catalog import ModelCatalog
322
348
  from sagent.tools.mcp import McpSession, servers
349
+ from sagent.tools.read import Read
323
350
 
324
- model = Google.from_env().model("gemini-pro-3.1")
325
- async with McpSession(servers(Path.cwd())) as mcp:
326
- async with Agent(model=model, tools=[tools.Read(), *mcp.tools()]) as agent:
351
+ async with ModelCatalog() as catalog, McpSession(servers(Path.cwd())) as mcp:
352
+ model = catalog["google"]["gemini-pro-3.1"]
353
+ async with Agent(model=model, tools=[Read(), *mcp.tools()]) as agent:
327
354
  ...
328
355
  ```
329
356
 
@@ -338,7 +365,7 @@ services. Sessions are plaintext local state and may contain prompts, model
338
365
  responses, tool results, file snippets, and paths.
339
366
 
340
367
  Use narrow tool sets, pass `--ephemeral` for one-off sensitive
341
- prompts so sessions and auto-memory are disabled, and run Sagent inside your own
368
+ prompts so no journal or memories are kept, and run Sagent inside your own
342
369
  OS/container sandbox when a task needs hard isolation. See
343
370
  [Security](https://github.com/rekursiv-ai/sagent/blob/main/docs/security.md).
344
371
 
@@ -43,7 +43,7 @@ A coding-agent CLI and strongly-typed Python library -- self-mutating, hot-swapp
43
43
  ## Quick Start
44
44
 
45
45
  ```bash
46
- uvx sagent
46
+ uvx sagent@latest
47
47
  ```
48
48
 
49
49
  See [Install](#install) for additional details.
@@ -65,12 +65,12 @@ See [Install](#install) for additional details.
65
65
 
66
66
  4. Unified cost tracking.
67
67
  - One USD total across every provider in a session.
68
- - Pricing base don API costs when on sub.
68
+ - Pricing based on API costs when on sub.
69
69
  - Sub-agent costs roll up to the root. `--max-budget-usd N` caps the whole tree.
70
70
 
71
71
  5. Self-directing agent fleets.
72
72
  - Agents retune their own runtime -- provider, model, thinking, context -- mid-task.
73
- - A coordinator can do it to its workers over `AgentSend`: *"switch to o1, crank thinking, recompact and drop the file reads."*
73
+ - A coordinator can do it to its workers over `AgentSend`: *"switch to luna, crank thinking, recompact and drop the file reads."*
74
74
 
75
75
  6. Recursive agent messaging.
76
76
  - Any spawned agent can spawn and `AgentSend` to any peer, so coordination is a tree, not a star.
@@ -78,7 +78,7 @@ See [Install](#install) for additional details.
78
78
 
79
79
  7. Richer built-in tools.
80
80
  - WebSearch/Fetch use headed or headless chrome.
81
- - `PaperSearch`/`PaperFetch` walk citation graphs and fetch PDFs.
81
+ - `PaperDetails` walks citation graphs; `PaperFetch` fetches PDFs.
82
82
  - Multi-backend `WebSearch`, `WebFetch` with markdown extraction, atomic read/write tracking on file tools.
83
83
 
84
84
  8. Unix-aligned and pipeable.
@@ -89,7 +89,7 @@ See [Install](#install) for additional details.
89
89
  - Example: `ls files/` is auto-promoted to `List(files/)` tool call.
90
90
 
91
91
  10. Universal session format.
92
- - Convert claude/codex sessions to from sagent format and vice versa.
92
+ - Typed session records keep whatever no field names in `extra`.
93
93
 
94
94
  11. All spawns' sessions (ancestors and/or descendants) can be focused.
95
95
 
@@ -103,30 +103,32 @@ See [Install](#install) for additional details.
103
103
  - The same `Agent` class powers the CLI, your application code, and recursive sub-agents.
104
104
 
105
105
  15. Typed Python objects.
106
- - `Agent`, `Tool`, `Model`, `Provider`, and `Message` are protocols and dataclasses you import, compose, and unit-test.
106
+ - `Agent`, `Tool`, `Model`, `Provider`, and the session records are protocols and dataclasses you import, compose, and unit-test.
107
107
  - Passes strict: `basedpyright`, `pyrefly`, and `ty`.
108
108
 
109
109
  Example:
110
110
 
111
111
  ```python
112
- from sagent import tools
113
- from sagent.agent import Agent
114
- from sagent.lib.codec import immutable
115
- from sagent.providers import Google
116
-
117
- agent = Agent(
118
- model=Google.from_env().model("gemini-pro-3.1"),
119
- system="You are a scientist.",
120
- tools=[tools.Read(), tools.Glob(), tools.Grep()],
121
- )
122
- result = await agent.run(immutable({"prompt": "analyze the CSV in ./data/"}))
123
- print(result.content)
112
+ from sagent.agent.agent import Agent
113
+ from sagent.providers.catalog import ModelCatalog
114
+ from sagent.tools.glob_tool import Glob
115
+ from sagent.tools.grep import Grep
116
+ from sagent.tools.read import Read
117
+
118
+ async with ModelCatalog() as catalog:
119
+ async with Agent(
120
+ model=catalog["google"]["gemini-pro-3.1"],
121
+ system_prompt="You are a scientist.",
122
+ tools=[Read(), Glob(), Grep()],
123
+ ) as agent:
124
+ print(await agent.send("analyze the CSV in ./data/"))
124
125
  ```
125
126
 
126
127
  ## Install
127
128
 
128
129
  ```bash
129
130
  uv tool install sagent && sagent
131
+ # Later: uv tool upgrade sagent
130
132
  ```
131
133
 
132
134
  If you're missing `uvx`/`uv`,
@@ -168,9 +170,9 @@ Sagent supports all subscriptions and API KEYs.
168
170
 
169
171
  | Provider | Env variable / Command |
170
172
  | -------------- | ------------------------------ |
171
- | `Anthropic` | `ANTHROPIC_API_KEY` |
173
+ | `Anthropic` | `ANTHROPIC_API_KEY`, or workload identity |
172
174
  | `AnthropicCLI` | `sagent login --provider acli` |
173
- | `OpenAI` | `OPENAI_API_KEY` |
175
+ | `OpenAI` | `OPENAI_API_KEY`, or workload identity |
174
176
  | `Google` | `GOOGLE_API_KEY` |
175
177
  | `GoogleCLI` | `sagent login --provider gcli` |
176
178
  | `Moonshot` | `MOONSHOT_API_KEY` |
@@ -206,7 +208,7 @@ For a small smoke test:
206
208
 
207
209
  ```bash
208
210
  sagent --provider SelfHosted --model Qwen/Qwen3-0.6B+float16+cuda \
209
- --effort none --max-response-tokens 32 --max-tool-call-rounds 1
211
+ --effort none --max-tool-call-rounds 1
210
212
  ```
211
213
 
212
214
  SelfHosted options use `+` suffixes after the model name. Device, dtype, and `compile` can appear in any order, but each category can appear once.
@@ -259,14 +261,14 @@ In code, open the servers and pass their tools:
259
261
  ```python
260
262
  from pathlib import Path
261
263
 
262
- from sagent import tools
263
- from sagent.agent import Agent
264
- from sagent.providers import Google
264
+ from sagent.agent.agent import Agent
265
+ from sagent.providers.catalog import ModelCatalog
265
266
  from sagent.tools.mcp import McpSession, servers
267
+ from sagent.tools.read import Read
266
268
 
267
- model = Google.from_env().model("gemini-pro-3.1")
268
- async with McpSession(servers(Path.cwd())) as mcp:
269
- async with Agent(model=model, tools=[tools.Read(), *mcp.tools()]) as agent:
269
+ async with ModelCatalog() as catalog, McpSession(servers(Path.cwd())) as mcp:
270
+ model = catalog["google"]["gemini-pro-3.1"]
271
+ async with Agent(model=model, tools=[Read(), *mcp.tools()]) as agent:
270
272
  ...
271
273
  ```
272
274
 
@@ -281,7 +283,7 @@ services. Sessions are plaintext local state and may contain prompts, model
281
283
  responses, tool results, file snippets, and paths.
282
284
 
283
285
  Use narrow tool sets, pass `--ephemeral` for one-off sensitive
284
- prompts so sessions and auto-memory are disabled, and run Sagent inside your own
286
+ prompts so no journal or memories are kept, and run Sagent inside your own
285
287
  OS/container sandbox when a task needs hard isolation. See
286
288
  [Security](https://github.com/rekursiv-ai/sagent/blob/main/docs/security.md).
287
289
 
@@ -0,0 +1,159 @@
1
+ # Python API
2
+
3
+ Sagent is a Python runtime for typed agent loops. The CLI is a thin surface over the same `Agent`, `Model`, `Provider`, and `Tool` contracts.
4
+
5
+ ## Minimal agent
6
+
7
+ ```python
8
+ import asyncio
9
+
10
+ from sagent.agent.agent import Agent
11
+ from sagent.providers.catalog import ModelCatalog
12
+ from sagent.tools.glob_tool import Glob
13
+ from sagent.tools.grep import Grep
14
+ from sagent.tools.read import Read
15
+
16
+
17
+ async def main() -> None:
18
+ async with ModelCatalog() as catalog:
19
+ async with Agent(
20
+ model=catalog["google"]["gemini-pro-3.1"],
21
+ system_prompt="You summarize files concisely.",
22
+ tools=[Read(), Glob(), Grep()],
23
+ ) as agent:
24
+ print(await agent.send("Summarize README.md"))
25
+
26
+
27
+ asyncio.run(main())
28
+ ```
29
+
30
+ `async with Agent(...)` starts the runtime; `send()` returns the reply's text once the agent is idle.
31
+
32
+ ## Agent constructor
33
+
34
+ ```python
35
+ agent = Agent(
36
+ model=model,
37
+ tools=(),
38
+ system_prompt=None,
39
+ journal=None,
40
+ compactor=NoShrinker,
41
+ pruner=NoShrinker,
42
+ tool_context=None,
43
+ max_rounds=None,
44
+ max_spend_usd=None,
45
+ persistent_retry=False,
46
+ agents_md=None,
47
+ allowed=None,
48
+ environment=True,
49
+ account=None,
50
+ )
51
+ ```
52
+
53
+ Every argument is keyword-only.
54
+
55
+ | Argument | Meaning |
56
+ | --- | --- |
57
+ | `model` | Required `Model`; assign `agent.model` later to switch. |
58
+ | `tools` | Tools the model may call; names must differ. |
59
+ | `system_prompt` | What the model is told it is; `None` uses the default prompt. |
60
+ | `journal` | Where the session is written; `None` keeps nothing. Open a `JsonlJournal` yourself and pass it. |
61
+ | `compactor` | Factory for what summarizes the session, usually `SummaryCompactor`. |
62
+ | `pruner` | Factory for what drops old tool results, usually `Pruner`. |
63
+ | `tool_context` | Working directory, result size limit, terminal width, and fetch session; `ToolContext()` when omitted. |
64
+ | `max_rounds` | Tool-call rounds one turn may run; `None` for no cap. |
65
+ | `max_spend_usd` | USD the agent may spend; `None` for no cap. |
66
+ | `persistent_retry` | Wait out a long rate limit instead of raising. |
67
+ | `agents_md` | Where `AGENTS.md` files are looked for; defaults when omitted. |
68
+ | `allowed` | Tool names the model may call; `None` for all. The rest are still offered, so the prompt cache holds. |
69
+ | `environment` | Tell the model its directory, git state, platform, and shell. |
70
+ | `account` | Named login for the model's provider; `None` for its default. |
71
+
72
+ ## Running agents
73
+
74
+ ```python
75
+ reply = await agent.send("Do the task")
76
+
77
+ async for words in agent.stream("Now explain it"):
78
+ print(words, end="")
79
+ ```
80
+
81
+ - `send(text, attachments=())` returns the last text the model wrote in the turn.
82
+ - `stream(text, attachments=())` yields the reply's text as it is written.
83
+ - Both raise `BudgetExhaustedError` past `max_spend_usd` and `RoundLimitError` past `max_rounds`.
84
+ - `attachments` takes `Attachment(mime_descriptor=..., data=...)` images and documents.
85
+
86
+ Every runtime event -- thinking, tool calls, tool results, compactions -- goes to `agent.runtime`. See [Streaming](streaming.md).
87
+
88
+ ## Observable state
89
+
90
+ | Attribute | Meaning |
91
+ | --- | --- |
92
+ | `model` | Current model; assign to switch at the next model call. |
93
+ | `system_prompt` | Assign to change what the model is told it is. |
94
+ | `tools` | Tools offered, by name. |
95
+ | `allowed` | Tools the model may call; assign to change. |
96
+ | `session` | The conversation: iterate it, `append()` records, `clear()`, and reach its `journal`, `compactor`, and `pruner`. |
97
+ | `runtime` | What runs the turns: `observers`, `async for event in agent.runtime`, `halt()`, `jobs`. |
98
+ | `spend_usd` | USD the model calls have cost, a resumed session's included. |
99
+ | `max_rounds`, `max_spend_usd` | The caps; assign to change. |
100
+ | `running` | Whether the runtime serves turns. |
101
+ | `root` | Where the session started. |
102
+
103
+ ## Models and providers
104
+
105
+ A `ModelCatalog` holds every provider, sharing one HTTP client and process pool. Looking a model up does no I/O.
106
+
107
+ ```python
108
+ async with ModelCatalog() as catalog:
109
+ model = catalog["google"]["gemini-pro-3.1"]
110
+ utility = catalog["google"]["utility"]
111
+ ```
112
+
113
+ A provider can also be used alone:
114
+
115
+ ```python
116
+ from sagent.providers.google.api import Google
117
+
118
+ async with Google() as google:
119
+ model = google["gemini-pro-3.1"]
120
+ ```
121
+
122
+ A `Model` exposes:
123
+
124
+ - `capability`: every setting it offers, its limits, and its prices.
125
+ - `settings`: the settings chosen; assign to change them.
126
+ - `count(request)`: tokens a `Request` would send.
127
+ - `stream(request)`: yields `TextChunk`s, then the finished `Response`.
128
+
129
+ ```python
130
+ from dataclasses import replace
131
+
132
+ model.settings = replace(model.settings, thinking_effort="high")
133
+ ```
134
+
135
+ `Request` holds system prompt blocks, session records, and tools. `Response` holds the reply's records, token counts, spend, and stop reason.
136
+
137
+ ## Session records
138
+
139
+ A session is a sequence of frozen dataclasses from `sagent.session.types`: `UserMessage`, `AssistantMessage`, `Thinking`, `ToolCall`, tool results such as `BashResult` and `UncategorizedToolResult`, `SystemMessage`, and more. `JsonlJournal` writes one record per JSON line.
140
+
141
+ ## Tools
142
+
143
+ A tool has a `name`, `description`, JSON `schema`, and `display`, and implements:
144
+
145
+ ```python
146
+ def summary(self, arguments: Mapping[str, PlainTree]) -> str: ...
147
+ def serialize_key(
148
+ self, context: ToolContext, arguments: Mapping[str, PlainTree]
149
+ ) -> str | None: ...
150
+ async def call(
151
+ self, context: ToolContext, arguments: Mapping[str, PlainTree]
152
+ ) -> AnyToolResult: ...
153
+ ```
154
+
155
+ See [Tools](tools.md) for built-ins and custom-tool examples.
156
+
157
+ ## Costs
158
+
159
+ Each `Response` carries its `TokenCount` and `TokenCost`. `agent.spend_usd` sums them across the session, children's spend included. With `max_spend_usd` set, the turn halts and raises `BudgetExhaustedError` once spend reaches the cap.