Runtime
The ARP "Jarvis" Runtime is the execution engine for agents. It orchestrates model calls and tool usage to complete tasks. A Runtime Instance is the component most resembling an individual AI "Agent".
Responsibilities
- Executes a
flow: Planner → Tool Executor → Chat.- The
Planneroutputs a list of furtherplanortoolsteps needed to achieve the goal. This provides LLM-driven self-mutation capability to the flows. - The
Tool Executorgenerate the exact arguments needed to call atoolvia the tool registry client, then make the call. - Once all steps are executed, the
Chathandler reads the execution record of the steps, and returns a final result.
- The
- Maintains execution context across steps (
user_request,step_results, trace metadata). - Integrates with
Tool Registryfor tool discovery (list_tools), schema lookup (get_tool), and invocation (invoke). - Emits a JSONL trace (
trace.jsonl) capturing step lifecycle and tool/LLM calls.
In the current MVP, the Runtime is primarily a CLI (jarvis-runtime …) plus a small set of Python orchestration classes you can embed.
Interfaces
CLI (MVP)
jarvis-runtime demo: runs a small multi-request demo flowjarvis-runtime run --request "<text>": runs a single requestjarvis-runtime replay --trace <path>: replays Chat from a recorded trace
Python (library entry points)
jarvis_runtime.orchestrator.FlowOrchestrator: executes a flow and returns aRunResult(final text, status, steps, and trace paths).jarvis_runtime.tool_registry_client.HttpToolRegistryClient/InProcessToolRegistryClient: Tool Registry integration.
High-level input/output:
- Input: a
user_request: str - Output: a final
final_text: strplus a trace file path (runs/<flow_id>/trace.jsonl)
Configuration
The Runtime is configured via CLI flags and environment variables:
- Tool Registry:
--tool-registry http|inproc(orJARVIS_TOOL_REGISTRY_MODE)--tool-registry-url http://…(orJARVIS_TOOL_REGISTRY_URL)
- Tracing:
--trace-dir <path>(orJARVIS_TRACE_DIR)--redact-prompts(orJARVIS_REDACT_PROMPTS)
- Model mode:
--mode stub|openai(orJARVIS_RUNTIME_MODE)
When using --mode openai, the Runtime requires OPENAI_API_KEY (or JARVIS_OPENAI_API_KEY) and optionally supports:
OPENAI_BASE_URL/JARVIS_OPENAI_BASE_URLJARVIS_MODEL_DEFAULT,JARVIS_MODEL_PLANNER,JARVIS_MODEL_TOOL_ARGS,JARVIS_MODEL_CHAT
Lifecycle
A typical run looks like:
- Flow starts with
user_request. - Planner step decides what to do next (often returns one or more
toolsteps). - Tool step(s):
- Runtime fetches tool schema from Tool Registry (
GET /v1/tools/{name}). - Tool args are generated and validated against the tool’s JSON Schema.
- Tool is invoked via Tool Registry (
POST /v1/tools/{name}:invoke).
- Runtime fetches tool schema from Tool Registry (
- Chat step produces the final user-facing response using accumulated context.
- Trace is written throughout (
flow_started,step_created,tool_invocation,tool_result,llm_call,flow_completed, …).