steerable-agent-runtime 0.11.1__tar.gz → 0.12.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 (193) hide show
  1. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/PKG-INFO +13 -9
  2. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/README.md +12 -8
  3. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/pyproject.toml +1 -1
  4. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/__init__.py +3 -4
  5. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/orchestration.py +5 -5
  6. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/pool.py +67 -33
  7. steerable_agent_runtime-0.12.1/src/steerable_agent_runtime/spend.py +82 -0
  8. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime.egg-info/PKG-INFO +13 -9
  9. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime.egg-info/SOURCES.txt +3 -3
  10. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_orchestration.py +54 -0
  11. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_pool_registry.py +74 -0
  12. steerable_agent_runtime-0.12.1/tests/test_tree_spend.py +116 -0
  13. steerable_agent_runtime-0.11.1/tests/test_tree_budget_pool.py → steerable_agent_runtime-0.12.1/tests/test_tree_spend_pool.py +39 -40
  14. steerable_agent_runtime-0.11.1/src/steerable_agent_runtime/budget.py +0 -124
  15. steerable_agent_runtime-0.11.1/tests/test_tree_budget.py +0 -143
  16. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/setup.cfg +0 -0
  17. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/antihallucination.py +0 -0
  18. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/approval.py +0 -0
  19. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/approval_policy.py +0 -0
  20. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/ask_user.py +0 -0
  21. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/branch.py +0 -0
  22. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/cache_control.py +0 -0
  23. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/calibration.py +0 -0
  24. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/child_notice.py +0 -0
  25. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/child_record.py +0 -0
  26. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/compaction.py +0 -0
  27. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/compaction_policy.py +0 -0
  28. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/config.py +0 -0
  29. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/default.harness.json +0 -0
  30. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/default.harness.yaml +0 -0
  31. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/delegation_gate.py +0 -0
  32. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/engines.py +0 -0
  33. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/errors.py +0 -0
  34. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/gateway_catalog.py +0 -0
  35. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/handoff.py +0 -0
  36. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/harness.py +0 -0
  37. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/harness_spec.py +0 -0
  38. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/history.py +0 -0
  39. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/hooks.py +0 -0
  40. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/__init__.py +0 -0
  41. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/anthropic_native.py +0 -0
  42. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/compat.py +0 -0
  43. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/errors.py +0 -0
  44. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/google_genai.py +0 -0
  45. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/openai_compat.py +0 -0
  46. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/openai_responses.py +0 -0
  47. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/parts.py +0 -0
  48. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/presets.py +0 -0
  49. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/llm/system_proxy.py +0 -0
  50. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/loop.py +0 -0
  51. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/maintenance.py +0 -0
  52. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/mcp.py +0 -0
  53. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/mcp_server.py +0 -0
  54. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/model_catalog.py +0 -0
  55. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/model_info.py +0 -0
  56. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/model_resolve.py +0 -0
  57. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/native_bridge.py +0 -0
  58. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/observation_aging.py +0 -0
  59. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/otel.py +0 -0
  60. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/peer.py +0 -0
  61. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/plugins.py +0 -0
  62. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/pricing.py +0 -0
  63. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/pseudo.py +0 -0
  64. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/recording.py +0 -0
  65. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/registry.py +0 -0
  66. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/reminders.py +0 -0
  67. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/replay.py +0 -0
  68. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/resume.py +0 -0
  69. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/retry.py +0 -0
  70. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/sandboxed.py +0 -0
  71. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/skills.py +0 -0
  72. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/spill.py +0 -0
  73. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/storage/__init__.py +0 -0
  74. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/storage/in_memory.py +0 -0
  75. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/storage/sqlalchemy_store.py +0 -0
  76. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/storage/sqlite_store.py +0 -0
  77. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/storage/write_lease.py +0 -0
  78. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/subagent.py +0 -0
  79. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/team_board.py +0 -0
  80. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/todo.py +0 -0
  81. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/tokens.py +0 -0
  82. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/tool_presentation.py +0 -0
  83. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/tool_schema.py +0 -0
  84. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/tool_search.py +0 -0
  85. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/tools.py +0 -0
  86. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/tracing.py +0 -0
  87. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/transport/__init__.py +0 -0
  88. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/transport/fastapi_sse.py +0 -0
  89. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/transport/stdio_jsonrpc.py +0 -0
  90. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/tree.py +0 -0
  91. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime/world_state.py +0 -0
  92. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime.egg-info/dependency_links.txt +0 -0
  93. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime.egg-info/requires.txt +0 -0
  94. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/src/steerable_agent_runtime.egg-info/top_level.txt +0 -0
  95. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_antihallucination.py +0 -0
  96. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_approval.py +0 -0
  97. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_approval_policy.py +0 -0
  98. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_ask_user.py +0 -0
  99. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_branch.py +0 -0
  100. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_cache_control.py +0 -0
  101. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_cache_instrumentation.py +0 -0
  102. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_calibration.py +0 -0
  103. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_child_notice.py +0 -0
  104. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_children_schema.py +0 -0
  105. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_children_usage.py +0 -0
  106. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_compaction.py +0 -0
  107. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_compaction_policy.py +0 -0
  108. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_compaction_strategy.py +0 -0
  109. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_config.py +0 -0
  110. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_content_parts.py +0 -0
  111. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_cross_model_fork.py +0 -0
  112. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_delegation_fork.py +0 -0
  113. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_delegation_gate.py +0 -0
  114. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_engines.py +0 -0
  115. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_error_taxonomy.py +0 -0
  116. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_fanout.py +0 -0
  117. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_fork_prefix.py +0 -0
  118. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_fork_spawn.py +0 -0
  119. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_fragment_bounds.py +0 -0
  120. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_gateway_catalog.py +0 -0
  121. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_golden.py +0 -0
  122. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_handoff.py +0 -0
  123. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_harness.py +0 -0
  124. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_harness_spec.py +0 -0
  125. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_history.py +0 -0
  126. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_history_persistence.py +0 -0
  127. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_hooks.py +0 -0
  128. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_in_memory_storage.py +0 -0
  129. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_llm_gemini_wire.py +0 -0
  130. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_llm_responses_wire.py +0 -0
  131. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_llm_stream_e2e.py +0 -0
  132. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_llm_wire_helpers.py +0 -0
  133. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_long_session.py +0 -0
  134. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_loop.py +0 -0
  135. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_loop_cancellation.py +0 -0
  136. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_loop_replay.py +0 -0
  137. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_loop_sandbox_event.py +0 -0
  138. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_loop_terminal.py +0 -0
  139. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_maintenance.py +0 -0
  140. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_mcp.py +0 -0
  141. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_mcp_server.py +0 -0
  142. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_model_catalog.py +0 -0
  143. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_model_equivalence.py +0 -0
  144. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_model_info.py +0 -0
  145. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_model_resolve.py +0 -0
  146. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_native_default.py +0 -0
  147. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_observation_aging.py +0 -0
  148. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_otel.py +0 -0
  149. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_parallel_tools.py +0 -0
  150. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_plugins.py +0 -0
  151. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_pool_acp.py +0 -0
  152. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_provider_compat.py +0 -0
  153. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_provider_presets.py +0 -0
  154. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_pseudo.py +0 -0
  155. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_pyo3_api_surface.py +0 -0
  156. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_recording.py +0 -0
  157. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_registry.py +0 -0
  158. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_reminders.py +0 -0
  159. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_replay_crosslang.py +0 -0
  160. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_resume.py +0 -0
  161. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_resume_child.py +0 -0
  162. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_resume_failed_turn.py +0 -0
  163. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_retry_hooks.py +0 -0
  164. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_safety_gate.py +0 -0
  165. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_sandboxed.py +0 -0
  166. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_skills.py +0 -0
  167. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_soft_timeout.py +0 -0
  168. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_spill.py +0 -0
  169. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_sqlite_storage.py +0 -0
  170. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_steer.py +0 -0
  171. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_storage_contract.py +0 -0
  172. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_stream_strip.py +0 -0
  173. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_subagent.py +0 -0
  174. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_system_proxy.py +0 -0
  175. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_team_board.py +0 -0
  176. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_team_collab.py +0 -0
  177. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_todo.py +0 -0
  178. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_todo_gate.py +0 -0
  179. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_tokens.py +0 -0
  180. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_tool_exposure.py +0 -0
  181. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_tool_hygiene.py +0 -0
  182. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_tool_presentation.py +0 -0
  183. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_tool_router.py +0 -0
  184. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_tool_schema.py +0 -0
  185. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_tool_timeout.py +0 -0
  186. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_trace_recorder.py +0 -0
  187. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_transport_error_detail.py +0 -0
  188. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_transport_jsonrpc.py +0 -0
  189. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_transport_sse.py +0 -0
  190. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_tree.py +0 -0
  191. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_usage_attribution.py +0 -0
  192. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_world_state.py +0 -0
  193. {steerable_agent_runtime-0.11.1 → steerable_agent_runtime-0.12.1}/tests/test_write_lease.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: steerable-agent-runtime
