Passive Callback & Response API

Passive Callback & Response API

Callback / Response mapping

CallbackResponseonRequest signature
Audio2LlmCallbackAudio2LlmResponse(agentId, eventId, flag, buf, param, response)
Audio2TtsCallbackAudio2TtsResponse(agentId, eventId, itemId, flag, buf, param, response)
Asr2LlmCallbackAsr2LlmResponse(agentId, eventId, text, param, response)
Asr2TtsCallbackAsr2TtsResponse(agentId, eventId, text, param, response)
AsrVideo2VlmCallbackAsrVideo2VlmResponse(agentId, eventId, flag, text, video, param, response)
AsrVideo2TtsCallbackAsrVideo2TtsResponse(agentId, eventId, flag, text, video, param, response)
AudioVideo2VlmCallbackAudioVideo2VlmResponse(agentId, eventId, flag, data, param, response)
AudioVideo2TtsCallbackAudioVideo2TtsResponse(agentId, eventId, flag, data, param, response)

Response capability matrix

ResponseASRLLMVLMTTSSkillInterrupt
Audio2LlmResponse✓✓✓✓
Audio2TtsResponse✓✓✓✓✓
Asr2LlmResponse✓✓✓
Asr2TtsResponse✓✓✓✓
AsrVideo2VlmResponse✓✓✓
AsrVideo2TtsResponse✓✓✓✓
AudioVideo2VlmResponse✓✓✓✓
AudioVideo2TtsResponse✓✓✓✓✓

Every response supports onError(eventId, errorCode, errorMsg).

Function Call & Arbiter (new in v1.5.0)

⚠️ Not yet released: in-development v1.5.0-SNAPSHOT capability; interface and protocol may change. Do not use in production before the official release.

v1.5.0 adds Function Call dispatch and Arbiter arbitration on the passive interaction path; the interface is woven into the existing 8 callback / response classes. See Passive Callbacks Guide · Function Call exposure & Arbiter for the workflow.

Callback method (on all 8 callback classes)

java
public void onFunctionCall(String agentId, String eventId, FunctionCallInfo functionCall, <XxxResponse> response)

Default no-op; override to receive a function call forwarded by the gateway. <XxxResponse> is the response type for that callback class.

FunctionCallInfo (com.agibot.aiem.sdk.FunctionCallInfo)

FieldTypeDescription
sourceStringfunction call source
policyStringhandling policy identifier
typeStringfunction call type
valueStringmain value
paramMap<String, Object>extra parameters

Response method (on all 8 Response classes)

java
public void onArbiter(String eventId, String decision, AgentParam arbParam)

Returns the arbitration decision; the SDK emits agentsdk.function_call.arbiter. decision comes from ArbiterDecision:

Enum (com.agibot.aiem.sdk.enums.ArbiterDecision)wire valueMeaning
DELEGATEdelegatedelegate to the agent's default pipeline
OVERRIDEoverridethe application takes over, overriding the default behaviour

Event types

agentsdk.function_call.expose (gateway → SDK, triggers onFunctionCall) / agentsdk.function_call.arbiter (SDK → gateway, emitted by onArbiter). See the enums reference.

Shared base methods (PassiveCallback)

Every callback class extends PassiveCallback. The following methods may be overridden as needed (they have safe no-op log defaults):

MethodTrigger
onRobotOnline(agentId, agentMeta)Robot online
onRobotOffline(agentId)Robot offline
onFaceInfo(agentId, eventId, param)Face / voiceprint UID detected (opened in v1.4.0)
onVideoFrame(agentId, eventId, flag, buf, isKeyFrame, localTs, param)Video passthrough (flag=2 H264, flag=3 image)
onGreetSignal(agentId, eventId, param, GreetResponse response)Greeting signal (merged in v1.4.0)
onState(agentId, eventId, stateName, stateValue)Robot state push (merged in v1.4.0); see robot-side state modules for the full catalogue
onHistories(agentId, eventId, List<HistoryInfo> histories)Conversation history push (new in v1.5.0); HistoryInfo fields below

HistoryInfo (com.agibot.aiem.sdk.HistoryInfo, v1.5.0)

FieldTypeDescription
timestamplongtimestamp, for sorting
queryStringuser-side input
answerStringagent-side reply
completebooleanwhether this turn finished completely
eventIdStringcorresponding session event ID, for de-duplication

GreetResponse methods

MethodDescription
onGreetVlmDelta(eventId, text)VLM streaming chunk
onGreetVlmDone(eventId)VLM streaming finished
onGreetTtsDelta(eventId, audioBase64)TTS audio chunk — audioBase64 is the base64-encoded chunk of synthesised audio bytes
onGreetTtsDone(eventId)TTS audio stream finished
onError(eventId, code, msg)Error reply