Module wik_agent

Module wik_agent 

Source
Expand description

Key-management agent — WIK (Waldiez Intelligence Keys).

Manages LLM provider credentials, monitors API errors, and automatically fails over to the next-priority provider when the active one hits errors or rate limits. Also tracks per-provider usage counts for WIF integration.

NATO node: kilo (K → Keys)

§Failover behaviour

WIK listens on system/llm/error. After error_threshold consecutive errors from the active provider it publishes system/llm/switch with the next-priority provider config, which LlmAgent / MainActor applies live.

Default threshold: 3 consecutive errors (configurable via set threshold).

§Usage (via IO bar)

@wik-agent status                               → all providers + active
@wik-agent add anthropic <key> [model]          → register/update
@wik-agent add gemini <key> [model]             → register fallback
@wik-agent add openai <key> [model]             → register (⚠ warnings shown)
@wik-agent priority anthropic gemini openai     → set fallback order
@wik-agent switch gemini [reason]               → manually activate
@wik-agent test [provider]                      → ping provider API
@wik-agent usage                                → call + error counts
@wik-agent rotate <provider>                    → flag for key rotation
@wik-agent set threshold <n>                    → errors before failover (default 3)
@wik-agent help

Structs§

WikAgent