refactor(runtime): run the agent loop on apodex-agent-core 0.12.0 - #50
Merged
Merged
Conversation
Replace the forked runtime engine in frontier_agent/ with the published apodex-agent-core package, following ApodexHarness's integration pattern. frontier_agent.* keeps its import paths, so workflows, apodex and benchmarks are unchanged: - 80 modules become sys.modules aliases of their agent_core counterparts (loop contracts, messages, tools, compaction, observers, AgentBus pieces, DAG, registries, models, providers), which unifies class identity and contextvars with the engine. - Product policy is injected instead of forked: AgentLoopHooks (session binding, execution scope, wall deadline, spill detection) and ToolExecutionHooks (timeout floors, bash budget, metering, result cap with spill, aggregate budget); configure_* resolvers for AgentBus and the OpenAI session-affinity policy; a model-registry path; compaction prompt style and trigger ratio. - Product-only modules (config, providers, llm_adapter, summary_llm, scheduler, process_manager, console/duplicate-query observers) stay local on top of the shared types. - tools/check_symbols.py follows sys.modules aliases and external star imports. - Tests that pinned fork internals now assert AgentCore's semantics. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…unds
- Pin apodex-agent-core==0.12.0.
- infra/openai_client.py is a plain alias again (AgentCore treats an empty
api_key as unset); only the session-affinity resolvers are configured.
- TaskBoardObserver aliases the shared class (now critical upstream).
- loop_types no longer hand re-exports wall_deadline_remaining_s (in
__all__ upstream).
- create_file annotates its rows/data shorthand shapes explicitly instead of
patching items to {}, so every schema node keeps a concrete type for
strict validators.
- create_subagent uses the public bind_max_tokens instead of _ensure_bound.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Open
3 tasks
dq-ai-dev
approved these changes
Sep 25, 2026
dq-ai-dev
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed current head b456dd7. The AgentCore aliases preserve shared type and context identity, while the FrontierAgent hooks retain the product-specific session, execution, timeout, metering, spill, and AgentBus policies. The focused runtime checks and current CI are green. No blocking findings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces FrontierAgent's forked runtime engine with the published
apodex-agent-corepackage (pinned==0.12.0), following the ApodexHarness integration pattern. The core loop is now decoupled from workflows:frontier_agent.*keeps its import paths, soworkflows/,apodex/andbenchmarks/need no changes.sys.modulesaliases of theiragent_corecounterparts (loop contracts, messages, tools, compaction, observers, AgentBus pieces, DAG, registries, models, providers). This also unifies class identity and contextvars with the engine.core/runtime/loop/agent_loop.py—AgentLoopHooks(sticky-session binding, execution scope, wall deadline, spill-file detection).core/runtime/loop/tool_exec.py—ToolExecutionHooks(timeout floors, bash budget contextvar, usage metering, configurable result cap with spill, per-turn aggregate budget).components/agent_bus/bus.py—configure_*resolvers so sub-agents get the same hooks, pause check and event sink.infra/openai_client.py— session-affinity resolvers.ResourceManagerrole LLMs.llm_adapter,summary_llm, scheduler, process manager, console / duplicate-query observers.tools/check_symbols.pynow followssys.modulesaliases and external star imports.Behaviour changes (now follows AgentCore)
KeepLastNwrites mini cards.Any-typed tool params generate{"type": "string"}(deliberate upstream: strict validators reject untyped nodes) —create_filenow annotates itsrows/datashapes explicitly.test_long_run_compaction,test_summary_retry_budget) now assert AgentCore semantics.Upstream follow-ups (AgentCore)
Landed and released in 0.12.0, and the local workarounds are removed in this PR: ApodexAI/AgentCore#41 (empty
api_key), #42 (TaskBoardObservercritical), #43 (public host helpers). Runaway-retry wording: ApodexAI/AgentCore#46. (Sub-agent result caps and fan-in protection turned out to be host-configurable already, via the AgentBus runtime spec'sconfig_builderandTieredCompactor(protect_tool_names=...).)Test plan
pytest tests— 895 passed, 4 skipped (same asmain)ruff,pyright(only pre-existing missing-extras errors),check_symbols.py,check_lazy_exports.py,import_smoke.py --stage 1apodex-1.1-mini, side by side withmain(on 0.11.1):🤖 Generated with Claude Code