Passive Callback & Response API
Passive Callback & Response API
All *Callback classes live in linksoul_agentsdk.passive.
Callback / Response mapping
| Callback | Response | on_request signature |
|---|---|---|
Audio2LlmCallback | Audio2LlmResponse | (agent_id, event_id, flag, buf, param, response) |
Audio2TtsCallback | Audio2TtsResponse | (agent_id, event_id, item_id, flag, buf, param, response) |
Asr2LlmCallback | Asr2LlmResponse | (agent_id, event_id, text, param, response) |
Asr2TtsCallback | Asr2TtsResponse | (agent_id, event_id, text, param, response) |
AsrVideo2VlmCallback | AsrVideo2VlmResponse | (agent_id, event_id, flag, text, buf, param, response) |
AsrVideo2TtsCallback | AsrVideo2TtsResponse | (agent_id, event_id, flag, text, buf, param, response) |
AudioVideo2VlmCallback | AudioVideo2VlmResponse | (agent_id, event_id, flag, buf, param, response) |
AudioVideo2TtsCallback | AudioVideo2TtsResponse | (agent_id, event_id, flag, buf, param, response) |
Response capability matrix
| Response | ASR | LLM | VLM | TTS | Skill | Interrupt |
|---|---|---|---|---|---|---|
Audio2LlmResponse | ✓ | ✓ | ✓ | ✓ | ||
Audio2TtsResponse | ✓ | ✓ | ✓ | ✓ | ✓ | |
Asr2LlmResponse | ✓ | ✓ | ✓ | |||
Asr2TtsResponse | ✓ | ✓ | ✓ | ✓ | ||
AsrVideo2VlmResponse | ✓ | ✓ | ✓ | |||
AsrVideo2TtsResponse | ✓ | ✓ | ✓ | ✓ | ||
AudioVideo2VlmResponse | ✓ | ✓ | ✓ | ✓ | ||
AudioVideo2TtsResponse | ✓ | ✓ | ✓ | ✓ | ✓ |
Every response supports on_error(event_id, error_code, error_msg).
Shared base methods (PassiveCallback)
| Method | Trigger |
|---|---|
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
| Method | Description |
|---|---|
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_requestwithasyncio.run_coroutine_threadsafe(...)and wait for completion before invokingresponse.on_*so the "interrupt-first" ordering still holds.