3
- Version: 0.11.1
3
+ Version: 0.12.1
4
4
  Summary: Steerable agent runtime: LLM, tool, storage, and transport adapters.
5
5
  License: Apache-2.0
6
6
  Requires-Python: >=3.10
@@ -64,14 +64,18 @@ release. Nothing in the single-agent path changed.
64
64
  `CREATE TABLE IF NOT EXISTS`, so an existing database upgrades in place on
65
65
  first open — no migration function, no data rewrite. A database written by a
66
66
  newer build still refuses to open.
67
- - **`budgetTokens` now bounds the whole turn tree.** It used to limit each
68
- loop separately; a parent plus three children could each spend the full
69
- allowance. Every agent in the tree now debits one counter, and the first to
70
- cross it fails there. A host that relied on per-child allowances gets a
71
- tighter (correct) limit.
72
- - **New `TreeBudget` / `SessionBudgetExceeded`** in `steerable_agent_runtime`.
73
- `AgentPool(budget=...)` shares one counter across the pool; the parent loop's
74
- usage is charged to the same counter by the host.
67
+ - **`budgetTokens` no longer bounds the turn tree.** It still caps the parent
68
+ run's own loop (unchanged from before the tree layer), but there is no longer
69
+ a shared tree limit: `TreeBudget` and `SessionBudgetExceeded` are gone,
70
+ replaced by `TreeSpend`, which only records.
71
+ - Why removed: a tree limit stopped a task partway through, leaving children
72
+ at `budget_exhausted` and needing a human to click resume. A turn that runs
73
+ long had more work, not a failure. Cost control belongs before a turn
74
+ starts (or on a period budget), not inside one already half done.
75
+ - What replaced it: `TreeSpend` — `record(usage, agent=...)` plus
76
+ `report() -> {spent, by_agent}` — so a host can still show what a turn cost
77
+ and which agent spent it. `AgentPool(spend=...)` shares one counter across
78
+ the pool; the parent's usage is recorded into the same counter by the host.
75
79
  - **`provider_factory` for sub-agent profiles now takes `(model, effort)`**
