Skip to content

Expose Update Agent API #3820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jiapingzeng
Copy link

@jiapingzeng jiapingzeng commented May 1, 2025

Description

Exposes Agent Update API

Related Issues

Resolves #3748 #2172

Check List

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.

@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 1, 2025 02:48 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 1, 2025 02:48 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 1, 2025 02:48 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 1, 2025 02:48 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng marked this pull request as ready for review May 1, 2025 03:09
Copy link

codecov bot commented May 1, 2025

Codecov Report

Attention: Patch coverage is 90.11858% with 25 lines in your changes missing coverage. Please review.

Project coverage is 78.10%. Comparing base (c3b1fd6) to head (ef442c0).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../ml/common/transport/agent/MLAgentUpdateInput.java 90.51% 5 Missing and 8 partials ⚠️
...h/ml/action/agents/UpdateAgentTransportAction.java 84.00% 7 Missing and 5 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3820      +/-   ##
============================================
+ Coverage     77.98%   78.10%   +0.12%     
- Complexity     7316     7386      +70     
============================================
  Files           655      660       +5     
  Lines         33037    33290     +253     
  Branches       3708     3741      +33     
============================================
+ Hits          25764    26002     +238     
- Misses         5688     5692       +4     
- Partials       1585     1596      +11     
Flag Coverage Δ
ml-commons 78.10% <90.11%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 1, 2025 13:48 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 1, 2025 13:48 — with GitHub Actions Inactive
Signed-off-by: Jiaping Zeng <[email protected]>
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 7, 2025 20:06 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 7, 2025 20:06 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 7, 2025 20:06 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 7, 2025 20:07 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 7, 2025 21:11 — with GitHub Actions Inactive
@dhrubo-os dhrubo-os had a problem deploying to ml-commons-cicd-env-require-approval May 8, 2025 18:24 — with GitHub Actions Error
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 9, 2025 00:59 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 9, 2025 00:59 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 9, 2025 00:59 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 9, 2025 00:59 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 9, 2025 18:28 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 9, 2025 18:28 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 9, 2025 18:28 — with GitHub Actions Waiting
@dhrubo-os dhrubo-os requested a deployment to ml-commons-cicd-env-require-approval May 9, 2025 18:28 — with GitHub Actions Waiting
@nathaliellenaa
Copy link
Contributor

@jiapingzeng Are users allowed to update all fields within an agent, or are there any restrictions?

@jiapingzeng
Copy link
Author

jiapingzeng commented May 13, 2025

@jiapingzeng Are users allowed to update all fields within an agent, or are there any restrictions?

Users can update all fields within an agent. However the request body must be a valid MLAgent similar to the Create Agent API, so for example users cannot update from a flow agent to a conversational agent without providing the additional llm field.

@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 13, 2025 00:21 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 13, 2025 00:21 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng had a problem deploying to ml-commons-cicd-env-require-approval May 13, 2025 00:21 — with GitHub Actions Error
@jiapingzeng jiapingzeng had a problem deploying to ml-commons-cicd-env-require-approval May 13, 2025 00:21 — with GitHub Actions Failure
@jngz-es
Copy link
Collaborator

jngz-es commented May 13, 2025

Users can update all fields within an agent. However the request body must be a valid MLAgent similar to the Create Agent API, so for example users cannot update from a flow agent to a conversational agent without providing the additional llm field.

Hmm, this is more like a new agent creation. Regarding update agent, I think some fields like agent type should keep unchanged, as agents look much different in terms of different type and we also don't allow updating function_name for update model API, as models look way different according to different function name.

@dhrubo-os
Copy link
Collaborator

We have hidden agent, which admin/any other user can't update. So we need to check that condition. Please check update model api and you will get the idea

@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 13, 2025 01:26 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 13, 2025 01:26 — with GitHub Actions Inactive
@jiapingzeng
Copy link
Author

We have hidden agent, which admin/any other user can't update. So we need to check that condition. #

I am making a GET call first to check on the existing agent, if it is a hidden agent, a 403 will be returned for non-superadmins

if (retrievedAgent.getIsHidden() && !isSuperAdmin) {
wrappedListener
.onFailure(
new OpenSearchStatusException(
"User does not have privilege to perform this operation on this agent",
RestStatus.FORBIDDEN
)
);
} else {
updateAgent(agentId, mlAgent, wrappedListener);
}

Signed-off-by: Jiaping Zeng <[email protected]>
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 15, 2025 03:49 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 15, 2025 03:49 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng had a problem deploying to ml-commons-cicd-env-require-approval May 15, 2025 03:49 — with GitHub Actions Failure
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval May 15, 2025 03:49 — with GitHub Actions Inactive
@jiapingzeng
Copy link
Author

Hmm, this is more like a new agent creation. Regarding update agent, I think some fields like agent type should keep unchanged, as agents look much different in terms of different type and we also don't allow updating function_name for update model API, as models look way different according to different function name.

@jngz-es I decoupled the request input from MLAgent so that agent type cannot be changed anymore. Are there any other fields we would want to exclude from update?

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.

[FEATURE] expose agent update API
4 participants