Type of the payload value, allowing flexibility in the type of data returned
Type of the context object used for sub-agent requests. This ensures type safety when passing context to sub-agents. Defaults to any for backward compatibility.
OptionalactionableOptional actionable commands shown as clickable buttons/links. Typically used after completing work to provide easy navigation to created/modified resources.
OptionalactionsArray of actions to execute when step is 'actions'
OptionalartifactArtifact tool calls from the agent's response. Each entry identifies an artifact and the tool to execute against it. Processed inline (zero turn cost) alongside payload and scratchpad changes.
OptionalautomaticOptional automatic commands executed immediately when received. Used for refreshing data, showing notifications, and updating UI state.
OptionalclientClient-side tools to execute when step is 'ClientTools'. Each invocation maps to a registered ClientToolMetadata by Name.
OptionalconfidenceOptional confidence level in the decision (0.0 to 1.0)
OptionalconversationConversation-history retrieval tool calls from the agent's response — page exact stored messages back in by their persisted Sequence handles, or search history. Processed inline (zero turn cost) alongside artifact tool calls; only honored when the run has a conversationId. NOTE: structural duplicate of ConversationToolCall in @memberjunction/ai-agents (CorePlus sits below Agents and cannot import from it), mirroring how artifactToolCalls duplicates ArtifactToolCall above.
OptionalerrorError message when step is 'failed'
OptionalexpandReason for expanding the message when step is 'expand-message'
OptionalforForEach operation details when step is 'ForEach' (v2.112+)
OptionalmemoryDurable memory writes from the agent's response. Each entry records a fact/preference that persists across runs as a provisional agent note. Processed inline (zero turn cost) alongside artifact tool calls; only honored when the agent has AllowMemoryWrite enabled. NOTE: structural duplicate of MemoryWriteRequest in @memberjunction/ai-agents (CorePlus sits below Agents and cannot import from it), mirroring how artifactToolCalls duplicates ArtifactToolCall above.
OptionalmessageMessage to send to user when step is 'chat'
OptionalmessageIndex of the message to expand when step is 'expand-message'
OptionalnewThis represents the new payload after the step was executed after the payloadChangeRequest is applied.
OptionalpayloadPayload change request from the agent. Framework will apply these changes to the previous payload to create the new state. This approach ensures safe state mutations and prevents data loss from LLM truncation.
OptionalpipelineA tool pipeline from the agent's response. Chains tool invocations server-side so intermediate outputs never enter the context window — only the final step's output is returned to the agent. Processed inline (zero turn cost) alongside artifact tool calls.
OptionalplanThe plan text when step is 'Plan' (Plan Mode). Presented to the human for approval/edit via the standard response-form HITL flow before the agent may execute Actions/Sub-Agents.
OptionalpreviousThe payload that was passed into this step execution. Useful for debugging and understanding what state the agent was working with.
OptionalpriorResult from the prior step, useful for retry or sub-agent context
OptionalpromoteMedia outputs to promote to the agent's final outputs. When set, these media items will be added to the agent's mediaOutputs collection and stored in AIAgentRunMedia.
OptionalreasoningOptional, reasoning information from the agent
OptionalresponseOptional response form to collect structured user input. When present, the UI will render appropriate input controls based on question types. Use for collecting information from users during agent execution.
OptionalretryInstructions for the retry attempt, including any new context or results
OptionalretryReason for retry when step is 'retry' (e.g., "Processing action results", "Handling error condition")
OptionalscratchpadScratchpad changes from the agent's response. Processed inline (zero turn cost) alongside payload changes.
OptionalskillSkills to activate when step is 'Skill'. Each activation appends the skill's Instructions to context and enables its bundled Actions/sub-agents for the remainder of the run — it does not spawn a nested agent run.
The determined next step:
MJAIAgentRun.FinalStep union below. Use an explicit
'Skill' as typeof nextStep.step / 'Plan' as typeof nextStep.step assertion at
assignment/switch sites, mirroring the existing 'ClientTools' pattern.Note: To expand a compacted message, set step to 'Retry', set messageIndex to the message to expand, and optionally set expandReason to explain why expansion is needed. The framework will expand the message and then continue with the retry.
OptionalsubSub-agent details when step is 'sub-agent'
OptionalsubMultiple sub-agents executing in parallel when step is 'sub-agent'
Whether to terminate the agent execution after this step
OptionalterminateWhen true, the agent should terminate after executing the current step.
Used by ClientTools: the main loop needs terminate: false so it continues
to dispatch the tool execution, but executeClientToolsStep checks this
to decide whether to return Success or continue to another prompt.
OptionalwhileWhile operation details when step is 'While' (v2.112+)
Represents the next step determination from an agent type.
Agent types analyze the output of prompt execution and determine what should happen next in the agent workflow. This type encapsulates that decision along with any necessary context for the determined action.