76
80
  instead of `(model)`. `None` for either knob means "inherit the parent's",
77
81
  never "clear it". A profile pinning neither does not rebuild the provider at
@@ -37,14 +37,18 @@ release. Nothing in the single-agent path changed.
37
37
  `CREATE TABLE IF NOT EXISTS`, so an existing database upgrades in place on
38
38
  first open — no migration function, no data rewrite. A database written by a
39
39
  newer build still refuses to open.
40
- - **`budgetTokens` now bounds the whole turn tree.** It used to limit each
41
- loop separately; a parent plus three children could each spend the full
42
- allowance. Every agent in the tree now debits one counter, and the first to
43
- cross it fails there. A host that relied on per-child allowances gets a
44
- tighter (correct) limit.
45
- - **New `TreeBudget` / `SessionBudgetExceeded`** in `steerable_agent_runtime`.
46
- `AgentPool(budget=...)` shares one counter across the pool; the parent loop's
47
- usage is charged to the same counter by the host.
40
+ - **`budgetTokens` no longer bounds the turn tree.** It still caps the parent
41
+ run's own loop (unchanged from before the tree layer), but there is no longer
42
+ a shared tree limit: `TreeBudget` and `SessionBudgetExceeded` are gone,
43
+ replaced by `TreeSpend`, which only records.
44
+ - Why removed: a tree limit stopped a task partway through, leaving children
45
+ at `budget_exhausted` and needing a human to click resume. A turn that runs
46
+ long had more work, not a failure. Cost control belongs before a turn
47
+ starts (or on a period budget), not inside one already half done.
48
+ - What replaced it: `TreeSpend` — `record(usage, agent=...)` plus
49
+ `report() -> {spent, by_agent}` — so a host can still show what a turn cost
50
+ and which agent spent it. `AgentPool(spend=...)` shares one counter across
51
+ the pool; the parent's usage is recorded into the same counter by the host.
48
52
  - **`provider_factory` for sub-agent profiles now takes `(model, effort)`**
49
53
  instead of `(model)`. `None` for either knob means "inherit the parent's",
50
54
  never "clear it". A profile pinning neither does not rebuild the provider at
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "steerable-agent-runtime"
3
- version = "0.11.1"
3
+ version = "0.12.1"
4
4
  description = "Steerable agent runtime: LLM, tool, storage, and transport adapters."
5
5
  license = { text = "Apache-2.0" }
6
6
  readme = "README.md"
@@ -83,7 +83,7 @@ from .branch import (
83
83
  lineage,
84
84
  resolve_fork_seq,
85
85
  )
86
- from .budget import SessionBudgetExceeded, TreeBudget, TreeBudgetReport
86
+ from .spend import TreeSpend, TreeSpendReport
87
87
  from .tree import AgentTree, TreeMember
88
88
  from .team_board import TaskItem, TeamTaskBoard
