Skip to content

Conversation

@mingshl
Copy link
Collaborator

@mingshl mingshl commented Oct 30, 2025

Description

Add Context Manager to PER,

for planner agent, I added in a PRE_LLM hook, and for executor agent, which is a conversational agent, it would use the same PRE_LLM hook and POST_TOOL hook for conversational runner.

Related Issues

Add Context Manager to PER

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@mingshl mingshl changed the base branch from main to feature/context_manager_hooks October 30, 2025 08:31
Signed-off-by: Mingshi Liu <[email protected]>

change context management passing from query parameters to payload

Signed-off-by: Mingshi Liu <[email protected]>

pass hook registery into PER

Signed-off-by: Mingshi Liu <[email protected]>

apply spotless

Signed-off-by: Mingshi Liu <[email protected]>

initiate context management api with hook implementation

Signed-off-by: Mingshi Liu <[email protected]>
@mingshl mingshl force-pushed the context_manager_feature_per branch from 86a3623 to 67ad592 Compare October 30, 2025 20:00
@mingshl mingshl had a problem deploying to ml-commons-cicd-env October 30, 2025 20:03 — with GitHub Actions Failure
@mingshl mingshl had a problem deploying to ml-commons-cicd-env October 30, 2025 20:03 — with GitHub Actions Failure
@mingshl mingshl changed the title Add Context Manager Add Context Manager to PER Oct 30, 2025
Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: Mingshi Liu <[email protected]>
@mingshl mingshl had a problem deploying to ml-commons-cicd-env October 30, 2025 23:12 — with GitHub Actions Failure
@mingshl mingshl had a problem deploying to ml-commons-cicd-env October 30, 2025 23:12 — with GitHub Actions Failure
private static final int DEFAULT_PRESERVE_RECENT_MESSAGES = 10;
private static final String DEFAULT_SUMMARIZATION_PROMPT =
"You are a tool interactions summarization agent. Summarize the provided tool interactions concisely while preserving key information and context.";
"You are a interactions summarization agent. Summarize the provided interactions concisely while preserving key information and context.";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the expected prompt to not include Tool-Specific Details? I think this would cause some Verbose Summaries.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we now use summarization manager for two sub agents in PER. for planner, summarization manager summarizes the completed steps, and for the executor, summarization manager summarizes the tool used results. So I try to make the prompt general to summarize interactions.

@mingshl
Copy link
Collaborator Author

mingshl commented Oct 31, 2025

CI failed not related to code changes

> Task :opensearch-ml-plugin:test

Tests with failures:
 - org.opensearch.ml.action.execute.ExecuteITTests.testExecuteLocalSampleCalculator
 - org.opensearch.ml.action.prediction.PredictionITTests.testPredictionWithoutDataset_KMeans
 - org.opensearch.ml.action.prediction.PredictionITTests.testPredictionWithDataFrame_FitRCF
 - org.opensearch.ml.action.prediction.PredictionITTests.testPredictionWithSearchInput_LogisticRegression
 - org.opensearch.ml.action.prediction.PredictionITTests.testPredictionWithDataFrame_BatchRCF
 - org.opensearch.ml.action.prediction.PredictionITTests.testPredictionWithDataFrame_LinearRegression
 - org.opensearch.ml.action.trainpredict.TrainAndPredictITTests.testTrainAndPredictWithEmptyDataset_KMeans
 - org.opensearch.ml.action.trainpredict.TrainAndPredictITTests.testTrainAndPredict_BatchRCF
 - org.opensearch.ml.action.models.SearchModelITTests.test_all

> Task :opensearch-ml-plugin:test FAILED

Signed-off-by: Mingshi Liu <[email protected]>
@mingshl mingshl merged commit f588a24 into opensearch-project:feature/context_manager_hooks Oct 31, 2025
5 checks passed
@mingshl mingshl had a problem deploying to ml-commons-cicd-env October 31, 2025 19:10 — with GitHub Actions Failure
@mingshl mingshl had a problem deploying to ml-commons-cicd-env October 31, 2025 19:10 — with GitHub Actions Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants