Class ResponsesMultiAgentFormatter
java.lang.Object
io.agentscope.extensions.model.openaiofficial.ResponsesMultiAgentFormatter
Multi-agent formatter for the OpenAI Responses API.
Converts AgentScope Msg objects to Responses API ResponseInputItem objects with multi-agent support.
The formatter groups messages into:
- SYSTEM - extracted individually as
EasyInputMessagewith SYSTEM role - TOOL_SEQUENCE - tool calls and results, passed through to
ResponsesRequestMapperunchanged (including reasoning replay) - AGENT_CONVERSATION - merged into a single
EasyInputMessagewith USER role, wrapped in<history>tags - BYPASS - messages with
BYPASS_MULTIAGENT_HISTORY_MERGEmetadata, passed through individually as user messages
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a formatter with the default conversation history prompt.ResponsesMultiAgentFormatter(String conversationHistoryPrompt) Create a formatter with a custom conversation history prompt. -
Method Summary
Modifier and TypeMethodDescriptionList<com.openai.models.responses.ResponseInputItem>formatHistory(List<io.agentscope.core.message.Msg> messages) Formats AgentScope messages into Responses API input items with multi-agent merging.
-
Constructor Details
-
ResponsesMultiAgentFormatter
public ResponsesMultiAgentFormatter()Create a formatter with the default conversation history prompt. -
ResponsesMultiAgentFormatter
Create a formatter with a custom conversation history prompt.- Parameters:
conversationHistoryPrompt- the prompt to prepend before the first history block
-
-
Method Details
-
formatHistory
public List<com.openai.models.responses.ResponseInputItem> formatHistory(List<io.agentscope.core.message.Msg> messages) Formats AgentScope messages into Responses API input items with multi-agent merging.System messages and tool sequences are passed through to
ResponsesRequestMapperunchanged. Agent conversation messages are merged into single user messages with<history>tags.- Parameters:
messages- the conversation history- Returns:
- Responses API input items
-