89
89
  from .cache_control import (
@@ -383,9 +383,8 @@ __all__ = [
383
383
  "ChildRegistry",
384
384
  "ChildNoticeHooks",
385
385
  "CHILD_NOTICE_KIND",
386
- "SessionBudgetExceeded",
387
- "TreeBudget",
388
- "TreeBudgetReport",
386
+ "TreeSpend",
387
+ "TreeSpendReport",
389
388
  "render_child_notice",
390
389
  "ChildStatusView",
391
390
  "SpawnedChild",
@@ -40,7 +40,7 @@ from typing import Any
40
40
 
41
41
  from steerable_agent_protocol.generated import ToolCall, ToolResult
42
42
 
43
- from .budget import TreeBudget
43
+ from .spend import TreeSpend
44
44
  from .hooks import ChainHooks, CompletionAction, CompletionDraft, NoopHooks
45
45
  from .history import completed_turn_prefix
46
46
  from .llm import LLMMessage, LLMProvider
@@ -533,7 +533,7 @@ class OrchestrationExecutor:
533
533
  history_store: Any | None = None,
534
534
  parent_record_id: str | None = None,
535
535
  parent_projection: Callable[[], list[LLMMessage]] | None = None,
536
- budget: TreeBudget | None = None,
536
+ spend: TreeSpend | None = None,
537
537
  parent_route: Callable[[], tuple[str | None, str | None]] | None = None,
538
538
  provider_factory: Callable[[str | None, str | None], LLMProvider] | None = None,
539
539
  tree: AgentTree | None = None,
@@ -592,7 +592,7 @@ class OrchestrationExecutor:
592
592
  else None
593
593
  )
594
594
  #: The tree's shared token limit; ``None`` keeps per-run accounting.
595
- self._budget = budget
595
+ self._spend = spend
596
596
  self._depth = _depth
597
597
  self._lineage = _lineage
598
598
  self._pool = AgentPool(
@@ -603,7 +603,7 @@ class OrchestrationExecutor:
603
603
  event_sink=event_sink,
604
604
  registry=registry,
605
605
  parent_record_id=parent_record_id,
606
- budget=budget,
606
+ spend=spend,
607
607
  # Needed to write a fork seed's provenance into the child's record.
608
608
  history_store=history_store,
609
609
  tree=tree,
@@ -681,7 +681,7 @@ class OrchestrationExecutor:
681
681
  parent_projection=lambda: (
682
682
  own_loop[0].history.projection if own_loop else []
683
683
  ),
684
- budget=self._budget,
684
+ spend=self._spend,
685
685
  # Same tree and board: a grandchild is as much a member of the
686
686
  # job as its parent, and the plan it reads must be the one the
687
687
  # root wrote.
@@ -41,7 +41,7 @@ from dataclasses import dataclass
41
41
  from itertools import count
42
42
  from typing import Any
43
43
 
44
- from .budget import SessionBudgetExceeded, TreeBudget, TreeBudgetReport
44
+ from .spend import TreeSpend
45
45
  from .engines import (
46
46
  AcpEngineSpec,
47
47
  AcpOutcome,
@@ -161,6 +161,10 @@ class _ChildHandle:
161
161
  #: Terminal flag set by close()/shutdown(): a closed child rejects
162
162
  #: sends even after its run has finished.
163
163
  self.closed = False
164
+ #: Set by ``shutdown`` only — the turn ended, not the child. Its row
165
+ #: then settles as ``cancelled`` (resumable) rather than ``closed``:
166
+ #: "the parent stopped waiting" is not "the user gave up on it".
167
+ self.pool_gone = False
164
168
  #: Model-visible record snapshot at the end of the last cleanly
165
169
  #: finished run (cooperative cancel included — the loop guarantees
166
170
  #: no dangling tool_calls). ``None`` before the first clean finish;
@@ -244,7 +248,7 @@ class AgentPool:
244
248
  event_sink: Callable[[str, dict[str, Any]], None] | None = None,
245
249
  registry: ChildRegistry | None = None,
246
250
  parent_record_id: str | None = None,
247
- budget: TreeBudget | None = None,
251
+ spend: TreeSpend | None = None,
248
252
  history_store: Any | None = None,
249
253
  tree: AgentTree | None = None,
250
254
  ) -> None:
@@ -277,10 +281,10 @@ class AgentPool:
277
281
  #: (``<parent>:child:<lineage>``). Absent for a parent that never had
278
282
  #: one (a bare test loop), in which case children go unregistered.
279
283
  self._parent_record_id = parent_record_id
280
- #: One token limit for the whole tree. ``None`` means each run keeps
281
- #: its own accounting, which is the pre-delegation behaviour — a pool
282
- #: without a shared budget cannot charge siblings against each other.
283
- self._budget = budget
284
+ #: Per-agent accumulation for the turn's usage report. ``None`` keeps
285
+ #: the pool's own accounting off, which is what a bare pool (tests,
286
+ #: hosts without a tree) gets — nothing is charged, nothing is capped.
287
+ self._spend = spend
284
288
  #: The record channel. Needed only to write a fork seed's provenance
285
289
  #: into the child's own record; ``None`` keeps the legacy behaviour
286
290
  #: (the seed is just the child's opening messages).
@@ -368,14 +372,6 @@ class AgentPool:
368
372
  f"({len(live)} children running); wait for one to finish "
369
373
  "or close one before spawning again"
370
374
  )
371
- # A tree that already spent its budget must not start new work: the
372
- # child would run until its own wall and then be refused anyway, which
373
- # costs tokens for nothing.
374
- if self._budget is not None and self._budget.exhausted:
375
- raise OrchestrationBudgetExceeded(
376
- f"the turn tree has spent {self._budget.report().spent} of its "
377
- f"{self._budget.limit} tokens; no further children can start"
378
- )
379
375
  self._seq += 1
380
376
  child_id = f"{self._lineage}.{self._seq}"
381
377
  if acp_engine is not None:
@@ -741,16 +737,11 @@ class AgentPool:
741
737
  handle.outcome = ChildOutcome(handle.child_id, status, answer)
742
738
  usage = handle.loop.last_run_usage
743
739
  handle.usage = usage
744
- # Charge the tree before announcing: a child that pushed the tree over
745
- # its limit must be reported as having done so, not settled quietly
746
- # and letting the parent discover it on the next spawn.
747
- budget_exceeded: str | None = None
748
- if self._budget is not None:
749
- try:
750
- self._budget.charge(usage, agent=handle.child_id)
751
- except SessionBudgetExceeded as exc:
752
- budget_exceeded = str(exc)
753
- logger.warning("child %s crossed the tree budget: %s", handle.child_id, exc)
740
+ # Record the spend for attribution. Unbounded by design: a turn that
741
+ # runs long is a turn that had more work, not a failure, and stopping
742
+ # it mid-task costs the work already done. The host shows the number.
743
+ if self._spend is not None:
744
+ self._spend.record(usage, agent=handle.child_id)
754
745
  kind = "child_completed" if status == "completed" else "child_failed"
755
746
  self._emit(
756
747
  kind,
@@ -762,7 +753,6 @@ class AgentPool:
762
753
  # read, and a parent computing turn cost needs it before the
763
754
  # stream closes.
764
755
  **({"usage": _usage_payload(usage)} if usage is not None else {}),
765
- **({"budgetExceeded": budget_exceeded} if budget_exceeded else {}),
766
756
  },
767
757
  )
