Skip to main content
Version: Next

AI Copilot

The Hub ships an optional AI Copilot: a chat assistant, backed by any OpenAI-compatible API, that can inspect the fleet and draft configuration changes. It is proposal-only: the Copilot never executes a mutation directly — everything it produces arrives as a proposal card that a human applies.

Use when: you want help composing stream configs or Job specs, or a natural-language entry point into fleet diagnostics. Skip it when your policy forbids sending fleet metadata to an external LLM — it is disabled by default and only runs when configured.

Safety model​

  • Proposal-only. Tool calls that produce configuration return a validated proposal (stream_config or job_spec) rendered as a card in the console; applying it is a separate, human-confirmed action that follows the normal configuration/rollout path — including the approval gate when enabled.
  • RBAC-scoped tools. The tool list is filtered by the caller's principal: a viewer cannot ask the Copilot for something a viewer cannot see. Tool execution re-checks RBAC/scopes server-side; the model cannot escalate.
  • Redaction before upstream calls. Config fragments sent to the LLM are structurally redacted — literal credentials and URL passwords are masked, Bearer tokens stripped, while ${secret:...} / ${env:...} / ${file:...} placeholders are preserved intact.
  • No mutation tools. The Copilot can read components, schemas, nodes, and diagnostics, and can validate drafts. It has no tool that starts, stops, or writes anything.

Configuration​

The Copilot is Hub-only and disabled by default. Configure it in the startup file's ai: section or with ARKFLOW_AI_* environment variables (CLI reference):

KeyEnvDefaultMeaning
enabledARKFLOW_AI_ENABLEDfalseMaster switch.
api_baseARKFLOW_AI_API_BASE—OpenAI-compatible base URL.
modelARKFLOW_AI_MODEL—Model name.
api_keyARKFLOW_AI_API_KEY—Bearer key; supports ${secret:} references in the file.
timeout_msARKFLOW_AI_TIMEOUT_MS90000Upstream request timeout.
max_tool_roundsARKFLOW_AI_MAX_TOOL_ROUNDS8Tool-call loop bound per request.
max_tokensARKFLOW_AI_MAX_TOKENS4096Completion token cap.
requests_per_minuteARKFLOW_AI_REQUESTS_PER_MINUTE20Per-principal chat rate limit.
burstARKFLOW_AI_BURST5Rate-limit burst.

Example startup-file section:

address: 127.0.0.1:8080
ai:
enabled: true
api_base: https://api.openai.com/v1
model: gpt-4o-mini
api_key: "${secret:OPENAI_API_KEY:-}"
timeout_ms: 45000
max_tool_rounds: 6

Limits enforced in addition to the config: at most 40 chat messages and 65,536 characters per request; tool outputs truncated; the upstream error body capped at 64 KiB.

What it can do​

  • Browse the component catalog and fetch a component's schema and example.
  • Inspect nodes, jobs, streams, events, and operational status (read-only).
  • Validate a drafted config through the same deep validation as --validate.
  • Emit proposal cards: a validated stream config, a validated Job spec, or a diagnostic action linking to the right console route with parameters.

Audit and observability​

  • AI chat requests and the proposals they produced are part of the normal audit trail; identity writes and configuration applies remain actor-attributed human actions.
  • Per-principal rate limiting applies on top of the general rate limits.
  • Upstream provider failures surface as ai_provider_error responses; the Copilot degrades to "unavailable" and never blocks control-plane operation.

Verify​

  1. Start the Hub with ai.enabled: true and a reachable api_base.
  2. Open the console Copilot panel; ask it to describe a component — expect a schema-backed answer.
  3. Ask it to draft a config; expect a proposal card marked validated, not an applied change.
  4. With approval_required on, apply the proposal and confirm it routes through approval.

Rollback​

Set ARKFLOW_AI_ENABLED=false (or remove the ai: section) and restart the Hub. The panel disappears; no other behavior changes.