AGI Core Architecture
agi_core is the shared framework-helper layer used by AGILAB pages, CLI
mirrors, telemetry, and app-loading code. It is not the worker runtime and it
does not own environment resolution or distributed execution. Those
responsibilities live in agi_env, agi_node, and agi_cluster.
Use this page when you need to decide whether a change belongs in shared page/app helpers or should stay inside an app, page, or worker package.
Modules at a glance
Web interface and CLI entry points call into agi_core helpers before
handing environment resolution to agi_env and execution to
agi_cluster.
src/agilab/core/agi-core ships the following higher-level domains:
agi_core.appsHelper mixins for app metadata, dataset manifests, and path helpers that app managers can import from their project root. If you add a new manager or need an app to opt in to common validation, start here.
agi_core.streamlitShared web interface widgets (status panels, history view, deploy dialogs) used by PROJECT/ORCHESTRATE/WORKFLOW/ANALYSIS. Keeping them here avoids circular imports from the page packages.
agi_core.telemetryStructured logging, run-history helpers, and wrappers used by
AGI.runto emit consistent events back to the web interface and the CLI mirrors.agi_core.servicesSmall utility services (encryption, local cache, dataset registry) designed to be reused by both the GUI and the app installers.
What belongs here
Put code in agi_core only when it is shared by multiple pages, CLI mirrors,
or app managers and does not require worker-runtime imports. Keep these outside
agi_core:
active-project path and environment resolution: use
agi_envworker base classes, package bootstrap, and worker install hooks: use
agi_noderun dispatch, Dask, SSH, service lifecycle, and
AGI.run: useagi_clusterapp-specific business logic: keep it under the app project
Execution flow
Web interface pages talk to agi_core services before dispatching work to
agi_env/agi_cluster.
Generated from pyreverse to show how agi_core orchestrates calls to
agi_env helpers and dispatcher facades.
Typical call stack when a user clicks RUN on the ORCHESTRATE page:
src/agilab/pages/2_ORCHESTRATE.pycollects form values and calls shared app/page helpers.agi_corebuilds app metadata, page state, telemetry context, orWorkDispatcherinputs without importing worker-only dependencies.The page resolves an
AgiEnvand calls the publicAGIfacade.AGI.runhands execution toagi_cluster.agi_distributorand the worker package built byagi_node.Results propagate back through
agi_corehelpers such as history, downloads, telemetry, and status widgets before the UI renders the finished run.
Repository pointers
Directory |
Purpose |
|---|---|
|
Metadata helpers shared by |
|
Widgets, layout templates, and modal logic for ORCHESTRATE/ANALYSIS. |
|
Structured logging, status persistence, and run history APIs. |
|
Standalone service objects (encryption, caching, dataset registry). |
Tips for contributions
Keep business logic for a specific app inside its app project root: source built-ins use
src/agilab/apps/builtin/<project>, packaged payloads usesrc/agilab/lib/agi-app-*, and external apps stay in their app repository. Only move code intoagi_corewhen multiple apps/pages need the abstraction.When adding a new web widget, place it under
agi_core/streamlitand export it through a small__all__. That keeps import graphs manageable.agi_corehas no hard dependency onagi_envoragi_cluster. If your change requires environment or dispatcher behaviour, extract a thin interface and inject the dependency so unit tests stay fast.
See also
Framework API for the high-level
AGI.*orchestration entry points.AGILab for the user-facing web pages built on top of
agi_core.AGILab Architecture for the full-stack overview (pages → agi_core → agi_env/cluster).