768
758
  await self._settle_child(handle, status=status, usage=usage)
@@ -859,10 +849,21 @@ class AgentPool:
859
849
  if self._registry is None or self._parent_record_id is None:
860
850
  return
861
851
  record_id = default_record_id(self._parent_record_id, handle.child_id)
852
+ # A closed child's row says `closed`, whatever the run it was in the
853
+ # middle of reports. Cancelling to close produces `cancelled` from the
854
+ # loop, and writing that would leave the row resumable again — the
855
+ # in-memory flag dies with the pool, the row does not.
856
+ #
857
+ # ``shutdown`` also marks handles closed, but that is the turn
858
+ # ending rather than the user giving up: those rows settle as
859
+ # ``cancelled`` (resumable) and `pool_gone` is what tells them apart.
860
+ final_status = (
861
+ "closed" if handle.closed and not handle.pool_gone else registry_status(status)
862
+ )
862
863
  try:
863
864
  wrote = await self._registry.finished(
864
865
  record_id,
865
- status=registry_status(status),
866
+ status=final_status,
866
867
  usage=usage,
867
868
  usage_known=handle.usage_known,
868
869
  )
@@ -871,14 +872,14 @@ class AgentPool:
871
872
  except Exception as exc: # noqa: BLE001 — bookkeeping never fails a run
872
873
  logger.warning("child %s registry settle failed: %s", handle.child_id, exc)
873
874
 
874
- def budget_report(self) -> TreeBudgetReport | None:
875
- """The tree budget's snapshot, or ``None`` when this pool has none.
875
+ def spend_report(self) -> TreeSpendReport | None:
876
+ """The tree's per-agent spend, or ``None`` when this pool has none.
876
877
 
877
878
  Exposed so a host can report the turn's real cost (parent plus every
878
- child) without walking the registry, and can tell "no limit" from
879
- "zero spent".
879
+ child) without walking the registry. There is no limit to compare
880
+ against: the number is for display.
880
881
  """
881
- return self._budget.report() if self._budget is not None else None
882
+ return self._spend.report() if self._spend is not None else None
882
883
 
883
884
  def children_usage(self) -> tuple[list[dict[str, Any]], int]:
884
885
  """Per-child bills for this turn's usage record, and the unknown count.
@@ -1132,6 +1133,13 @@ class AgentPool:
1132
1133
  # so a peer's message reports an unknown member instead of resuming an
1133
1134
  # agent the owner already gave up on.
1134
1135
  self._leave_tree(child_id)
1136
+ # The same promise has to reach the durable row, not just this
1137
+ # process. `send` after close is refused by `_resume_from_registry`
1138
+ # only because that row says `closed`; leaving it at its last run's
1139
+ # status let a closed child be resumed by a later turn (or by another
1140
+ # executor reading the same registry) — the in-memory flag dies with
1141
+ # the pool, the row does not.
1142
+ await self._mark_closed(handle)
1135
1143
  if handle.outcome is not None:
1136
1144
  return True
1137
1145
  self._cancel_handle(handle)
@@ -1143,6 +1151,28 @@ class AgentPool:
1143
1151
  handle.task.cancel()
1144
1152
  return True
1145
1153
 
1154
+ async def _mark_closed(self, handle: _ChildHandle) -> None:
1155
+ """Write ``closed`` onto the child's row; best-effort like settling.
1156
+
1157
+ A pool without a registry (tests, hosts without storage) keeps its
1158
+ previous behaviour, and a storage failure must not turn a close into
1159
+ an error — the in-process refusal still holds for this turn.
1160
+ """
1161
+ if self._registry is None or self._parent_record_id is None:
1162
+ return
1163
+ record_id = default_record_id(self._parent_record_id, handle.child_id)
1164
+ try:
1165
+ wrote = await self._registry.finished(
1166
+ record_id,
1167
+ status="closed",
1168
+ usage=handle.usage,
1169
+ usage_known=handle.usage_known,
1170
+ )
1171
+ if wrote:
1172
+ self._registry.mark_settled(record_id)
1173
+ except Exception as exc: # noqa: BLE001 — bookkeeping never fails a run
1174
+ logger.warning("child %s registry close failed: %s", handle.child_id, exc)
1175
+
1146
1176
  def _cancel_handle(self, handle: _ChildHandle) -> None:
