feat: add configurable agent ID support
Allow users to configure which OpenClaw agent the integration communicates with, instead of always defaulting to the implicit 'main' agent. Changes: - const.py: add CONF_AGENT_ID, DEFAULT_AGENT_ID='main', ATTR_AGENT_ID - api.py: accept agent_id in constructor; _headers() now includes the x-openclaw-agent-id header on every request; async_send_message and async_stream_message accept an optional per-call agent_id override - config_flow.py: expose agent_id as a text field in both the manual setup step and the options flow (Settings → Integrations → Configure) - __init__.py: read agent_id from options/data and pass it to the API client; add optional agent_id field to the send_message service schema so automations can address a specific agent per-call - services.yaml: document the new agent_id field on send_message - strings.json / translations/en.json: add UI labels for the new option The gateway routing header x-openclaw-agent-id is always sent; when agent_id is 'main' (the default) the gateway behaviour is unchanged. A per-call override on send_message takes precedence over the config. Implemented with assistance from an AI coding agent (BMO) with human review. Bot-assisted contribution reviewed by a human before submission.
This commit is contained in:
@@ -23,6 +23,7 @@ CONF_GATEWAY_TOKEN = "gateway_token"
|
||||
CONF_USE_SSL = "use_ssl"
|
||||
CONF_VERIFY_SSL = "verify_ssl"
|
||||
CONF_ADDON_CONFIG_PATH = "addon_config_path"
|
||||
CONF_AGENT_ID = "agent_id"
|
||||
|
||||
# Options
|
||||
CONF_INCLUDE_EXPOSED_CONTEXT = "include_exposed_context"
|
||||
@@ -36,6 +37,7 @@ CONF_VOICE_PROVIDER = "voice_provider"
|
||||
CONF_BROWSER_VOICE_LANGUAGE = "browser_voice_language"
|
||||
CONF_THINKING_TIMEOUT = "thinking_timeout"
|
||||
|
||||
DEFAULT_AGENT_ID = "main"
|
||||
DEFAULT_INCLUDE_EXPOSED_CONTEXT = True
|
||||
DEFAULT_CONTEXT_MAX_CHARS = 13000
|
||||
DEFAULT_CONTEXT_STRATEGY = "truncate"
|
||||
@@ -130,6 +132,7 @@ ATTR_SESSION_KEY = "session_key"
|
||||
ATTR_DRY_RUN = "dry_run"
|
||||
ATTR_MESSAGE_CHANNEL = "message_channel"
|
||||
ATTR_ACCOUNT_ID = "account_id"
|
||||
ATTR_AGENT_ID = "agent_id"
|
||||
ATTR_OK = "ok"
|
||||
ATTR_RESULT = "result"
|
||||
ATTR_ERROR = "error"
|
||||
|
||||
Reference in New Issue
Block a user