Skip to content

How It Works

Zubbl uses a dual learning loop to continuously improve your AI agents.


The Dual Loop

graph TB
    subgraph "Loop 1: Trajectory Learning"
        A[Agent executes task] --> B[SDK records trajectory]
        B --> C[Patterns extracted & scored]
        C --> D[Policies updated]
        D --> E[Better recommendations next time]
    end

    subgraph "Loop 2: Reflexion"
        F[Agent fails] --> G[LLM analyzes failure]
        G --> H[Generates fix strategy]
        H --> I[Retries with insight]
        I --> J{Success?}
        J -->|Yes| K[Learn recovery pattern]
        J -->|No| L[Escalate to human]
    end

    E --> A
    K --> C

Loop 1 — Trajectory Learning

Every time your agent runs a task, the SDK records the full trajectory: what steps it took, which tools it used, how long it took, and whether it succeeded. These trajectories are analyzed to extract patterns — what works for which types of tasks. Over time, when you call query(), you get recommendations based on what has historically worked best.

Loop 2 — Reflexion

When an agent fails, instead of just logging the error, the SDK triggers an LLM-powered analysis of what went wrong. It generates a fix strategy and retries the task with that insight in-context. ~33% of failures are recovered on the first retry.


SDK Integration

sequenceDiagram
    participant App as Your App
    participant SDK as Zubbl SDK
    participant API as Zubbl API

    App->>SDK: start_trajectory("code review")
    SDK->>SDK: Begin recording

    App->>SDK: record_step("scan", "semgrep", ...)
    App->>SDK: record_step("fix", "code_gen", ...)

    App->>SDK: end_trajectory(SUCCESS)
    SDK->>API: POST /ingest (trajectory)
    API-->>SDK: accepted + queued for learning

    Note over API: Pattern extraction runs async

    App->>SDK: query("code_review")
    SDK->>API: GET /query?task=code_review
    API-->>SDK: Recommended strategies
    SDK-->>App: Use these patterns

What Gets Stored

Data Purpose Retention
Trajectories Steps, tools, outcomes 90 days
Patterns Extracted strategies with scores Permanent
Policies Recommended actions per task type Updated continuously
Feedback Human/automated ratings Permanent

All data is tenant-isolated — your data is never shared with other tenants or used to train models for other users.


Security

  • Encryption: All data encrypted in transit (TLS 1.3) and at rest
  • Authentication: API key-based authentication
  • Rate Limiting: Per-tenant rate limiting on all endpoints
  • Tenant Isolation: Full data isolation across all tenants