1147
1177
  """Ask one child to stop, whichever engine it runs on.
1148
1178
 
@@ -1158,12 +1188,16 @@ class AgentPool:
1158
1188
  async def shutdown(self) -> None:
1159
1189
  """Cooperatively cancel every live child; hard-cancel stragglers.
1160
1190
 
1161
- Terminal for the whole pool: every child is marked closed, so no
1162
- sends or resumes are accepted afterwards.
1191
+ Terminal for the whole **pool**, not for its children: a child that
1192
+ was still running when the turn ended stays resumable, so its row is
1193
+ ``cancelled`` (the run was cut short), not ``closed`` (the user gave
1194
+ up on it). ``close`` is the one that writes ``closed``, because that
1195
+ is the only path where "never again" was actually asked for.
1163
1196
  """
1164
1197
  live = [h for h in self._children.values() if h.outcome is None]
1165
1198
  for handle in self._children.values():
1166
1199
  handle.closed = True
1200
+ handle.pool_gone = True
1167
1201
  self._leave_tree(handle.child_id)
1168
1202
  for handle in live:
1169
1203
  self._cancel_handle(handle)
@@ -0,0 +1,82 @@
1
+ """Per-agent token accounting for a delegating turn tree.
2
+
3
+ The question this answers is "what did this turn cost, and which agent spent
4
+ it" — nothing more. There is no limit here and no way to add one: a turn that
5
+ runs long is a turn that had more work, and stopping it mid-task throws away
6
+ the work already paid for. A host that wants cost control puts the gate where
7
+ it belongs (before a turn starts, or on a period budget), not inside a task
8
+ that is already half done.
9
+
10
+ Scope is the whole tree, not one loop. ``steerable_agent_harness.budget``
11
+ accounts for a single run; once a turn delegates, a parent plus three children
12
+ would each report their own slice and no single number would describe the
13
+ turn. One counter shared by every member gives the host that number, and the
14
+ per-agent breakdown says which member spent it.
15
+
16
+ Why an object rather than a dict the host already has: the loop hands usage in
17
+ from both the parent's event loop and the worker thread that drives the native
18
+ engine, so plain attribute updates would race.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import threading
24
+ from dataclasses import dataclass, field
25
+
26
+ from .llm import LLMUsage
27
+
28
+ __all__ = ["TreeSpend", "TreeSpendReport"]
29
+
30
+
31
+ @dataclass(frozen=True, slots=True)
32
+ class TreeSpendReport:
33
+ """The tree's spend at one point in time.
34
+
35
+ ``by_agent`` keys are the caller's own agent labels (``"parent"``,
36
+ ``"0.1"`` …) — this class does not know about lineage and must not guess
37
+ it, so it stores whatever key the caller passes.
38
+ """
39
+
40
+ spent: int
41
+ by_agent: dict[str, int]
42
+
43
+
44
+ @dataclass
45
+ class TreeSpend:
46
+ """Token accounting shared by every agent in one turn tree."""
47
+
48
+ _spent: int = field(default=0, init=False)
49
+ _by_agent: dict[str, int] = field(default_factory=dict, init=False)
50
+ _lock: threading.Lock = field(default_factory=threading.Lock, init=False)
51
+
52
+ def record(self, usage: LLMUsage | None, *, agent: str) -> int:
53
+ """Add one run's usage; returns the tree's spend afterwards.
54
+
55
+ ``usage=None`` adds nothing but still names the agent, so a host can
56
+ tell "this child ran and reported nothing" (an external engine that
57
+ bills nothing we can see) apart from "this child never ran". The
58
+ distinction is what keeps a partial total from reading as complete.
59
+ """
60
+ if usage is None:
61
+ with self._lock:
62
+ self._by_agent.setdefault(agent, 0)
63
+ return self._spent
64
+ # Total, not prompt+completion: providers disagree about whether the
65
+ # total includes cache reads, and ``usage.total_tokens`` is the one
66
+ # number every provider reports consistently.
67
+ billed = max(usage.total_tokens, 0)
68
+ with self._lock:
69
+ self._spent += billed
70
+ self._by_agent[agent] = self._by_agent.get(agent, 0) + billed
71
+ return self._spent
72
+
73
+ @property
74
+ def spent(self) -> int:
75
+ """Tokens spent by the whole tree so far."""
76
+ with self._lock:
77
+ return self._spent
78
+
79
+ def report(self) -> TreeSpendReport:
80
+ """A snapshot, safe to hand to a host mid-turn."""
81
+ with self._lock:
82
+ return TreeSpendReport(spent=self._spent, by_agent=dict(self._by_agent))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: steerable-agent-runtime
3
- Version: 0.11.1
3
+ Version: 0.12.1
4
4
  Summary: Steerable agent runtime: LLM, tool, storage, and transport adapters.
5
5
  License: Apache-2.0
6
6
  Requires-Python: >=3.10
