Skip to content

Conversation

@mingshl
Copy link
Collaborator

@mingshl mingshl commented Nov 18, 2025

Description

Introduce hook and context management to OpenSearch Agents

This is the same PR from #4388 to merge in 3.4 Feature Branch

Related Issues

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.

Zhangxunmt and others added 13 commits November 18, 2025 11:54
…project#4345)

* initiate context management api with hook implementation

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

* apply spotless

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

---------

Signed-off-by: Mingshi Liu <[email protected]>
* add pre_llm hook to per agent

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]>

* add comment

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

* format

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

* add validation

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

---------

Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: Mingshi Liu <[email protected]>
Signed-off-by: Mingshi Liu <[email protected]>
…ing in index (opensearch-project#4403)

* allow inline create context management without storing in agent register

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

* make ML_COMMONS_MULTI_TENANCY_ENABLED default is false

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

---------

Signed-off-by: Mingshi Liu <[email protected]>
…roject#4408)

* Fix POST_TOOL hook interaction updates and add tenant ID support
Signed-off-by: Mingshi Liu <[email protected]>

- Fix POST_TOOL hook to return full ContextManagerContext like PRE_LLM hook
- Update MLChatAgentRunner to properly handle interaction updates from POST_TOOL hook
- Ensure interactions list and tmpParameters.INTERACTIONS stay synchronized
- Add tenant ID support to MLPredictionTaskRequest in ModelGuardrail and SummarizationManager

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

* fix error message escaping

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

* consolicate post_hook logic

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

---------

Signed-off-by: Mingshi Liu <[email protected]>
@mingshl mingshl merged commit f4ac35c into opensearch-project:feature/3.4-release-prep Nov 18, 2025
8 of 16 checks passed
@Hailong-am Hailong-am mentioned this pull request Nov 25, 2025
5 tasks
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.

2 participants