Skip to main content

build_graph_node_handler

Function build_graph_node_handler 

Source
pub async fn build_graph_node_handler(
    graphs: HashMap<String, GraphConfig>,
    audit_sink: Option<AuditSink>,
    packs: Arc<Vec<Arc<PackRuntime>>>,
    merged_agents: HashMap<String, AgentConfig>,
    tenant: String,
    secrets: Arc<dyn SecretsManager>,
    unit: Option<String>,
) -> Option<Arc<dyn GraphNodeHandler>>
Expand description

Build the production DwAgentGraph handler if the environment is configured. Mirrors super::super::agent_node::build_agent_node_handler: it returns None (so DwAgentGraph flow dispatch errors clearly) under any of these graceful-degradation conditions:

  • graphs is empty (no graphs from any pack sidecar);
  • GREENTIC_AW_REDIS_URL is unset/empty;
  • the AW Redis connection fails;
  • the extension runtime fails to initialise.

The shared runtime Arcs (state store, ext runtime, LLM backend, telemetry, token meter, ledger) are built exactly as for the single-agent path; the durable checkpoint store reuses the same multiplexed Redis connection manager.

tenant, secrets and unit are the values the dw.agent handler of the same TenantRuntime receives (unit is the deployed unit’s bundle_id, None on the legacy tenant-only path). They feed only the pack-carried A2A tool source ([graph_a2a_source]) and, tenant and secrets only, the Chronicle-index knowledge mount (IndexMount); the rest of this path keeps its env-only secrets, as before.

Bills every turn through agent_node::resolve_billing_meter(None) (the env-configured sink, or none); see [build_graph_node_handler_metered].