@@ -64,14 +64,18 @@ release. Nothing in the single-agent path changed.
64
64
  `CREATE TABLE IF NOT EXISTS`, so an existing database upgrades in place on
65
65
  first open — no migration function, no data rewrite. A database written by a
66
66
  newer build still refuses to open.
67
- - **`budgetTokens` now bounds the whole turn tree.** It used to limit each
68
- loop separately; a parent plus three children could each spend the full
69
- allowance. Every agent in the tree now debits one counter, and the first to
70
- cross it fails there. A host that relied on per-child allowances gets a
71
- tighter (correct) limit.
72
- - **New `TreeBudget` / `SessionBudgetExceeded`** in `steerable_agent_runtime`.
73
- `AgentPool(budget=...)` shares one counter across the pool; the parent loop's
74
- usage is charged to the same counter by the host.
67
+ - **`budgetTokens` no longer bounds the turn tree.** It still caps the parent
68
+ run's own loop (unchanged from before the tree layer), but there is no longer
69
+ a shared tree limit: `TreeBudget` and `SessionBudgetExceeded` are gone,
70
+ replaced by `TreeSpend`, which only records.
71
+ - Why removed: a tree limit stopped a task partway through, leaving children
72
+ at `budget_exhausted` and needing a human to click resume. A turn that runs
73
+ long had more work, not a failure. Cost control belongs before a turn
74
+ starts (or on a period budget), not inside one already half done.
75
+ - What replaced it: `TreeSpend` — `record(usage, agent=...)` plus
76
+ `report() -> {spent, by_agent}` — so a host can still show what a turn cost
77
+ and which agent spent it. `AgentPool(spend=...)` shares one counter across
78
+ the pool; the parent's usage is recorded into the same counter by the host.
75
79
  - **`provider_factory` for sub-agent profiles now takes `(model, effort)`**
76
80
  instead of `(model)`. `None` for either knob means "inherit the parent's",
77
81
  never "clear it". A profile pinning neither does not rebuild the provider at
@@ -6,7 +6,6 @@ src/steerable_agent_runtime/approval.py
6
6
  src/steerable_agent_runtime/approval_policy.py
7
7
  src/steerable_agent_runtime/ask_user.py
8
8
  src/steerable_agent_runtime/branch.py
9
- src/steerable_agent_runtime/budget.py
10
9
  src/steerable_agent_runtime/cache_control.py
11
10
  src/steerable_agent_runtime/calibration.py
12
11
  src/steerable_agent_runtime/child_notice.py
@@ -49,6 +48,7 @@ src/steerable_agent_runtime/resume.py
49
48
  src/steerable_agent_runtime/retry.py
50
49
  src/steerable_agent_runtime/sandboxed.py
51
50
  src/steerable_agent_runtime/skills.py
51
+ src/steerable_agent_runtime/spend.py
52
52
  src/steerable_agent_runtime/spill.py
53
53
  src/steerable_agent_runtime/subagent.py
54
54
  src/steerable_agent_runtime/team_board.py
@@ -182,8 +182,8 @@ tests/test_transport_error_detail.py
182
182
  tests/test_transport_jsonrpc.py
183
183
  tests/test_transport_sse.py
184
184
  tests/test_tree.py
185
- tests/test_tree_budget.py
186
- tests/test_tree_budget_pool.py
185
+ tests/test_tree_spend.py
186
+ tests/test_tree_spend_pool.py
187
187
  tests/test_usage_attribution.py
188
188
  tests/test_world_state.py
189
189
  tests/test_write_lease.py
@@ -15,6 +15,7 @@ from typing import Any
15
15
 
16
16
  import pytest
