Protected_JSON validator instance for cleaning and validating responses
Static ReadonlyCURRENT_Common placeholder for current payload injection
Determines if loop results should be injected as a temporary user message before the next prompt execution (for LLM reasoning).
Default: true (most agent types benefit from seeing loop results) Flow agents override to false (deterministic path navigation, no LLM)
true to inject results as message, false to skip
Marks this agent type as session-driven rather than loop-driven.
BaseAgent will use this getter (added on this subclass; base-agent-type.ts is left
untouched in this task) to branch into a RealtimeSessionRunner instead of the
iterative reasoning loop. Other agent types do not expose this member; BaseAgent should
treat its absence as false, or equivalently detect this type via instanceof RealtimeAgentType.
Always true — realtime agents are driven by a long-lived duplex session.
Realtime agents drive their conversation through a live model session, not through agent-level loop prompts. The companion/system prompt is supplied to the realtime model at session start, so the agent-level prompt relationship is not required.
Always false — agent-level loop prompts are not required for realtime agents.
OptionalAfterCalled after each loop iteration completes to process results.
Flow agents use this to apply ActionOutputMapping and update payload. Loop agents typically don't need this (just collect results).
Results from this iteration
Modified payload or null for default behavior (just collect result)
OptionalBeforeCalled before each loop iteration to prepare parameters and payload.
Loop agents use this to resolve template variables ("item.email"). Flow agents typically don't need this (params already resolved).
Current iteration context
Modified context or null for default behavior
ProtectedcreateProtectedCreates a standardized next step object with common defaults
The payload type
The step type
Additional options to merge
The next step object
ProtectedcreateProtectedCreates a retry step with a standardized error message
The payload type
The error message
Additional options
Retry step
ProtectedcreateProtectedCreates a success step with optional payload changes
The payload type
Success options
Success step
Determines the initial step for a realtime agent.
The realtime conversation is owned by the session runner, so there is no loop step to
begin. Returning null defers to the caller; in practice BaseAgent branches on
IsSessionDriven before this would matter.
The full execution parameters (unused).
The current payload (unused).
The agent-type state (unused).
Always null — there is no loop step to seed.
Determines the next step from a prompt result.
Realtime agents are session-driven and never enter the iterative reasoning loop, so this
method should never be reached in normal operation. It is implemented defensively: it logs
and returns a terminal Failed step rather than throwing, so a mis-wired caller degrades
gracefully instead of crashing a live session.
Result from prompt execution (unused).
The full execution parameters (unused).
The current payload (unused).
The agent-type state (unused).
A terminal Failed step describing the misuse.
Provides agent-type-specific guidance for configuration errors related to missing prompts. This allows each agent type to give contextual help based on its architecture.
Default implementation provides generic guidance. Agent types should override to provide specific instructions relevant to their configuration requirements.
Configuration guidance specific to this agent type
Gets the prompt to use for a step.
Realtime agents do not select per-step loop prompts — the companion/system prompt is handed to the realtime model at session start. The default child prompt (if any) is returned for completeness, but it is not used to drive the conversation.
The execution parameters (unused).
The loaded agent configuration.
The current payload (unused).
The agent-type state (unused).
OptionalpreviousDecision: BaseAgentNextStep<P>The previous step decision (unused).
The configured child prompt, or null if none is configured.
Determines how to handle Success or Failed steps when no explicit termination is requested.
This allows agent types to control their own fallback behavior:
Default implementation returns null, which causes base-agent to fall back to prompt execution if prompts are configured. Agent types can override this to provide custom behavior.
The Success or Failed step that needs fallback handling
The loaded agent configuration
The execution parameters
The current payload
Agent type's state
Custom step to execute, or null for default behavior
Initializes agent-type-specific state for a realtime run.
The Realtime agent type keeps no iterative loop state — all live state lives inside the RealtimeSessionRunner and the underlying provider session — so an empty state object is returned, mirroring LoopAgentType.InitializeAgentTypeState.
The agent execution params (unused for realtime state).
An empty agent-type state object.
Injects a payload into a prompt.
Realtime conversations are not driven by loop prompts, so there is no per-turn payload to inject. This is a no-op (defensive against a mis-wired caller), in contrast to LoopAgentType.InjectPayload which injects the current payload into the loop prompt.
The payload to inject (unused).
The agent-type state (unused).
The prompt parameters (unused).
Agent identification info (unused).
ProtectedparseProtectedParses JSON response from prompt execution with automatic validation syntax cleaning
The expected response type
The prompt execution result
Parsed response or null if parsing fails
Post-processes the result of action execution.
This method is called by BaseAgent after action(s) have been executed. Agent types can override this method to perform custom processing of action results, such as mapping output parameters to the payload or storing results in agent-specific context.
The results from action execution
The actions that were executed
The current payload
The current step being executed
Optional payload change request
Post-processes the result of sub-agent execution.
This method is called by BaseAgent after a sub-agent has been executed. Agent types can override this method to perform custom processing of sub-agent results, such as extracting specific data from the sub-agent's payload or updating context.
The result from sub-agent execution
The sub-agent request that was executed
The current payload
The current step being executed
Optional payload change request
Pre-processes an action step before execution.
This method is called by BaseAgent before action(s) are executed. Agent types can override this method to perform custom pre-processing, such as mapping payload values to action input parameters or modifying action configurations.
The actions that will be executed (can be modified)
The current payload
The current step being executed
Optionalparams: ExecuteAgentParams<P>Actions are modified in place
Pre-processes a retry step.
Realtime agents have no loop retry semantics; null is returned to indicate "no custom
behavior", consistent with LoopAgentType.PreProcessNextStep.
The full execution parameters (unused).
The retry step (unused).
The current payload (unused).
The agent-type state (unused).
Always null.
Protected StaticgetProtectedInstantiates an agent type class using a specific driver class name.
This method is used when an individual agent has its own DriverClass override, allowing for specialized implementations per agent instance.
The driver class name to instantiate
Instance of the agent type class
Protected StaticgetProtectedInstantiates the appropriate agent type class based on the agent type entity.
This method uses the MemberJunction class factory to dynamically instantiate agent type classes. It uses the DriverClass field. If DriverClass is not specified it throws an error.
The agent type entity to instantiate
Instance of the agent type class
StaticGetHelper method that retrieves an instance of the agent type based on the provided agent type entity.
This method uses the ClassFactory to create an instance of the agent type class specified in the DriverClass field of the agent type entity. If the DriverClass is not specified, it throws an error.
The agent type entity to instantiate
An instance of the agent type class
Implementation of the Realtime Agent Type pattern.
A first-class peer of Loop and Flow that drives a BaseRealtimeModel session rather than an iterative reasoning loop. Because it is a real MJ agent type, an agent of this type inherits the entire framework for free: server tools (actions), client tools, artifacts, prompts, memory, permissions, and observability. The first agent shipped of this type is the Realtime Co-Agent, which voices on behalf of a target agent.
Execution branch. The realtime path is session-driven:
BaseAgent(in a later task) will detect IsSessionDriven (orinstanceof RealtimeAgentType) and hand control to a RealtimeSessionRunner rather than entering the loop. As a consequence, the loop-oriented abstract methods below are implemented defensively — they should never be reached in normal operation.RealtimeAgentType