Coze

[中文]

  • Component registry: espressif/brookesia_agent_coze

  • Helper header: #include "brookesia/agent_helper/coze.hpp"

  • Helper class: esp_brookesia::agent::helper::Coze

Overview

brookesia_agent_coze implements the Coze agent on top of ESP-Brookesia Agent Manager.

Features

  • Coze API: WebSocket to Coze for real-time voice and text.

  • OAuth2: Token acquisition and refresh for Coze.

  • Multi-bot: Configure multiple bots and switch the active one.

  • Audio: Built-in codecs; default G711A at 16 kHz.

  • Emotes: Receive and display Coze expression events.

  • Platform events: e.g. balance warnings.

  • Persistence: Optional brookesia_service_nvs for auth and bot metadata.

Standard Include / Helper Class

  • Standard include: #include \"brookesia/agent_helper/coze.hpp\"

  • Helper class: esp_brookesia::agent::helper::Coze

Service Interfaces

Functions

SetActiveRobotIndex

Description

Set active robot index.

Execution
  • Requires scheduler: Not required

Parameters
  • Index

    • Type: Number

    • Required: required

    • Description: Robot index to activate.

Schema JSON
Show raw JSON

{
  "name": "SetActiveRobotIndex",
  "description": "Set active robot index.",
  "require_scheduler": false,
  "parameters": [
    {
      "name": "Index",
      "description": "Robot index to activate.",
      "type": "Number",
      "required": true,
      "default_value": null
    }
  ]
}
CLI Command
svc_call AgentCoze SetActiveRobotIndex {"Index":null}

GetActiveRobotIndex

Description

Get active robot index. Return type: number. Example: 0

Execution
  • Requires scheduler: Not required

Parameters
  • No parameters.

Schema JSON
Show raw JSON

{
  "name": "GetActiveRobotIndex",
  "description": "Get active robot index. Return type: number. Example: 0",
  "require_scheduler": false,
  "parameters": []
}
CLI Command
svc_call AgentCoze GetActiveRobotIndex

GetRobotInfos

Description

Get robot info list. Return type: JSON array<object>. Example: [{“name”:”robot1”,”bot_id”:”bot_id1”,”voice_id”:”voice_id1”,”description”:”description1”},{“name”:”robot2”,”bot_id”:”bot_id2”,”voice_id”:”voice_id2”,”description”:”description2”}]

Execution
  • Requires scheduler: Not required

Parameters
  • No parameters.

Schema JSON
Show raw JSON

{
  "name": "GetRobotInfos",
  "description": "Get robot info list. Return type: JSON array<object>. Example: [{\"name\":\"robot1\",\"bot_id\":\"bot_id1\",\"voice_id\":\"voice_id1\",\"description\":\"description1\"},{\"name\":\"robot2\",\"bot_id\":\"bot_id2\",\"voice_id\":\"voice_id2\",\"description\":\"description2\"}]",
  "require_scheduler": false,
  "parameters": []
}
CLI Command
svc_call AgentCoze GetRobotInfos

Events

CozeEventHappened

Description

Emitted when a Coze event occurs.

Execution
  • Requires scheduler: Required

Items
  • CozeEvent

    • Type: String

    • Description: Coze event. Allowed values: [InsufficientCreditsBalance]

Schema JSON
Show raw JSON

{
  "name": "CozeEventHappened",
  "description": "Emitted when a Coze event occurs.",
  "require_scheduler": true,
  "items": [
    {
      "name": "CozeEvent",
      "description": "Coze event. Allowed values: [InsufficientCreditsBalance]",
      "type": "String"
    }
  ]
}
CLI Command
svc_subscribe AgentCoze CozeEventHappened