Skip to content

Being able to save "tool-call" in saveMessage #183

@franckdsf

Description

@franckdsf

As part of a custom workflow system triggered by an LLM where steps are rendered dynamically in a chat.
I’d like to be able to save tool-call messages in addition to tool-result messages.

Currently, the saveMessage API only supports saving tool-result messages, but throws an error when attempting to save a message with type: "tool-call".

Example

const id = `call_${nanoid()}`;

await saveMessage(ctx, components.agent, {
  agentName: ctx.agent?.options.name,
  promptMessageId: ctx.messageId,
  threadId: ctx.threadId,
  message: {
    role: "tool",
    content: [{
      type: "tool-call", // ❌ Currently not supported
      toolName: tool,
      toolCallId: id,
      args: args,
    }]
  }
})

When tool calls are long-running, it’s useful to display them in the UI as pending or in-progress.
Right now, there’s no way to persist that intermediate “tool call started” state, only the “tool result” state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions