feat(client): add kai-agent backend support — new endpoints and approval flow#39
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds kai-agent backend support to kai-client by introducing new client methods, response models, and tests for the new endpoint groups (approval side-channel, usage, settings, tools, suggestions), while marking legacy Vercel AI SDK v6 approval helpers as deprecated in docstrings.
Changes:
- Added
KaiClient.submit_approval()for the new non-streamingPOST /api/chat/{id}/approvalflow, plus new client methods for usage, settings, tools, and suggestions endpoints. - Introduced new Pydantic response models for the added endpoints and exported them from
kai_client. - Added a comprehensive set of tests covering the new endpoints and request payloads/headers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/kai_client/client.py |
Adds new public client methods for kai-agent endpoints and updates legacy approval method docstrings with deprecation notices. |
src/kai_client/models.py |
Adds new response/settings/tool/suggestion models to parse kai-agent backend responses. |
src/kai_client/__init__.py |
Exports the new models from the package public API. |
tests/test_client.py |
Adds tests validating new endpoints, payload serialization, auth headers, and error handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Connects the client to the new kai-agent backend by adding methods for
all new endpoints and replacing the v6 approval protocol with the
dedicated POST /api/chat/{id}/approval side-channel.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4080d51 to
b2bf2fe
Compare
kai-agent sends output: "denied" (string) when a tool approval is rejected; the previous dict-only type caused a pydantic ValidationError. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jordanrburger
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release Notes
submit_approval()method using the new dedicatedPOST /api/chat/{id}/approvalendpoint — replaces the complex Vercel AI SDK v6 approval protocolget_usage()to retrieve rate-limit usage (messages used, limit, reset date)get_settings()/update_settings()for project-level custom instructionsget_user_settings()/update_user_settings()for user-level custom instructions and tool permissionsget_tools()to list available MCP tools with read-only flagsget_suggestions()for AI-generated contextual suggestions (dashboard, job-detail, configuration-detail)approve_tool,reject_tool,send_tool_approval_response,send_tool_result,confirm_tool,deny_tool,resume_stream) — they are incompatible with the new backendPlans for customer communication
None.
Impact analysis
KaiClient: 8 new public methods added — fully backwards-compatible, no existing API changedmodels.py: 8 new response models (ApprovalResponse,UsageResponse,AgentSettings,UserAgentSettings,ToolInfo,ToolsListResponse,Suggestion,SuggestionsResponse) — all exported from__init__.pysubmit_approval()is a non-streamingPOSTthat unblocks the live SSE stream still connected fromsend_message(), matching the kai-agent backend's in-memory approval store designChange type
Feature — Connect kai-client to the new kai-agent backend
Justification
The kai-agent backend (
keboola/uiapps/kai-agent) is a new Hono-based server replacing the old Vercel AI SDK v6 backend. It exposes several new endpoint groups (usage, settings, suggestions) and uses a fundamentally different tool approval mechanism: instead of re-POSTing a mutated assistant message, callers now submit approval decisions via a dedicated side-channel endpoint while the original SSE stream stays connected and resumes automatically.Deployment
Merge & automatic deploy.
Rollback plan
Revert of this PR.
Post release support plan
None.