Skip to content

[FEATURE] Applying ConversationManager during the Agent Loop Execution (on specific Hook Events) #509

@fvisticot

Description

@fvisticot

Problem Statement

Is there a way to reduce the number of messages before the end of the agent execution (during the loop execution) ?
In my use case (WebBrowser navigation), Agent is executing a lot of operations with tools (screenshots) and the number of messages is growing fast and Agent loop is becoming very slow.

I have tried to call the apply_management method in the AfterInvocationEvent Hook but it does not work

def log_after_model_invocation(self, event: AfterInvocationEvent) -> None:
        logger.info(f"----->Request log_after_model_invocation for agent: {len(event.agent.messages)}")
        event.agent.conversation_manager.apply_management(event.agent)

Proposed Solution

No response

Use Case

In my use case (WebBrowser navigation), Agent is executing a lot of operations with tools (screenshots) and the number of messages is growing fast and Agent loop is becoming slow.

Alternatives Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions