Skip to content

Agent Runtime

Motor de ejecución central. AgentRuntime gestiona el ciclo de vida de un agente: LLM, tools, verificación, checkpoints y reintentos bajo presupuestos de tokens y pasos.

Flujo

AgentRuntime.execute(ctx)

  ├─ acquireSlot() / tenant checks / storage
  ├─ [Retry loop]
  │   ├─ callWithTimeout() → LLM
  │   ├─ ToolPlanner → executeTool → cache
  │   ├─ verification (5 puertas)
  │   └─ checkpoint()
  ├─ releaseSlot()
  └─ flush traces

Bucle principal

  1. Semáforo de concurrencia
  2. Rate limit y cuota por tenant
  3. Llamada LLM con timeout
  4. Tools con plan de dependencias (paralelo cuando es posible)
  5. Verificación de 5 puertas → reintento si falla
  6. Checkpoint atómico por paso
  7. Flush de traces y muestras

Componentes

ComponenteArchivoRol
AgentRuntimeruntime/agentRuntime.tsBucle principal
ToolPlannerruntime/toolPlanner.tsPlan de tools
ToolOrchestratorruntime/toolOrchestrator.tsEjecuta el plan
StepErrorBoundaryruntime/stepErrorBoundary.tsskip/retry/abort
TokenGovernorruntime/tokenGovernor.tsPresupuesto de tokens
CycleDetectorruntime/cycleDetector.tsBucles infinitos

Config

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

Relacionado

MIT — Hecho para orquestación multi-agente.