AI Session and Tool Calls

AI Session and Tool Calls A sequence diagram generated by Archify. Describe the ops intent POST /api/v1/ai/chat (SSE) Resume after interrupt: POST /api/v1/ai/continue Context + tool definitions Tool call (get/list/exec/mutate) AuthorizeToolForUser Maps to the current user's own KubeOsprey RBAC permissions Allow / deny Confirmation card for mutating tools request_choice / request_form interaction Continue after user confirms Execute tool K8sClient call Result · sensitive fields redacted SSE streamed reply + ResourceHistory User · Ops question · Sequence participant User Ops question AI chat · ai-chat component · Sequence participant AI chat ai-chat component LLM provider · Anthropic / OpenAI · Sequence participant LLM provider Anthropic / OpenAI Agent loop · pkg/ai · Sequence participant Agent loop pkg/ai Authorization · AuthorizeToolForUser · Sequence participant Authorization AuthorizeToolForUser Tool execution · ClientSet · Sequence participant Tool execution ClientSet Kubernetes API · Target cluster · Sequence participant Kubernetes API Target cluster Legend request return security async trace default message

Session channel

  • • POST /api/v1/ai/chat opens an SSE stream
  • • Resume via /api/v1/ai/continue after an interrupt

Permissions and confirmation

  • • Tool authorization maps to the user's own RBAC
  • • Mutating tools require human confirmation

Execution and audit trail

  • • Executes against K8s through the cluster ClientSet
  • • Result is redacted and written to ResourceHistory