17
17
  from steerable_agent_runtime import (
18
+ ChildRegistry,
18
19
  CoreLoop,
19
20
  LoopConfig,
20
21
  RouterToolExecutor,
@@ -22,11 +23,13 @@ from steerable_agent_runtime import (
22
23
  )
23
24
  from steerable_agent_runtime.llm import LLMMessage, LLMStreamChunk
24
25
  from steerable_agent_runtime.orchestration import (
26
+ AgentPool,
25
27
  ChildOutcome,
26
28
  OrchestrationConfig,
27
29
  OrchestrationExecutor,
28
30
  orchestration_tool_descriptors,
29
31
  )
32
+ from steerable_agent_runtime.storage import InMemoryStorage
30
33
  from test_loop import collect, final_completion
31
34
 
32
35
 
@@ -1100,6 +1103,57 @@ async def test_send_to_closed_child_fails_with_child_closed() -> None:
1100
1103
  assert _payload(listing)["children"][0]["status"] == "closed"
1101
1104
 
1102
1105
 
1106
+ @pytest.mark.asyncio
1107
+ async def test_a_later_turn_cannot_resume_a_child_closed_by_an_earlier_one() -> None:
1108
+ """Close has to survive the pool that took it.
1109
+
1110
+ The same-turn case above is caught by the handle's own flag. A later turn
1111
+ builds a fresh pool with no handle at all, so the only thing standing
1112
+ between `agent_send` and a closed child is the row — and the row used to
1113
+ keep the status of its last run, which made an explicitly closed child
1114
+ look merely finished. Observed: `delivery: "resumed"` after `agent_close`.
1115
+ """
1116
+ store = InMemoryStorage()
1117
+ registry = ChildRegistry(store)
1118
+
1119
+ def loop_factory(child_id: str, tool_filter: frozenset[str] | None):
1120
+ provider, _ = _content_provider({"child task": [{"content": "child answer"}]})
1121
+ return (
1122
+ CoreLoop(provider, RouterToolExecutor(ToolRouter()), LoopConfig()),
1123
+ [],
1124
+ )
1125
+
1126
+ def pool() -> AgentPool:
1127
+ return AgentPool(
1128
+ config=OrchestrationConfig(),
1129
+ depth=0,
1130
+ lineage="0",
1131
+ loop_factory=loop_factory,
1132
+ registry=registry,
1133
+ parent_record_id="chat/p",
1134
+ )
1135
+
1136
+ # Turn one: spawn, let it finish, then close it.
1137
+ first = pool()
1138
+ first.spawn("child task", None)
1139
+ await first.wait("0.1", 5)
1140
+ await first.close("0.1")
1141
+ await first.shutdown()
1142
+
1143
+ row = await store.get_child("chat/p:child:0.1")
1144
+ assert row is not None
1145
+ assert row.status == "closed"
1146
+
1147
+ # Turn two: a new pool, no handle for 0.1. Resolving it can only consult
1148
+ # the row, which is exactly the path that used to resume a closed child.
1149
+ second = pool()
1150
+ view = await registry.find_child("chat/p", "0.1")
1151
+ await second.shutdown()
1152
+ assert view is not None
1153
+ assert view.record.status == "closed"
1154
+ assert view.resumable is False
1155
+
1156
+
1103
1157
  @pytest.mark.asyncio
1104
1158
  async def test_resume_respects_the_parallel_cap() -> None:
1105
1159
  started = asyncio.Event()
@@ -266,3 +266,77 @@ def _spawn_of(child_id: str):
266
266
  profile="explore",
267
267
  engine="coreloop",
268
268
  )
269
+
270
+
271
+ # ---------------------------------------------------------------------------
272
+ # close is durable, not just in-process
273
+ # ---------------------------------------------------------------------------
274
+
275
+
276
+ @pytest.mark.asyncio
277
+ async def test_close_writes_closed_onto_the_row() -> None:
278
+ """Closing has to reach disk, or a later turn resumes a closed child.
279
+
280
+ The in-memory ``closed`` flag lives on the handle, and the handle dies
281
+ with the pool. `agent_send` decides whether a child is resumable by
282
+ reading its **row**, so a close that only touched the handle left a
283
+ closed child looking merely finished — and the observed behaviour was
284
+ `delivery: "resumed"` after an explicit `agent_close`.
285
+ """
286
+ store = InMemoryStorage()
287
+ registry = ChildRegistry(store)
288
+ pool = _pool(registry=registry, provider=_ScriptedProvider())
289
+
290
+ pool.spawn("look this up", None)
291
+ await pool.wait("0.1", 5)
292
+ assert (await store.get_child("chat/p:child:0.1")).status == "completed"
293
+
294
+ await pool.close("0.1")
295
+
296
+ assert (await store.get_child("chat/p:child:0.1")).status == "closed"
297
+ await pool.shutdown()
298
+
299
+
300
+ @pytest.mark.asyncio
301
+ async def test_closing_a_running_child_does_not_settle_it_as_cancelled() -> None:
302
+ """Close cancels the run, and that cancel must not overwrite the row.
303
+
304
+ Cancelling to close produces ``cancelled`` from the loop. Writing that
305
+ back would leave the row resumable again — the exact state close is
306
+ supposed to end.
307
+ """
308
+ gate = asyncio.Event()
309
+ store = InMemoryStorage()
310
+ registry = ChildRegistry(store)
311
+ pool = _pool(registry=registry, provider=_ScriptedProvider(gate=gate))
312
+
313
+ pool.spawn("still running", None)
314
+ await asyncio.sleep(0.05)
315
+
316
+ await pool.close("0.1")
317
+
318
+ row = await store.get_child("chat/p:child:0.1")
319
+ assert row is not None
320
+ assert row.status == "closed"
321
+ gate.set()
322
+ await pool.shutdown()
323
+
324
+
325
+ @pytest.mark.asyncio
326
+ async def test_a_closed_row_is_not_resumable() -> None:
327
+ """The point of the durable ``closed``: the resume path reads it."""
328
+ store = InMemoryStorage()
329
+ registry = ChildRegistry(store)
330
+ pool = _pool(registry=registry, provider=_ScriptedProvider())
331
+
332
+ pool.spawn("one run", None)
333
+ await pool.wait("0.1", 5)
334
+ await pool.close("0.1")
335
+ await pool.shutdown()
336
+
337
+ # A fresh pool is what a later turn builds; it has no handle for 0.1, so
338
+ # only the row can say the child is finished for good.
339
+ view = await registry.find_child("chat/p", "0.1")
340
+ assert view is not None
341
+ assert view.record.status == "closed"
342
+ assert view.resumable is False