← All Plugins/platform.aiHybrid (Python + Go)
AI-Agent-First Documentation
Raw .md/SKILL.md
Prompt your Agent: "Set up `valstorm-plugin-ai` using my Gemini API Key `<YOUR_GEMINI_API_KEY>`. Save the encrypted credentials via `platform.ai.save_credentials(...)`, verify connection via `ai_verify_connection`, and list the discovered cross-plugin AI tools."

valstorm-plugin-ai — Hybrid Valstorm AI Gateway, Agent Chat, Tool Bridge & Working Memory Plugin (FI-473)

Hybrid (Python + Go) AI plugin for Open Valstorm, mounted at platform.ai (VALSTORM_PLUGINS=ai or *).

Provides:

  1. LLM Gateway & Native Gemini Pass-Through (gateway_service.py):
  • OpenAI-compatible POST /v1/ai/chat/completions & POST /v1/ai/prompt (including SSE streaming).
  • Native Gemini pass-through POST /v1/ai/gemini/{api_version}/models/{model_method:path} (preserves thought signatures, function calls, and streaming for apps/agent-runtime).
  • Model Registry (GET /v1/ai/models — resolves gemini-flash-latest -> gemini-3.8-flash and maps reasoning_effort to Gemini thinking levels).
  • Audio transcription (POST /v1/ai/audio/transcribe) and meeting transcript synthesis (POST /v1/ai/recording/summarize).
  1. Agent Chat, Dynamic Cross-Plugin Tool Bridge & Runtime Proxy (agent_chat_service.py):
  • POST /v1/ai/agent/chat, POST /v1/ai/agent/confirm, POST /v1/ai/agent/cancel.
  • GET /v1/ai/tools & GET /v1/ai/agent/{agent_id}/tools — dynamically aggregates core PlatformContext tools + every enabled plugin's ai_tools (plugin_registry.get_ai_tools()) + tenant custom Python function tools.
  • Cloud & Desktop Agent Runtime health and SSE run proxy (/v1/ai/agent/runtime/status, /v1/ai/agent/runtime/run, /v1/ai/agent/runtime/run/{run_id}/events).
  1. Sub-10ms Go Desktop Sync (plugins/valstorm-plugin-ai/go/):
  • POST /v1/ai/chat/{chat_id}/desktop-sync backed by Native Go PlatformContext (ai_chat aich_, ai_message aim_) with atomic Redis SetNX deduplication and real-time WebSocket broadcast.
  1. Chief of Staff Working Memory (working_memory_service.py):
  • GET /v1/ai/memory/working-context, POST /v1/ai/memory/pin-asset, POST /v1/ai/memory/fact, DELETE /v1/ai/memory/fact (user_ai_memory uaim_).

🤖 Agent-Assisted Quick Setup (Let the Valstorm Agent Set It Up)

You only need a Google Gemini API Key (GEMINI_API_KEY from aistudio.google.com) or Vertex AI Service Account credentials. Your Valstorm AI Agent can save your encrypted AI credentials, verify the model registry (gemini-3.8-flash), and confirm cross-plugin tool discovery across all installed plugins.

Copy-Paste Prompt for Your Valstorm Agent

Drop this prompt into Valstorm Chat:

"Set up valstorm-plugin-ai using my Gemini API Key <YOUR_GEMINI_API_KEY>. Save the encrypted credentials via platform.ai.save_credentials(...), verify connection via ai_verify_connection, and list the discovered cross-plugin AI tools."


🛠️ End-to-End DIY Setup Guide (Manual)

python
await platform.ai.save_credentials(
    gemini_api_key="AIzaSy...",
    default_model="gemini-flash-latest",
    default_thinking_level="high",
)

# Verify active models and cross-plugin tool discovery
status = await platform.ai.verify_connection()
tools = platform.ai.get_all_tools()

Running Tests (Python & Go)

bash
# Run Python unit & route tests (including cross-plugin tool discovery)
cd apps/open-api
.venv/bin/pytest tests/test_plugin_ai.py -v

# Run Go sub-10ms desktop-sync race tests
cd ../../plugins/valstorm-plugin-ai/go
go test -race -v ./...