PRAXO-CORE Architecture¶
Layers¶
Agent loop
-> model abstraction
-> tool registry
-> runtime plugin plane (manifest, hosts, bridges, TCK)
-> policy hook
-> event sink
-> memory store
-> checkpoint store
-> sandbox
-> scheduler contract
-> HTTP client
The agent loop depends only on the interfaces it needs. Plugin hosts, HTTP clients, schedulers, and sandboxes are adapters supplied by the product or an external integrator.
Agent Loop¶
- Start a run, apply run middleware, and emit
run.started. - Build the prompt from the system prompt, recalled memory, skills, session messages, and the user prompt.
- Per step:
- authorize model generation;
- compact the prompt when a
ContextBudgetis configured; - run model middleware and call the model with retry;
- enforce the token budget;
- append the assistant message.
- If the model requests tools:
- authorize each tool call;
- run approval/interrupt handling and tool middleware;
- invoke tools (optionally in parallel) and append results;
- emit tool events and continue.
- On a final answer, write the memory record, emit
run.completed, and return. - Fail closed on policy denial.
- Stop at
MaxSteps,MaxTokens, orErrContextBudget.
Context Management¶
Context is managed in layers:
Options.MemoryFilesloadsAGENTS.mdcontent into the system prompt at construction time, bounded byMaxAgentsMDBytes.ContextBudgetdeterministically keeps recent turns and tool-call/result pairs under an estimated token bound.ContextCompactorcan summarize older turns before the deterministic pass;ModelSummarizeris the built-in model-backed implementation.Offloaderreplaces tool results aboveOffloadThresholdByteswith a caller-owned reference before they enter the prompt.Options.PromptCachesupplies a provider-neutralmodel.CacheHintfor stable prefixes; providers may translate it to their cache-control mechanism.
Compaction and offload are observable through Hooks.OnCompaction and
Hooks.OnOffload.
Harness Profiles and Evaluation¶
model.ProviderProfile/ProfileRegistrydescribe context windows, output limits, tool/stream/cache support, and tool-call format by model prefix.agent.RubricMiddlewareevaluates a completed run with anEvaluatorand fails the run belowRubric.PassScore.sandbox.Interpreteris the optional in-process script seam; products supply the runtime (for example QuickJS) when they need one.
Agent Package Layout¶
pkg/agentkeepsAgent,Options,New,Run, and compatibility aliases.- Capability subpackages:
types,context,delegation,evaluation,hitl,stream, andmiddleware. - The root aliases preserve
agent.*source compatibility; new capabilities live in the matching subpackage.
Agent Middleware Parity¶
StructuredOutputbinds a JSON schema through provider response format or a virtual tool, validates the final output, and optionally repairs it.ToolSelectionMiddlewarenarrows advertised tools per run;ModelToolSelectoris the built-in model-backed selector.PIIMiddlewareredacts model-bound messages and tool results before they enter the prompt.FallbackModelretries a failed primary model call on a fallback model.CallLimitMiddlewarebounds per-run model and tool calls.ContextEditingMiddlewareclears old tool results without dropping message pairs.TodoTool/TodoMiddlewareprovidewrite_todosplanning state and prompt injection.pkg/tool.Retryretries failed tool invocations with the same policy shape.
Human-in-the-Loop Decisions¶
InterruptDecisionsupports approve, edit, reject, and respond.Options.OnInterruptDecisiontakes precedence over the legacy booleanOnInterrupt; edit replaces tool arguments, respond skips execution and feeds the human response back to the model.- Shell sessions, execution policies, and MCP elicitation remain product/Janus responsibilities; the core only owns the decision contract.
Runtime Interoperability¶
OnStreamemits typedStreamPartprojections: values, updates, messages, tasks, debug, and checkpoints.- Stream consumers can persist or forward projections without parsing the event sink.
- Session-level resume is expressed by pre-populating
Session.Messages; durable checkpoint storage remains a product concern. - Graph execution remains RHEOVELA-owned; the core stream is the agent-node boundary, not a LangGraph-compatible projection runtime.
Delegation¶
SubagentManagerruns delegated child tasks asynchronously with launch/check/update/cancel/list.SubagentIsolatedstarts a child with only the request context;SubagentForkcarries the parent message history.- A runner that implements
ControllableRunnercan accept mid-flight steering.
Virtual Filesystem¶
pkg/vfsdefines the backend contract (Stat,Read,Write,List,Delete,Glob,Grep) and an optionalExecutor.pkg/vfs/localfsconfines all paths to one root and rejects traversal, sibling prefixes, and symlink escapes.pkg/vfs/vfstoolsexposes the backend asfs.*tools for the agent loop.
Plugin Plane¶
The plugin plane is split at a contract boundary:
pkg/pluginowns Manifest v1, contract kinds, lifecycle, guarded registry, scope, limits, and telemetry.pkg/plugin/host/{process,wasm}own the host implementations and platform supervisors.pkg/plugin/bridgemaps a host totool.Tool,model.Model,policy.Hook,memory.Store, andsandbox.Sandbox.pkg/plugin/tckasserts lifecycle, registry, framing, timeout, cancellation, capability denial, and the not-active gate.
Products own materialization, signature trust, SBOM/evidence, and rolling updates. The framework never imports product governance.
Design Rules¶
- Interfaces first; concrete integrations are adapters.
- No provider credentials in the framework.
- No tenant data in logs.
- No AGPL imports.
- Every exported behavior has a test.
- Event and policy errors propagate; they are not silently dropped.
Concurrency¶
The framework is stateless per run. Callers may run multiple agents
concurrently. Shared adapters must provide their own synchronization. Tool
calls within one model response may run concurrently when MaxParallelTools > 1
while preserving message order.