Skip to content

Migrate ConversationManager to call apply_management via hooks #1392

@zastrowm

Description

@zastrowm

In PR#1374, we implemented the ability for conversation-managers to register hooks, so that they can apply conversation management in more places.

Long term this also unlocks the ability to be more losely coupled from the agent-loop - specifically, the base ConversationManager class could register callbacks so that apply_management and reduce_context are invoked via hooks instead of being hard-coded in the agent-loop.

Also, what is the story for transitioning from "manual" conversation management, meaning conversation_manager.apply_management, to using only hooks.

Originally posted by @dbschmigelski in #1374 (comment)

To do this, we'd need to do two things:

  1. Allow hooks to intercept model (ContextOverflow) exceptions and retry model invocation

  2. Update ConversationManager to subscribe to (2) and apply_management that way

For backwards compatability, we would still need to expose apply_management and reduce_context as public methods, but we could still decouple it from the agent-loop.

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