apodex-agent-core 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. apodex_agent_core-0.3.0/.github/workflows/ci.yml +40 -0
  2. apodex_agent_core-0.3.0/.github/workflows/release.yml +121 -0
  3. apodex_agent_core-0.3.0/.gitignore +10 -0
  4. apodex_agent_core-0.3.0/CHANGELOG.md +132 -0
  5. apodex_agent_core-0.3.0/LICENSE +201 -0
  6. apodex_agent_core-0.3.0/PKG-INFO +267 -0
  7. apodex_agent_core-0.3.0/README.md +230 -0
  8. apodex_agent_core-0.3.0/agent_core/__init__.py +32 -0
  9. apodex_agent_core-0.3.0/agent_core/components/__init__.py +1 -0
  10. apodex_agent_core-0.3.0/agent_core/components/agent_bus/__init__.py +107 -0
  11. apodex_agent_core-0.3.0/agent_core/components/agent_bus/agent_comm.py +278 -0
  12. apodex_agent_core-0.3.0/agent_core/components/agent_bus/bus.py +2407 -0
  13. apodex_agent_core-0.3.0/agent_core/components/agent_bus/fan_in.py +436 -0
  14. apodex_agent_core-0.3.0/agent_core/components/agent_bus/models.py +246 -0
  15. apodex_agent_core-0.3.0/agent_core/components/agent_bus/runtime.py +501 -0
  16. apodex_agent_core-0.3.0/agent_core/components/agent_bus/shared_pool.py +43 -0
  17. apodex_agent_core-0.3.0/agent_core/components/agent_bus/spawn_guard.py +341 -0
  18. apodex_agent_core-0.3.0/agent_core/components/agent_bus/stop_signal.py +78 -0
  19. apodex_agent_core-0.3.0/agent_core/components/finalization/__init__.py +53 -0
  20. apodex_agent_core-0.3.0/agent_core/components/finalization/budget.py +267 -0
  21. apodex_agent_core-0.3.0/agent_core/components/finalization/recovery.py +308 -0
  22. apodex_agent_core-0.3.0/agent_core/components/middleware/__init__.py +1 -0
  23. apodex_agent_core-0.3.0/agent_core/components/middleware/llm/__init__.py +1 -0
  24. apodex_agent_core-0.3.0/agent_core/components/middleware/llm/base.py +233 -0
  25. apodex_agent_core-0.3.0/agent_core/components/middleware/llm/proxy.py +276 -0
  26. apodex_agent_core-0.3.0/agent_core/components/middleware/llm/skill_injection.py +232 -0
  27. apodex_agent_core-0.3.0/agent_core/components/middleware/llm/stream_repetition.py +160 -0
  28. apodex_agent_core-0.3.0/agent_core/components/middleware/llm/summarization.py +203 -0
  29. apodex_agent_core-0.3.0/agent_core/components/observers/__init__.py +1 -0
  30. apodex_agent_core-0.3.0/agent_core/components/observers/budget_observer.py +75 -0
  31. apodex_agent_core-0.3.0/agent_core/components/observers/context_size_guard.py +103 -0
  32. apodex_agent_core-0.3.0/agent_core/components/observers/finalization_reserve.py +57 -0
  33. apodex_agent_core-0.3.0/agent_core/components/observers/last_turn_forcer.py +40 -0
  34. apodex_agent_core-0.3.0/agent_core/components/observers/leaked_tool_call_retry.py +289 -0
  35. apodex_agent_core-0.3.0/agent_core/components/observers/react_step_tracker.py +166 -0
  36. apodex_agent_core-0.3.0/agent_core/components/observers/repetition_guard.py +175 -0
  37. apodex_agent_core-0.3.0/agent_core/components/observers/sse_observer.py +170 -0
  38. apodex_agent_core-0.3.0/agent_core/components/observers/stop_signal_observer.py +70 -0
  39. apodex_agent_core-0.3.0/agent_core/components/observers/stuck_target_guard.py +499 -0
  40. apodex_agent_core-0.3.0/agent_core/components/observers/task_board.py +52 -0
  41. apodex_agent_core-0.3.0/agent_core/components/observers/text_repetition_guard.py +184 -0
  42. apodex_agent_core-0.3.0/agent_core/components/observers/trajectory.py +650 -0
  43. apodex_agent_core-0.3.0/agent_core/components/observers/wall_clock_guard.py +86 -0
  44. apodex_agent_core-0.3.0/agent_core/components/observers/wall_clock_observer.py +161 -0
  45. apodex_agent_core-0.3.0/agent_core/components/skills/__init__.py +13 -0
  46. apodex_agent_core-0.3.0/agent_core/components/skills/allowlist_loader.py +55 -0
  47. apodex_agent_core-0.3.0/agent_core/components/skills/config.py +49 -0
  48. apodex_agent_core-0.3.0/agent_core/components/skills/extensions_config.py +134 -0
  49. apodex_agent_core-0.3.0/agent_core/components/skills/file_system_loader.py +241 -0
  50. apodex_agent_core-0.3.0/agent_core/context/__init__.py +16 -0
  51. apodex_agent_core-0.3.0/agent_core/context/blob_store.py +63 -0
  52. apodex_agent_core-0.3.0/agent_core/context/manager.py +81 -0
  53. apodex_agent_core-0.3.0/agent_core/context/models.py +54 -0
  54. apodex_agent_core-0.3.0/agent_core/context/notes.py +44 -0
  55. apodex_agent_core-0.3.0/agent_core/context/projection.py +44 -0
  56. apodex_agent_core-0.3.0/agent_core/context/protocols.py +40 -0
  57. apodex_agent_core-0.3.0/agent_core/context/sqlite_store.py +209 -0
  58. apodex_agent_core-0.3.0/agent_core/errors.py +164 -0
  59. apodex_agent_core-0.3.0/agent_core/events.py +24 -0
  60. apodex_agent_core-0.3.0/agent_core/execution_context.py +171 -0
  61. apodex_agent_core-0.3.0/agent_core/llm.py +107 -0
  62. apodex_agent_core-0.3.0/agent_core/llm_utils.py +27 -0
  63. apodex_agent_core-0.3.0/agent_core/loop_types.py +709 -0
  64. apodex_agent_core-0.3.0/agent_core/messages.py +267 -0
  65. apodex_agent_core-0.3.0/agent_core/models/__init__.py +1 -0
  66. apodex_agent_core-0.3.0/agent_core/models/agent_definition.py +51 -0
  67. apodex_agent_core-0.3.0/agent_core/models/agent_message.py +27 -0
  68. apodex_agent_core-0.3.0/agent_core/models/event.py +238 -0
  69. apodex_agent_core-0.3.0/agent_core/models/node_context.py +82 -0
  70. apodex_agent_core-0.3.0/agent_core/models/pipeline_spec.py +253 -0
  71. apodex_agent_core-0.3.0/agent_core/models/task.py +57 -0
  72. apodex_agent_core-0.3.0/agent_core/models/task_budget.py +133 -0
  73. apodex_agent_core-0.3.0/agent_core/protocols.py +230 -0
  74. apodex_agent_core-0.3.0/agent_core/providers/__init__.py +80 -0
  75. apodex_agent_core-0.3.0/agent_core/providers/anthropic.py +724 -0
  76. apodex_agent_core-0.3.0/agent_core/providers/aux_builder.py +202 -0
  77. apodex_agent_core-0.3.0/agent_core/providers/fallback.py +794 -0
  78. apodex_agent_core-0.3.0/agent_core/providers/finish_reason.py +65 -0
  79. apodex_agent_core-0.3.0/agent_core/providers/nonblocking_stream.py +160 -0
  80. apodex_agent_core-0.3.0/agent_core/providers/openai_chat.py +562 -0
  81. apodex_agent_core-0.3.0/agent_core/providers/openai_responses.py +439 -0
  82. apodex_agent_core-0.3.0/agent_core/providers/prompt_cache.py +189 -0
  83. apodex_agent_core-0.3.0/agent_core/providers/protocol_client.py +261 -0
  84. apodex_agent_core-0.3.0/agent_core/providers/summary.py +262 -0
  85. apodex_agent_core-0.3.0/agent_core/py.typed +0 -0
  86. apodex_agent_core-0.3.0/agent_core/retry_policy.py +29 -0
  87. apodex_agent_core-0.3.0/agent_core/runtime/__init__.py +40 -0
  88. apodex_agent_core-0.3.0/agent_core/runtime/dag/__init__.py +14 -0
  89. apodex_agent_core-0.3.0/agent_core/runtime/dag/base_state.py +33 -0
  90. apodex_agent_core-0.3.0/agent_core/runtime/dag/graph_builder.py +543 -0
  91. apodex_agent_core-0.3.0/agent_core/runtime/dag/minidag.py +328 -0
  92. apodex_agent_core-0.3.0/agent_core/runtime/env.py +35 -0
  93. apodex_agent_core-0.3.0/agent_core/runtime/events.py +98 -0
  94. apodex_agent_core-0.3.0/agent_core/runtime/llm_request_overrides.py +68 -0
  95. apodex_agent_core-0.3.0/agent_core/runtime/loop/__init__.py +126 -0
  96. apodex_agent_core-0.3.0/agent_core/runtime/loop/_bind.py +201 -0
  97. apodex_agent_core-0.3.0/agent_core/runtime/loop/_call.py +1192 -0
  98. apodex_agent_core-0.3.0/agent_core/runtime/loop/_response.py +468 -0
  99. apodex_agent_core-0.3.0/agent_core/runtime/loop/_runaway.py +358 -0
  100. apodex_agent_core-0.3.0/agent_core/runtime/loop/_streaming.py +584 -0
  101. apodex_agent_core-0.3.0/agent_core/runtime/loop/agent_loop.py +1381 -0
  102. apodex_agent_core-0.3.0/agent_core/runtime/loop/budget_consistency.py +128 -0
  103. apodex_agent_core-0.3.0/agent_core/runtime/loop/compact.py +506 -0
  104. apodex_agent_core-0.3.0/agent_core/runtime/loop/compact_llm.py +616 -0
  105. apodex_agent_core-0.3.0/agent_core/runtime/loop/context_budget.py +113 -0
  106. apodex_agent_core-0.3.0/agent_core/runtime/loop/guardrails.py +221 -0
  107. apodex_agent_core-0.3.0/agent_core/runtime/loop/llm_client.py +69 -0
  108. apodex_agent_core-0.3.0/agent_core/runtime/loop/message_trimmer.py +173 -0
  109. apodex_agent_core-0.3.0/agent_core/runtime/loop/model_profile.py +672 -0
  110. apodex_agent_core-0.3.0/agent_core/runtime/loop/summary_prompt.py +300 -0
  111. apodex_agent_core-0.3.0/agent_core/runtime/loop/tiered_compact.py +626 -0
  112. apodex_agent_core-0.3.0/agent_core/runtime/loop/tokenizer.py +81 -0
  113. apodex_agent_core-0.3.0/agent_core/runtime/loop/tool_call_parser.py +726 -0
  114. apodex_agent_core-0.3.0/agent_core/runtime/loop/tool_call_recovery.py +107 -0
  115. apodex_agent_core-0.3.0/agent_core/runtime/loop/tool_call_repair.py +204 -0
  116. apodex_agent_core-0.3.0/agent_core/runtime/loop/tool_exec.py +390 -0
  117. apodex_agent_core-0.3.0/agent_core/runtime/pause_check.py +87 -0
  118. apodex_agent_core-0.3.0/agent_core/runtime/registries/__init__.py +7 -0
  119. apodex_agent_core-0.3.0/agent_core/runtime/registries/agents.py +66 -0
  120. apodex_agent_core-0.3.0/agent_core/runtime/registries/scope.py +119 -0
  121. apodex_agent_core-0.3.0/agent_core/runtime/registries/services.py +155 -0
  122. apodex_agent_core-0.3.0/agent_core/runtime/registries/workflows.py +96 -0
  123. apodex_agent_core-0.3.0/agent_core/runtime/resources/__init__.py +22 -0
  124. apodex_agent_core-0.3.0/agent_core/runtime/resources/llm.py +54 -0
  125. apodex_agent_core-0.3.0/agent_core/runtime/resources/manager.py +188 -0
  126. apodex_agent_core-0.3.0/agent_core/runtime/resources/permissions.py +45 -0
  127. apodex_agent_core-0.3.0/agent_core/runtime/retriable.py +553 -0
  128. apodex_agent_core-0.3.0/agent_core/runtime/session_history.py +365 -0
  129. apodex_agent_core-0.3.0/agent_core/runtime/spill.py +452 -0
  130. apodex_agent_core-0.3.0/agent_core/runtime/tool_permission.py +151 -0
  131. apodex_agent_core-0.3.0/agent_core/runtime/usage_meter.py +213 -0
  132. apodex_agent_core-0.3.0/agent_core/runtime/wall_time_lease.py +243 -0
  133. apodex_agent_core-0.3.0/agent_core/scheduling/__init__.py +27 -0
  134. apodex_agent_core-0.3.0/agent_core/scheduling/pipeline_registry.py +32 -0
  135. apodex_agent_core-0.3.0/agent_core/scheduling/scheduler.py +580 -0
  136. apodex_agent_core-0.3.0/agent_core/scheduling/topology_registry.py +57 -0
  137. apodex_agent_core-0.3.0/agent_core/scheduling/workflow_defaults.py +51 -0
  138. apodex_agent_core-0.3.0/agent_core/tokens.py +87 -0
  139. apodex_agent_core-0.3.0/agent_core/tool.py +297 -0
  140. apodex_agent_core-0.3.0/agent_core/types.py +63 -0
  141. apodex_agent_core-0.3.0/agent_core/utils/__init__.py +1 -0
  142. apodex_agent_core-0.3.0/agent_core/utils/language.py +347 -0
  143. apodex_agent_core-0.3.0/docs/agent-bus-boundary.md +69 -0
  144. apodex_agent_core-0.3.0/docs/agent-loop-boundary.md +41 -0
  145. apodex_agent_core-0.3.0/docs/context-management-boundary.md +45 -0
  146. apodex_agent_core-0.3.0/docs/downstream-bump.md +137 -0
  147. apodex_agent_core-0.3.0/docs/durable-context-boundary.md +27 -0
  148. apodex_agent_core-0.3.0/docs/llm-runtime-boundary.md +74 -0
  149. apodex_agent_core-0.3.0/docs/provider-substrate-boundary.md +69 -0
  150. apodex_agent_core-0.3.0/docs/versioning.md +147 -0
  151. apodex_agent_core-0.3.0/pyproject.toml +92 -0
  152. apodex_agent_core-0.3.0/release-notes.md +55 -0
  153. apodex_agent_core-0.3.0/scripts/changelog_section.py +62 -0
  154. apodex_agent_core-0.3.0/scripts/check_version_bump.py +111 -0
  155. apodex_agent_core-0.3.0/scripts/version.py +55 -0
  156. apodex_agent_core-0.3.0/tests/test_agent_bus_event_sink_injection.py +122 -0
  157. apodex_agent_core-0.3.0/tests/test_agent_bus_host_loop_seams.py +175 -0
  158. apodex_agent_core-0.3.0/tests/test_agent_bus_result_recovery_contract.py +96 -0
  159. apodex_agent_core-0.3.0/tests/test_agent_bus_session_dispatch_handoff.py +177 -0
  160. apodex_agent_core-0.3.0/tests/test_agent_bus_session_invariant.py +418 -0
  161. apodex_agent_core-0.3.0/tests/test_agent_bus_session_queue.py +414 -0
  162. apodex_agent_core-0.3.0/tests/test_agent_bus_spawn_reservation.py +236 -0
  163. apodex_agent_core-0.3.0/tests/test_agent_bus_waiting.py +265 -0
  164. apodex_agent_core-0.3.0/tests/test_agent_comm_store_contract.py +371 -0
  165. apodex_agent_core-0.3.0/tests/test_agent_loop_engine.py +678 -0
  166. apodex_agent_core-0.3.0/tests/test_aux_builder.py +137 -0
  167. apodex_agent_core-0.3.0/tests/test_budget_observer.py +170 -0
  168. apodex_agent_core-0.3.0/tests/test_compact.py +255 -0
  169. apodex_agent_core-0.3.0/tests/test_compact_llm.py +284 -0
  170. apodex_agent_core-0.3.0/tests/test_context_budget.py +113 -0
  171. apodex_agent_core-0.3.0/tests/test_context_management_phase2.py +285 -0
  172. apodex_agent_core-0.3.0/tests/test_cooldown_fallback.py +576 -0
  173. apodex_agent_core-0.3.0/tests/test_durable_context.py +73 -0
  174. apodex_agent_core-0.3.0/tests/test_finalization_budget.py +308 -0
  175. apodex_agent_core-0.3.0/tests/test_finalization_reserve.py +66 -0
  176. apodex_agent_core-0.3.0/tests/test_finish_reason_normalization.py +126 -0
  177. apodex_agent_core-0.3.0/tests/test_graph_builder_node_contract.py +269 -0
  178. apodex_agent_core-0.3.0/tests/test_graph_builder_shared.py +177 -0
  179. apodex_agent_core-0.3.0/tests/test_language_validation.py +68 -0
  180. apodex_agent_core-0.3.0/tests/test_leaked_tool_call_landing_turn.py +118 -0
  181. apodex_agent_core-0.3.0/tests/test_llm.py +60 -0
  182. apodex_agent_core-0.3.0/tests/test_llm_proxy_stream_lifecycle.py +196 -0
  183. apodex_agent_core-0.3.0/tests/test_llm_runtime_deadline_reason.py +299 -0
  184. apodex_agent_core-0.3.0/tests/test_llm_runtime_extract_usage.py +676 -0
  185. apodex_agent_core-0.3.0/tests/test_llm_runtime_hooks.py +85 -0
  186. apodex_agent_core-0.3.0/tests/test_llm_runtime_nameless_tool_calls.py +117 -0
  187. apodex_agent_core-0.3.0/tests/test_llm_runtime_proxy_wrap.py +205 -0
  188. apodex_agent_core-0.3.0/tests/test_llm_runtime_retry_after.py +193 -0
  189. apodex_agent_core-0.3.0/tests/test_llm_runtime_stall.py +323 -0
  190. apodex_agent_core-0.3.0/tests/test_llm_runtime_stream_metadata.py +387 -0
  191. apodex_agent_core-0.3.0/tests/test_llm_runtime_strip_thinking.py +65 -0
  192. apodex_agent_core-0.3.0/tests/test_loop_types.py +372 -0
  193. apodex_agent_core-0.3.0/tests/test_message_trimmer.py +61 -0
  194. apodex_agent_core-0.3.0/tests/test_messages.py +63 -0
  195. apodex_agent_core-0.3.0/tests/test_model_profile_native.py +215 -0
  196. apodex_agent_core-0.3.0/tests/test_model_registry_loading.py +103 -0
  197. apodex_agent_core-0.3.0/tests/test_multi_format_tool_call_parser.py +299 -0
  198. apodex_agent_core-0.3.0/tests/test_pause_check_status_shapes.py +98 -0
  199. apodex_agent_core-0.3.0/tests/test_portable_components.py +73 -0
  200. apodex_agent_core-0.3.0/tests/test_portable_minidag.py +376 -0
  201. apodex_agent_core-0.3.0/tests/test_provider_fallback.py +406 -0
  202. apodex_agent_core-0.3.0/tests/test_provider_native_clients.py +1122 -0
  203. apodex_agent_core-0.3.0/tests/test_provider_prompt_cache.py +182 -0
  204. apodex_agent_core-0.3.0/tests/test_provider_protocol_reasoning.py +529 -0
  205. apodex_agent_core-0.3.0/tests/test_react_step_tracker_shared.py +263 -0
  206. apodex_agent_core-0.3.0/tests/test_release_automation.py +165 -0
  207. apodex_agent_core-0.3.0/tests/test_repetition_guard_shared.py +152 -0
  208. apodex_agent_core-0.3.0/tests/test_resource_manager.py +240 -0
  209. apodex_agent_core-0.3.0/tests/test_retriable.py +599 -0
  210. apodex_agent_core-0.3.0/tests/test_runtime_foundation.py +299 -0
  211. apodex_agent_core-0.3.0/tests/test_scheduler.py +195 -0
  212. apodex_agent_core-0.3.0/tests/test_service_scope.py +252 -0
  213. apodex_agent_core-0.3.0/tests/test_session_affinity_per_call.py +78 -0
  214. apodex_agent_core-0.3.0/tests/test_session_history.py +248 -0
  215. apodex_agent_core-0.3.0/tests/test_skills_loader.py +354 -0
  216. apodex_agent_core-0.3.0/tests/test_skills_loader_reload.py +154 -0
  217. apodex_agent_core-0.3.0/tests/test_spawn_guard.py +437 -0
  218. apodex_agent_core-0.3.0/tests/test_spill.py +197 -0
  219. apodex_agent_core-0.3.0/tests/test_sse_observer_shared.py +292 -0
  220. apodex_agent_core-0.3.0/tests/test_stop_signal.py +117 -0
  221. apodex_agent_core-0.3.0/tests/test_stream_block_text_preservation.py +82 -0
  222. apodex_agent_core-0.3.0/tests/test_stream_repetition.py +333 -0
  223. apodex_agent_core-0.3.0/tests/test_stuck_target_guard_shared.py +535 -0
  224. apodex_agent_core-0.3.0/tests/test_summarization_orphan_tool.py +122 -0
  225. apodex_agent_core-0.3.0/tests/test_summary_engine.py +213 -0
  226. apodex_agent_core-0.3.0/tests/test_summary_retry_budget.py +290 -0
  227. apodex_agent_core-0.3.0/tests/test_thinking_history_policy.py +246 -0
  228. apodex_agent_core-0.3.0/tests/test_tiered_compact.py +176 -0
  229. apodex_agent_core-0.3.0/tests/test_tool_call_parser_generic.py +228 -0
  230. apodex_agent_core-0.3.0/tests/test_tool_call_parser_mixed_native.py +93 -0
  231. apodex_agent_core-0.3.0/tests/test_tool_call_recovery.py +102 -0
  232. apodex_agent_core-0.3.0/tests/test_tool_exec.py +260 -0
  233. apodex_agent_core-0.3.0/tests/test_tool_guardrails.py +161 -0
  234. apodex_agent_core-0.3.0/tests/test_tool_schema_types.py +110 -0
  235. apodex_agent_core-0.3.0/tests/test_trajectory_coalescing.py +105 -0
  236. apodex_agent_core-0.3.0/tests/test_usage_meter.py +111 -0
  237. apodex_agent_core-0.3.0/tests/test_usage_token_accessors.py +62 -0
  238. apodex_agent_core-0.3.0/tests/test_wall_clock_guard_shared.py +162 -0
  239. apodex_agent_core-0.3.0/tests/test_wall_time_lease.py +301 -0
  240. apodex_agent_core-0.3.0/uv.lock +1058 -0
