Giselle AI Agent Studio

repository·main·Indexed 20 days ago

https://github.com/giselles-ai/giselle

An open-source AI agent studio for building, composing, and managing agentic workflows through human-AI collaboration. Features include visual builders, multi-model support, knowledge stores, and a document preprocessor package for PDF text extraction and image rendering.

Tokens
65.8K
Snippets
223
Records
385
Agent score
68%

What's inside Giselle

  1. Overview of Giselle features

    main

    Giselle is an AI agent studio designed for agentic workflows and human-AI collaboration. Key features include:

    • GitHub AI Operations: Automates issues, PRs, and deployments.
    • Visual Agent Builder: Drag-and-drop interface for creating and modifying agents.
    • Multi-Model Composition: Uses multiple models (GPT, Claude, Gemini, etc.) to select the best model for specific tasks.
    • Knowledge Store: Centralized access to code and data, with GitHub vector store integration.
    • Team Collaboration (In Development): Shared configurations and contextual awareness for teams.
    • Template Hub (In Development): Community-contributed agent templates.
  2. Estimate token counts with @giselles-ai/pseudo-tiktoken

    main

    Use @giselles-ai/pseudo-tiktoken to get approximate token counts for text. This is a lightweight, TypeScript-only implementation designed to estimate counts for models like gpt-4o-mini without the overhead of WASM or the actual tiktoken library.

    Important: This is a pseudo-implementation for estimation purposes (e.g., UI displays, safe context length management, or input truncation). It is not a complete replacement for tiktoken and may have a relative error of approximately ±25%. It is intentionally designed to slightly overestimate counts to ensure safety in context length management.

    import { countTokens } from "@giselles-ai/pseudo-tiktoken";
    
    const text = "Hello, world! This is a test.";
    const tokenCount = countTokens(text);
    console.log(`Token count: ${tokenCount}`);
  3. Implement a Vault for managing secrets in GiselleEngine

    main

    Giselle uses a Vault system to securely manage sensitive information like Personal Access Tokens (PATs) or LLM API keys. The Vault provides encrypt and decrypt capabilities and is integrated into the GiselleEngine via a driver-based architecture.

    To use a Vault, you must provide a Vault implementation (created via createVault using a VaultDriver) when initializing the engine.

    Note: Decryption is a server-side only operation. The client-side API only exposes encryption methods.

    import { createVault, VaultDriver } from '@giselles-ai/giselle-engine';
    
    // Define or import a driver
    const myDriver: VaultDriver = { /* implementation */ };
    
    // Create the vault instance
    const vault = createVault(myDriver);
    
    // Pass to the engine
    const engine = NextGiselleEngine({
      vault,
      // other config...
    });
  4. Abort long-running document processing

    main

    All public APIs in this package accept an optional signal property in their options object. This allows you to pass an AbortSignal to cancel ongoing text extraction or image rendering, which is critical for managing resource-intensive ingestion flows.

    const abortController = new AbortController();
    setTimeout(() => abortController.abort("timeout"), 5_000);
    
    await extractPdfText(data, {
      signal: abortController.signal,
      pdfiumWasmBinary,
    });
  5. Understand the terminology for Trigger.dev processes

    main
    When working with processes intended for execution via trigger.dev within this project, note a terminology shift to avoid name collisions. While trigger.dev natively defines processes as "tasks", Giselle also uses the term "task" for its own essential elements. To prevent confusion, all trigger.dev processes are referred to as jobs within the Giselle ecosystem.
  6. How the pseudo-tokenizer works

    main

    The tokenizer follows a three-step process to estimate tokens:

    1. Whitespace normalization: Converts newlines, tabs, and consecutive spaces into single spaces.
    2. Lexical splitting:
      • Whitespace: Ignored and not counted as tokens.
      • Punctuation: Each punctuation character is treated as 1 token.
      • English words: Alphanumeric words (including apostrophes) are split into subwords.
      • Other characters: Characters like emojis or CJK are treated as 1 token each.
    3. Subword splitting: Long English words are split using common suffix patterns (e.g., tokenizationtoken + ization) or fixed-size chunks.
  7. Understand the migration directory structure

    main

    The project separates system-level Supabase configurations from application-level database schemas using two distinct directories:

    • migrations/system/: Contains .sql files for Supabase system schema migrations (e.g., auth, storage). These are managed manually.
    • migrations/schema/: Contains application schema migrations, which are managed by Drizzle.
    migrations/
      system/             # Supabase system schema migrations
        *.sql            # SQL migration files
      schema/            # Application schema migrations (managed by Drizzle)
  8. Distinguish between `runId` and `flowRunId`

    main

    Giselle uses two distinct identifier types to separate execution tracing from persistent storage. Understanding which to use is critical for debugging, querying, and managing flow data.

    runId (Execution Context)

    • Prefix: rn- (e.g., rn-1a2b3c4d5e6f7g8h)
    • Purpose: Tracks the ephemeral execution context for tracing and generation origin.
    • Characteristics: Not stored in the database; used to link generated content back to its source execution and for debugging/analytics.
    • When to use:
      • Tracking execution context.
      • Linking generations to their source.
      • Debugging flow execution.
      • Passing execution context through the pipeline.

    flowRunId (Flow Instance)

    • Prefix: flrn- (e.g., flrn-9z8y7x6w5v4u3t2s)
    • Purpose: Uniquely identifies a persistent flow run instance.
    • Characteristics: Stored in the database with indexing; serves as the primary key for flow run objects; used in file system paths and API management endpoints.
    • When to use:
      • Storing flow run data.
      • Querying flow run status.
      • Managing flow runs via API.
      • Building UI components for flow control.
      • Creating storage paths.
  9. Best practices for styling with semantic tokens

    main

    When styling components in Giselle, follow these migration and maintenance rules:

    1. Avoid raw colors: Do not use hex codes or raw color primitives directly in your styles. Always prefer semantic tokens and utilities.
    2. Use the v3 bridge: Continue using the v3 bridge in aliases.css.
    3. Minimize aliases: Only add new aliases in aliases.css when absolutely necessary during the migration process.
  10. Understand the Design Token architecture

    main

    Giselle uses a layered CSS architecture for design tokens to manage colors and styles. The system is organized into four distinct layers that must be loaded in a specific order to ensure correct overrides and compatibility.

    Layer Hierarchy and Load Order

    1. Tokens (internal-packages/ui/styles/tokens.css): Defines primitives using Tailwind v4 @theme (e.g., gray, brand, status) and temporary compatibility tokens.
    2. Semantic (internal-packages/ui/styles/semantic.css): Maps semantic tokens (e.g., text, bg, border, focused) to the primitives defined in the tokens layer.
    3. Scopes (internal-packages/ui/styles/scopes/*.css): Provides optional overrides for specific contexts.
    4. Aliases (internal-packages/ui/styles/aliases.css): Thin v3-compatibility utilities used during migration (to be phased out).

    Correct Load Order: tokenssemanticscopes (if needed) → aliases.

  11. Giselle Email Style Guide v1

    main

    Marketing emails should follow the principle: "Brand experience as an extension of product experience".

    Visual System

    ElementRecommended Style
    Background#0B0F1A (dark) + white container
    Spacing32px top/bottom / 24px inner padding
    LogoGiselle logo at top center (32–40px)
    Title (H1)font-size: 24px; font-weight: 600;
    Subtitlefont-size: 16px; color: var(--color-text-muted)
    CTA Buttonbackground: var(--color-accent-blue); border-radius: 8px; padding: 14px 28px;
    Body Textfont-size: 15px; line-height: 1.6; (Inter, sans-serif)
    Footerfont-size: 13px; color: #9CA3AF;

    Messaging Guidelines

    CategoryToneDark BackgroundCTA Examples
    OnboardingFriendly × Guided✅ YesGet Started / Explore Docs
    Product UpdatesProfessional × Confident⚪ YesView Updates / Try It
    CampaignsBright × Community✅ YesJoin Event / Learn More
    ReactivationWarm × Personal⚪ ShortReturn to Giselle
    SpecialReflective × Thankful✅ YesView Story / Celebrate

    Content Best Practices

    • Single Purpose: Convey only one purpose per email (no multiple CTAs).
    • Length: Keep content within one screen (approx. 400–500px).
    • Emojis: Use a maximum of 1–2 emojis.
    • Tone: Use experiential action verbs like "Build," "Explore," "Collaborate," or "Orchestrate."
    • Footer: All marketing emails must include a common footer containing the footer logo, product/blog/doc links, social icons, copyright, and the explanation text: "You received this email because you signed up for Giselle—a platform for building AI agents."