Cobbl

SDK Overview

The official TypeScript/JavaScript SDK for Cobbl

The Cobbl SDK provides a simple, type-safe way to integrate your applications with the Cobbl platform.

Features

🚀
Simple API
Run prompts and collect feedback with just a few lines of code.
🔒
Type-safe
Full TypeScript support with comprehensive type definitions.
🎯
Framework Agnostic
Works with Node.js, Next.js, Express, and any JavaScript framework.
📦
Zero Config
Works out of the box with sensible defaults.
🌐
Cross-platform
Supports CommonJS, ES modules, and CDN script tags.
Optimized
Minimal bundle size, tree-shakeable exports.

Two Client Types

The SDK provides two specialized clients for different use cases:

Quick Comparison

FeatureCobblAdminClientCobblPublicClient
Use caseServer-sideClient-side
AuthenticationAPI key requiredNone required
Running prompts
Submitting feedback
Safe for browsers

Quick Example

import { CobblAdminClient } from '@cobbl-ai/sdk'
import { CobblPublicClient } from '@cobbl-ai/sdk'

// Server-side: Run a prompt
const adminClient = new CobblAdminClient({
  apiKey: process.env.COBBL_API_KEY,
})

const result = await adminClient.runPrompt('customer_email', {
  customerName: 'John Doe',
  issue: 'login_problem',
  urgency: 'high',
})

console.log(result.output)
// => "Dear John Doe, We understand you're experiencing login issues..."

// Client-side: Collect feedback
const publicClient = new CobblPublicClient()

await publicClient.createFeedback({
  runId: result.runId,
  helpful: 'helpful',
  userFeedback: 'Perfect response!',
})

Next Steps

On this page