Skip to content

Agent Runtime

Agent Runtime. Cette page décrit un composant d’architecture Commander. Le texte ci-dessous reprend la structure du monorepo en français opérationnel ; les blocs de code restent en anglais.

Architecture

AgentRuntime.execute(ctx)

  ├─ acquireSlot()        ← sémaphore de concurrence
  ├─ [Tenant check]       ← rate limit + quota de concurrence
  ├─ resolve storage      ← mémoire + cache scopés tenant

  ├─ [Retry loop: 0..maxRetries]
  │   ├─ callWithTimeout()       ← provider LLM
  │   ├─ [Tool execution loop]
  │   │   ├─ planner.plan()      ← plan dépendances
  │   │   ├─ executeTool()       ← StepErrorBoundary → tool.execute()
  │   │   └─ cache.set()
  │   ├─ verification.check()    ← 5 portes qualité
  │   └─ checkpoint()            ← save atomique

  ├─ releaseSlot()
  └─ flush traces + samples

Boucle principale

  1. Acquisition de slot — ne pas dépasser les runs concurrents
  2. Validation tenant — rate limits et quotas
  3. Appel LLM — timeout configurable
  4. Exécution toolsToolPlanner parallélise les tools indépendants
  5. Vérification — 5 portes ; échec → retry
  6. Checkpoint — persistance atomique à chaque étape
  7. Tracing — flush des traces et échantillons LLM

Composants clés

ComposantFichierRôle
AgentRuntimeruntime/agentRuntime.tsBoucle principale
ToolPlannerruntime/toolPlanner.tsPlan d’exécution tools
ToolOrchestratorruntime/toolOrchestrator.tsExécute le plan
StepErrorBoundaryruntime/stepErrorBoundary.tsskip / retry / abort par étape
StepTimeoutManagerruntime/stepTimeoutManager.tsTimeouts d’étape
ContextCompactorruntime/contextCompactor.tsCompactage messages
ContextWindowruntime/contextWindow.tsFenêtre glissante
TokenGovernorruntime/tokenGovernor.tsBudget tokens
CycleDetectorruntime/cycleDetector.tsBoucles infinies
ToolOutputManagerruntime/toolOutputManager.tsBudget sorties tools

Configuration

typescript
interface AgentRuntimeConfig {
  maxStepsPerRun: number;
  maxRetries: number;
  timeoutMs: number;
  maxConcurrency: number;
  budgetHardCapTokens: number;
}

Plan d’exécution

Les tools ne suivent pas l’ordre brut de la réponse LLM. Indépendants → parallèle ; dépendants → séquentiel après prérequis ; cycles détectés avant exécution.

Voir aussi

MIT — Conçu pour l’orchestration multi-agents.