Core Runtime
1. Orchestrator
Section titled “1. Orchestrator”deepbuilder/runtime/workflow.py defines Orchestrator, which normalizes the resolved configuration, builds DeepAgent instances through the agent factory (deepbuilder/agent/factory/), runs the LNR solver (LnrSolver), supplies the on_llm_call time-trace hook, and returns the run result. deepbuilder/runtime/composition.py assembles the LNR module graph (workspace, memory, evaluator, Gate, ESTRA, resource management, finalization, and telemetry services). The orchestrator is the assembly layer; task-specific scoring belongs to task packages and the Gate service.
2. Task-Package Registry
Section titled “2. Task-Package Registry”deepbuilder/runtime/task_package.py recursively discovers tasks/**/task.yaml, merges optional provider-family defaults from _shared/task_defaults.yaml, and builds a domain-neutral TaskPackageSpec.
| Responsibility | Behavior |
|---|---|
| Discovery | Find exactly one package for a task id and reject ambiguous registrations. |
| Contract resolution | Expose description, artifact path/kind, metric name/type/direction, evaluator entry point, and timeout. |
| Runtime isolation | Copy the package or provider family to task_runtime/, record entry-point and tree hashes, and run the evaluator outside the writable worker source tree. |
| Domain boundary | The registry contains no MLE-bench, optimization, or scientific-modeling scoring logic. |
3. ParallelRunner
Section titled “3. ParallelRunner”ParallelRunner (deepbuilder/runtime/parallel/execution/runner.py, with manifest parsing under runtime/parallel/config/ and task state under runtime/parallel/state/) parses the manifest, resolves task text and workspace paths, launches child processes, applies task-level CPU/GPU boundaries, assigns model endpoints, records task state, and terminates process groups during cancellation. It backs the deepbuilder parallel command.
| Layer | Current behavior |
|---|---|
| Concurrency | Manifest max_concurrent (default 4) or deepbuilder parallel -j bounds the number of simultaneously active tasks. |
| CPU | cpu_list establishes the task boundary and exports DEEPBUILDER_TASK_CPU_LIST; LNR may subdivide it among workers. |
| GPU | gpu_list constrains task visibility. The LNR resource runtime manages task-local leases within that boundary. |
| Configuration | General config patches are serialized through DEEPBUILDER_PARALLEL_MANIFEST_CFG_JSON; agent and LNR blocks have dedicated override paths (DEEPBUILDER_PARALLEL_AGENT_JSON, DEEPBUILDER_PARALLEL_LNR_JSON). |
| Final state | task_logs/state.json records completed, failed, error, budget_done (time budget exhausted), skipped, or stopped_by_user, plus elapsed and resume-budget accounting. |
4. Model Clients and Tracing
Section titled “4. Model Clients and Tracing”deepbuilder/foundation/config/llm/ maps stage configuration onto InquiryCraft LLM clients. llm_http.py builds a controlled asynchronous HTTP client (transport retry, no keep-alive, per-phase timeouts, optional proxy); llm_pool.py configures InquiryCraft’s KeyPool and PooledLLM for retry/cooldown behavior and round-robin or sticky routing across configured keys and base URLs (api_routing_mode, default round_robin). Token and cost accounting live in deepbuilder/runtime/observability/telemetry/agent/ (llm_usage_adapter.py, llm_cost.py). runtime/observability/telemetry/trace/time_trace.py writes deepbuilder_time_trace.csv through the orchestrator’s on_llm_call hook when enable_time_trace is on.
5. Process Lifecycle
Section titled “5. Process Lifecycle”Subprocess helpers register live process groups; the registry comes from inquirycraft.runtime through deepbuilder/runtime/core/process/utils.py. CLI signal handlers (SIGINT, SIGTERM, SIGHUP) send SIGTERM to every live group, wait for cleanup, then send SIGKILL to surviving groups. Bash execution, the full-run policy, and ParallelRunner share this process-tree discipline so interrupted research does not leave orphan training jobs.
6. Core Memory Utilities
Section titled “6. Core Memory Utilities”deepbuilder/research/state/knowledge/context/memory_context.py is the memory-context facade over projection, compression, and tool-result handling (context/context/), while context/source_snapshot.py builds source views and code maps. Agent-specific compression and replay live under deepbuilder/research/state/knowledge/memory/agent/ and memory/context/agent_compaction.py; LNR stage-memory folding lives in memory/records/stage_memory.py, re-exported for the solver from deepbuilder/research/solver/lnr/lifecycle/records/stage_memory.py.