Agents: pass explicit message tool agent id

This commit is contained in:
Vincent Koc
2026-03-07 09:18:44 -08:00
parent 1f7892852e
commit 60f1842472

View File

@@ -488,6 +488,7 @@ const MessageToolSchema = buildMessageToolSchemaFromActions(AllMessageActions, {
type MessageToolOptions = {
agentAccountId?: string;
agentSessionKey?: string;
agentId?: string;
config?: OpenClawConfig;
currentChannelId?: string;
currentChannelProvider?: string;
@@ -775,9 +776,9 @@ export function createMessageTool(options?: MessageToolOptions): AnyAgentTool {
gateway,
toolContext,
sessionKey: options?.agentSessionKey,
agentId: options?.agentSessionKey
? resolveSessionAgentId({ sessionKey: options.agentSessionKey, config: cfg })
: undefined,
agentId:
options?.agentId?.trim() ||
resolveSessionAgentId({ sessionKey: options?.agentSessionKey, config: cfg }),
sandboxRoot: options?.sandboxRoot,
abortSignal: signal,
});