@@ -0,0 +1,40 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ types: [opened, synchronize, reopened, labeled, unlabeled]
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
15
+ - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
16
+ with:
17
+ python-version: "3.12"
18
+ - run: uv sync --frozen --extra dev
19
+ - run: uv run ruff check agent_core tests scripts
20
+ - run: uv run pyright agent_core
21
+ - run: uv run pytest -q
22
+ - run: uv build
23
+
24
+ # Two products pin an AgentCore revision. If published code changes without a
25
+ # version bump, both end up reporting the same version for different code and
26
+ # the installed dist-info stops identifying what is running. Enforce the bump
27
+ # at the pull request, where it is cheap to fix.
28
+ version-bump:
29
+ if: >-
30
+ github.event_name == 'pull_request' &&
31
+ !contains(github.event.pull_request.labels.*.name, 'skip-version-bump')
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
35
+ with:
36
+ # The check needs the merge base, which a shallow clone does not have.
37
+ fetch-depth: 0
38
+ - run: python3 scripts/check_version_bump.py --base "$BASE_SHA"
39
+ env:
40
+ BASE_SHA: ${{ github.event.pull_request.base.sha }}
@@ -0,0 +1,121 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: read
12
+ steps:
13
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
14
+ - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
15
+ with:
16
+ python-version: "3.12"
17
+
18
+ # Fail before building anything if the tag names a version the tree does
19
+ # not declare, or if the release has no changelog entry to publish.
20
+ - name: Verify tag matches declared version
21
+ run: python3 scripts/version.py --check-tag "$TAG"
22
+ env:
23
+ TAG: ${{ github.ref_name }}
24
+
25
+ - name: Extract release notes
26
+ run: |
27
+ set -euo pipefail
28
+ version="$(python3 scripts/version.py)"
29
+ python3 scripts/changelog_section.py "$version" > release-notes.md
30
+
31
+ # The tagged tree is re-verified rather than trusting main's CI run: a tag
32
+ # can point at a commit that never went through a pull request.
33
+ - run: uv sync --frozen --extra dev
34
+ - run: uv run ruff check agent_core tests scripts
35
+ - run: uv run pyright agent_core
36
+ - run: uv run pytest -q
37
+ - run: uv build
38
+
39
+ # A PyPI version number can never be reused, not even after deleting the
40
+ # release. Reject malformed metadata here rather than burning the version.
41
+ - name: Validate package metadata
42
+ run: uv run --with twine twine check dist/*
43
+
44
+ # The release contract requires the artifact to install and import in a
45
+ # clean environment. Checking it here matters more than usual because a
46
+ # PyPI version number cannot be reclaimed: a wheel that fails to import
47
+ # would burn the version rather than fail the release.
48
+ - name: Install and import the built wheel in a clean environment
49
+ run: |
50
+ set -euo pipefail
51
+ uv venv /tmp/wheel-smoke
52
+ uv pip install --python /tmp/wheel-smoke/bin/python dist/*.whl
53
+ /tmp/wheel-smoke/bin/python - <<'SMOKE'
54
+ import agent_core
55
+ from agent_core import user_msg
56
+
57
+ assert user_msg("hi") == {"role": "user", "content": "hi"}
58
+ print("imported", agent_core.__name__, "with", len(agent_core.__all__), "exports")
59
+ SMOKE
60
+
61
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
62
+ with:
63
+ name: release-artifacts
64
+ path: |
65
+ dist/
66
+ release-notes.md
67
+ if-no-files-found: error
68
+
69
+ # Separate job so `id-token: write` — which mints the OIDC identity PyPI
70
+ # trusts — is scoped to publishing alone and never exposed to the build or to
71
+ # any third-party action running beside it.
72
+ publish-pypi:
73
+ needs: build
74
+ runs-on: ubuntu-latest
75
+ environment: pypi
76
+ permissions:
77
+ id-token: write
78
+ steps:
79
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
80
+ with:
81
+ name: release-artifacts
82
+ path: release-artifacts/
83
+ # Trusted Publishing: no API token, no secret. PyPI verifies the OIDC
84
+ # claim naming this repository, this workflow file, and the environment
85
+ # above, then issues a short-lived upload token itself.
86
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
87
+ with:
88
+ packages-dir: release-artifacts/dist/
89
+
90
+ # Publish the GitHub Release last. A failed PyPI upload therefore cannot leave
91
+ # a GitHub Release claiming that a version was published when it was not.
92
+ publish-github:
93
+ needs: publish-pypi
94
+ runs-on: ubuntu-latest
95
+ permissions:
96
+ contents: write
97
+ steps:
98
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
99
+ with:
100
+ name: release-artifacts
101
+ path: release-artifacts/
102
+ # `gh release create` is not retry-safe after a partial API failure. Use
103
+ # an upsert so rerunning this job always converges on the same release.
104
+ - name: Publish GitHub Release
105
+ run: |
106
+ set -euo pipefail
107
+ if gh release view "$TAG" >/dev/null 2>&1; then
108
+ gh release edit "$TAG" \
109
+ --title "AgentCore ${TAG#v}" \
110
+ --notes-file release-artifacts/release-notes.md
111
+ gh release upload "$TAG" --clobber \
112
+ release-artifacts/dist/*.whl release-artifacts/dist/*.tar.gz
113
+ else
114
+ gh release create "$TAG" \
115
+ --title "AgentCore ${TAG#v}" \
116
+ --notes-file release-artifacts/release-notes.md \
117
+ release-artifacts/dist/*.whl release-artifacts/dist/*.tar.gz
118
+ fi
119
+ env:
120
+ TAG: ${{ github.ref_name }}
121
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,10 @@
1
+ /.venv/
2
+ /dist/
3
+ /build/
4
+ /.pytest_cache/
5
+ /.ruff_cache/
6
+ /.mypy_cache/
7
+ /.pyright/
8
+ __pycache__/
9
+ *.py[cod]
10
+ *.egg-info/
@@ -0,0 +1,132 @@
1
+ # Changelog
2
+
3
+ Notable changes to `apodex-agent-core`, newest first. This file is the contract
4
+ between AgentCore and its consumers: every release entry must say what a product
5
+ has to know before upgrading. The release workflow reads the matching section as
6
+ the GitHub Release body, so a release with no entry here fails.
7
+
8
+ Versioning follows [docs/versioning.md](docs/versioning.md).
9
+
10
+ ## [0.3.0] - 2026-09-03
11
+
12
+ First published release. AgentCore is now open source under Apache-2.0 and
13
+ distributed on PyPI as [`apodex-agent-core`](https://pypi.org/project/apodex-agent-core/).
14
+
15
+ ### Consumer action
16
+
17
+ Replace the Git dependency with the published package:
18
+
19
+ ```toml
20
+ dependencies = [
21
+ "apodex-agent-core==0.3.0", # was: apodex-agent-core @ git+ssh://…@<rev>
22
+ ]
23
+ ```
24
+
25
+ Then delete the credential plumbing this required — the AgentCore deploy key,
26
+ `AGENT_CORE_REPO_TOKEN`, and any `insteadOf` rewriting. Installing needs no
27
+ credential now, `docker build` included.
28
+
29
+ ### Changed
30
+
31
+ - **Distribution.** Releases publish to PyPI from the tagged tree using Trusted
32
+ Publishing (OIDC): no API token is stored anywhere, and `id-token: write` is
33
+ scoped to the publishing job alone. GitHub Releases still carry the wheel,
34
+ sdist, and changelog section.
35
+ - **Downstream bumps are Dependabot's job.** The `repository_dispatch` +
36
+ repin-script mechanism is deleted along with `.github/downstream/`. It existed
37
+ only because a private Git dependency could not be resolved without a
38
+ credential; a public PyPI package needs none, and Dependabot's `uv` ecosystem
39
+ updates `pyproject.toml` and `uv.lock` and opens a pull request that the
40
+ product's own CI validates. This also removes the need for an organization-level
41
+ GitHub App or a cross-repository PAT.
42
+ - Package metadata: SPDX `license = "Apache-2.0"` with `license-files` (PEP 639),
43
+ trove classifiers, and project URLs.
44
+ - `docs/versioning.md` records why publishing to PyPI reversed the earlier
45
+ decision to stay on Git pins — going public removed that trade's entire cost
46
+ side.
47
+
48
+ ### Added
49
+
50
+ - The release now runs `twine check` and installs the built wheel in a clean
51
+ environment to `import agent_core` before publishing. A PyPI version number
52
+ can never be reused, so a broken artifact must fail the release rather than
53
+ consume the number.
54
+ - `docs/downstream-bump.md`: PyPI publisher registration, the `pypi` environment,
55
+ the Dependabot config, and the one real limitation — a Dependabot pull request
56
+ runs CI as if from a fork, so `secrets.*` resolves against Dependabot secrets
57
+ rather than Actions secrets.
58
+
59
+ ### Fixed
60
+
61
+ - The version gate accepted a *decreasing* version: it compared for inequality
62
+ rather than an increase, so a pull request could move `0.2.0` back to `0.1.9`
63
+ and pass.
64
+ - The `skip-version-bump` label was inert. The default `pull_request` event types
65
+ exclude `labeled`, so applying the label did not re-run the check and the pull
66
+ request stayed red forever.
67
+
68
+ ## [0.2.0] - 2026-09-03
69
+
70
+ **Never published.** No tag was pushed and no artifact was distributed; the
71
+ version exists only in `main`'s history. Consumers went from Git revisions
72
+ straight to `0.3.0` on PyPI. The entry below is kept because it records when
73
+ version discipline was introduced.
74
+
75
+ First versioned release. Functionally this is the runtime that products have
76
+ already been consuming by commit SHA; what changes is that the revision now has
77
+ a name.
78
+
79
+ Why 0.2.0 and not 0.1.1: `0.1.0` was the bootstrap constant and was never
80
+ released or moved. Every commit from the initial foundation through the
81
+ cooldown-fallback observability work declared that same version, so `0.1.0`
82
+ identifies no particular code and is retired rather than reused.
83
+
84
+ ### Published surface
85
+
86
+ The importable surface is `agent_core.*` as scoped in the README, with per-area
87
+ contracts in `docs/*-boundary.md`: messages and token estimation, context
88
+ management and spill storage, LLM runtime (binding, streaming, retry
89
+ classification, runaway recovery), the agent loop and its typed product hooks,
90
+ durable run journals, MiniDAG and registries, middleware and observers, agent-bus
91
+ coordination, skills, and scheduling.
92
+
93
+ ### Consumer action
94
+
95
+ Repin from a commit SHA to the tag:
96
+
97
+ ```toml
98
+ dependencies = [
99
+ "apodex-agent-core @ git+ssh://git@github.com/ApodexAI/AgentCore.git@v0.2.0",
100
+ ]
101
+ ```
102
+
103
+ No source changes are required: the code at `v0.2.0` is `main` as of this
104
+ release. Installed metadata now reports `0.2.0`, so `pip list` and the
105
+ `dist-info` in a product image finally identify which AgentCore is running.
106
+
107
+ Note that as of this release neither product declares AgentCore on its `main`
108
+ branch — the pin exists only on each product's in-progress migration branch
109
+ (`fix/ci-bwrap-soft-probe`, `refactor/agent-core`). The repin above applies
110
+ wherever the declaration currently lives.
111
+
112
+ ### Added
113
+
114
+ - `docs/versioning.md`: version policy, what counts as a breaking change while
115
+ the public surface is still wider than `agent_core.__all__`, and the release
116
+ procedure.
117
+ - `CHANGELOG.md` (this file).
118
+ - CI now fails a pull request that changes published code without bumping
119
+ `[project].version`, which is what let 80 commits ship as `0.1.0`.
120
+ - `Release` workflow: pushing a `v*` tag re-runs the full check suite, verifies
121
+ the tag matches `[project].version`, builds the wheel and sdist, and publishes
122
+ them on a GitHub Release with these notes attached.
123
+ - Automated downstream bump PRs: a release dispatches to ApodexHarness and
124
+ FrontierAgentInternal, which repin and open a pull request for their own CI to
125
+ validate. Templates live in `.github/downstream/`; setup is
126
+ [docs/downstream-bump.md](docs/downstream-bump.md). The workflows mint
127
+ least-privilege, short-lived GitHub App tokens per run, strictly validate the
128
+ dispatched version before exposing it to shell, and do not persist write
129
+ credentials in the checkout.
130
+ - Corrected the documented pin scheme to `git+ssh://git@github.com/`, which is
131
+ what both products actually declare. The credential note previously rewrote
132
+ `https://github.com/`, a no-op against an `ssh://` dependency URL.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.