feat: add ProfilesClient.validateProfile for LLM pre-flight checks - #337
Conversation
Adds a typed ProfilesClient.validateProfile() that calls the agent-server
POST /api/profiles/{name}/validate endpoint, firing a minimal 1-token LLM
completion to catch misconfigurations (invalid model names, missing
provider prefixes, bad base URLs, invalid API keys) before a profile is
saved. The endpoint is client-ahead of the pinned agent-server release
(software-agent-sdk PR #4422), so it is allowlisted in the endpoint audit
with tracking.
Adds ValidateProfileError / ValidateProfileResponse models, exports them
from the package root, and covers the method with jest tests (success,
valid=false verdict, name encoding, 404 HttpError).
Co-authored-by: openhands <openhands@all-hands.dev>
Endpoint auditContract: pinned release artifact
Actionable client-only calls (0)none Actionable server-only operations (7)
Documented non-divergences (13)Client calls intentionally absent from the filtered contract (11)
Reason: Operational Agent Server endpoints intentionally excluded from the filtered public release artifact.
Reason: Client-ahead API stacked on the pending Agent Server meta-profiles implementation.
Reason: Client-ahead API stacked on the pending Agent Server pre-flight LLM validation endpoint. Server operations covered by an exposed browser URL (2)
Reason: RemoteWorkspace.startWorkspaceSession exposes these authenticated URLs for browser iframe and file requests; they are not HttpClient method calls. |
Switch ProfilesService.validateProfile() from a generic AgentServerClient request to the typed @openhands/typescript-client ProfilesClient method added for the agent-server pre-flight validation endpoint. Pin the client dependency to the git SHA carrying the new API; 404 from older agent-server versions is still treated as "no verdict". NOTE: dependency pin is temporary — agent-canvas policy requires a released @openhands/typescript-client version. Rebase onto the release once the client PR (OpenHands/typescript-client#337) publishes. Co-authored-by: openhands <openhands@all-hands.dev>
|
🚀 Released in v1.38.0. |
Why
The agent-server is adding a pre-flight LLM validation endpoint
(
POST /api/profiles/{name}/validate, software-agent-sdk PR #4422) soLLM misconfigurations can be caught before a profile is saved. Agent
Canvas (OpenHands/OpenHands#16417) needs a typed client method to call it
instead of a generic request.
Summary
ProfilesClient.validateProfile(name, request)→POST /api/profiles/{name}/validate.ValidateProfileResponse/ValidateProfileErrormodels exported from the package root.Issue Number
How to Test
npm ci npm run build npm run lint npm test -- --testPathPatterns=api-clientsUnit coverage: success verdict,
valid:falseerror verdict, namepercent-encoding, and 404 surfacing as
HttpError.Video/Screenshots
N/A — library API addition; no UI.
Type
Notes
software-agent-sdk PR #4422, which is not yet in a released agent-server
image. The endpoint audit is report-only for this client-ahead API.
@openhands/typescript-clientrelease is required beforedependent consumers can switch off the git-SHA pin.
This PR was created by an AI agent (OpenHands) on behalf of the user.