Skip to content

[FEATURE] Resume Session from ToolUse #1111

@Unshure

Description

@Unshure

Problem Statement

Today, if an agent session is interrupted with the latest message being a toolUse, then the session is essentially unrecoverable. This is because the recovery mechanism is unintuitive and we never direct users on how to recover a session in this case agent().

Proposed Solution

We allow the resumption of an agent with toolUse as the latest message by adding a toolResult error message to the agent. This will be a default behavior built into the existing conversation managers of strands, which will allow users to override this behavior if they decide to.

To do this, we will register conversation managers as hook providers on agents, and on the agentInvoke hook, we will fire this management code.

We will also need to scan the agent.messages and insert a toolResult wherever there is one missing.

Use Case

Agent session interrupted during a session where the latest message is a ToolUse.

Alternatives Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions