Testkube AI Architecture
This document provides a high-level overview of the architecture powering Testkube's AI capabilities, including the AI Assistant, AI Agents, and AI Agent Triggers. Understanding this architecture helps you leverage these features effectively and understand their capabilities and limitations.
Overview
Testkube's AI features are built on a modern agentic AI architecture that combines:
- Large Language Models (LLMs) for natural language understanding and generation
- LangGraph for agent orchestration, checkpointing, and stateful conversation management
- Model Context Protocol (MCP) for tool integration and extensibility
- Human-in-the-Loop (HITL) controls for safe execution of sensitive operations
- Event-driven triggers for automated agent execution on workflow events
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ Testkube Dashboard │
│ │
│ ┌─── AI Assistant ───────┐ ┌─── AI Agent Chats ────┐ ┌─── AI Agent Triggers ──────────┐ │
│ │ (Overlay/Dock) │ │ (Chat Panel) │ │ (Integrations Panel) │ │
│ └───────────┬────────────┘ └───────────┬───────────┘ └──────────────┬─────────────────┘ │
└──────────────┼───────────────────────────┼─────────────────────────────┼────────────────────┘
└─────────────┬─────────────┘ │
▼ ▼
┌────────────────────────────────────────────┐ ┌──────────────────────────────────────────┐
│ Testkube Control Plane │ │ Worker Service │
│ (Cloud API / Enterprise) │ │ (NATS JetStream Consumer) │
│ │ │ │
│ Session metadata, Agents, MCP Servers, │ │ Execution finished events → │
│ Triggers, OAuth tokens │ │ AI Trigger Handler → │
│ │ │ Session creation + AI Service run │
└───────────────────┬────────────────────────┘ └──────────────────────┬───────────────────┘
▲ │ │
session │ │ JWT auth API token│auth
metadata │ │ │
updates │ ▼ │
┌─────────┴──────────────────────────────────────────────────────────────┴────────────────────┐
│ AI Service │
│ │
│ ┌─── AGENTIC LOOP (LangGraph) ─────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ ┌─── Session ────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ New Chat ──▶ Load Tools ──▶ Build Prompt ──▶ Resolve Model ──▶ Run Agent │ │ │
│ │ │ Status: pending → running → completed | waiting_approval │ │ │
│ │ └────────────────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌─── Prompt Assembly ───────────────────────────────────────────────────────────┐ │ │
│ │ │ Base System Prompt ──▶ + Agent Instructions ──▶ + Runtime Context │ │ │
│ │ └───────────────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌─── Runtime Loop ─────────────────────────────────────────────────────────────┐ │ │
│ │ │ │ │ │
│ │ │ ┌───────┐ ┌───────────┐ ┌─────────────────────┐ ┌──────────┐ │ │ │
│ │ │ │ │ │ │ yes │ Execute tool │ │ │ │ │ │
│ │ │ │ LLM │────▶│ HITL Gate │────▶│ │───▶│ Response │ │ │ │
│ │ │ │ │ │ │ └─────────────────────┘ │ │ │ │ │
│ │ │ └───▲───┘ └─────┬─────┘ └──────────┘ │ │ │
│ │ │ │ │ no │ │ │
│ │ │ │ ▼ │ │ │
│ │ │ │ ┌──────────────────────────────────────────────┐ │ │ │
│ │ │ │ │ Pause → User: ✓ Approve ✎ Edit ✗ Reject │ │ │ │
│ │ │ │ └─────────────────────┬────────────────────────┘ │ │ │
│ │ │ └───────────────────────────────┘ │ │ │
│ │ │ (loop until done) │ │ │
│ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │ │
│ │ ┌─── Checkpointing ────────────────────────────────────────────────────────────┐ │ │
│ │ │ Full state persisted per session: messages, tool results, pending approvals │ │ │
│ │ │ Sessions survive restarts and can be resumed at any point │ │ │
│ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─── TOOL LAYER ───────────────────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ ┌─── Testkube MCP (via Bridge) ─────────────────────────────────────────────────┐ │ │
│ │ │ Workflows Executions Artifacts Metadata │ │ │
│ │ │ List, Create, List, Fetch List, Read, Labels, Agents, │ │ │
│ │ │ Update, Run Logs, Abort Download Dashboard URLs │ │ │
│ │ │ │ │ │
│ │ │ Read-only → auto-approved Mutations → approval required │ │ │
│ │ └───────────────────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ ┌─── Built-in Tools ───────┐ ┌─── External MCP Servers (User-Configured) ───────┐ │ │
│ │ │ │ │ │ │ │
│ │ │ Documentation Search │ │ GitHub, Jira, Slack, custom servers, ... │ │ │
│ │ │ YAML Examples Search │ │ │ │ │
│ │ │ Task Tracking │ │ Auth: OAuth (managed token refresh) │ │ │
│ │ │ │ │ Header (static credentials) │ │ │
│ │ └──────────────────────────┘ └──────────────────────────────────────────────────┘ │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────────────────────┘ │