Passive Callback & Response API

Passive Callback & Response API

← Home

All *Callback classes live in linksoul_agentsdk.passive.

Callback / Response mapping

CallbackResponseon_request signature
Audio2LlmCallbackAudio2LlmResponse(agent_id, event_id, flag, buf, param, response)
Audio2TtsCallbackAudio2TtsResponse(agent_id, event_id, item_id, flag, buf, param, response)
Asr2LlmCallbackAsr2LlmResponse(agent_id, event_id, text, param, response)
Asr2TtsCallbackAsr2TtsResponse(agent_id, event_id, text, param, response)
AsrVideo2VlmCallbackAsrVideo2VlmResponse(agent_id, event_id, flag, text, buf, param, response)
AsrVideo2TtsCallbackAsrVideo2TtsResponse(agent_id, event_id, flag, text, buf, param, response)
AudioVideo2VlmCallbackAudioVideo2VlmResponse(agent_id, event_id, flag, buf, param, response)
AudioVideo2TtsCallbackAudioVideo2TtsResponse(agent_id, event_id, flag, buf, param, response)

Response capability matrix

ResponseASRLLMVLMTTSSkillInterrupt
Audio2LlmResponse
Audio2TtsResponse
Asr2LlmResponse
Asr2TtsResponse
AsrVideo2VlmResponse
AsrVideo2TtsResponse
AudioVideo2VlmResponse
AudioVideo2TtsResponse

Every response supports on_error(event_id, error_code, error_msg).

Shared base methods (PassiveCallback)

MethodTrigger
on_robot_online(agent_id, agent_meta)Robot online
on_robot_offline(agent_id)Robot offline
on_face_info(agent_id, event_id, param)Face / voiceprint UID (opened in v1.4.0)
on_video_frame(agent_id, event_id, flag, buf, is_key_frame, local_ts, param)Video passthrough (flag=2 H264, flag=3 image)
on_greet_signal(agent_id, event_id, param, response)Greeting (merged in v1.4.0)
on_state(agent_id, event_id, state_name, state_value)Robot state push (merged in v1.4.0); see robot-side state modules for the full catalogue

GreetResponse methods

MethodDescription
on_greet_vlm_delta(event_id, text)VLM streaming chunk
on_greet_vlm_done(event_id)VLM done
on_greet_tts_delta(event_id, audio_base64)TTS audio chunk — audio_base64 is the base64-encoded chunk of synthesised audio bytes
on_greet_tts_done(event_id)TTS audio stream finished
on_error(event_id, code, msg)Error reply

Type hints & async

All public classes carry full typing annotations. on_request is synchronous — the WebSocket I/O runs in a dedicated worker thread per agent_id. Different agents process in parallel; the same agent processes its messages serially.

If your downstream 语义理解/LLM call is async, bridge it inside on_request with asyncio.run_coroutine_threadsafe(...) and wait for completion before invoking response.on_* so the "interrupt-first" ordering still holds.