Skip to main content

Overview

The ICRL TypeScript package includes demo-ready examples that run with real API calls. These demonstrate the Agent, custom environments, and storage adapters. Run them from the icrl-ts directory.

Prerequisites

From the monorepo root:
cd icrl-ts
bun install
Required environment variables depend on the demo:
DemoRequiredOptional
OpenAIOPENAI_API_KEY
AnthropicANTHROPIC_API_KEY
Support TriageOPENAI_API_KEY
Incident ResponseANTHROPIC_API_KEY
Web/ConvexOPENAI_API_KEY, NEXT_PUBLIC_CONVEX_URLICRL_CONVEX_DATABASE_ID

Run All Core Demos

cd icrl-ts
bun run examples:run
Runs: OpenAI, Anthropic, Support Triage, Incident Response.

Run Individual Demos

cd icrl-ts

bun run example:openai       # Basic Agent with OpenAIProvider
bun run example:anthropic    # Basic Agent with AnthropicProvider
bun run example:support      # Customer support triage automation
bun run example:incident     # Incident response playbook
bun run example:web         # Convex storage integration

Run All (Including Web)

cd icrl-ts
bun run examples:run:all
Includes the web-convex demo, which requires NEXT_PUBLIC_CONVEX_URL from a running Convex backend (e.g., web-example).

Demo Index

FileUse Case
examples/openai-demo.tsBasic end-to-end Agent training with OpenAIProvider + OpenAIEmbedder
examples/anthropic-demo.tsBasic end-to-end Agent training with AnthropicProvider
examples/support-triage-demo.tsCustomer support triage: routing + structured reply (billing/shipping/technical)
examples/incident-response-demo.tsOn-call incident first-response playbook (severity, owner, first_action)
examples/web-convex-demo.tsUses web-example’s ConvexAdapter for persistent storage

OpenAI Demo

Minimal Agent run with OpenAI:
bun run example:openai
Uses MathEnvironment (trivial add-two-numbers task), OpenAIProvider, OpenAIEmbedder, and FileSystemAdapter for storage.

Anthropic Demo

Same structure with Claude:
bun run example:anthropic
Uses AnthropicProvider and FileSystemAdapter.

Support Triage Demo

Customer support ticket routing and reply generation:
  • Environment: SupportTicketEnvironment — routes to billing/shipping/technical based on content
  • Success: Requires priority, team, and reply (≥ 40 chars) in the action
  • Use case: Automating support triage with learned routing patterns

Incident Response Demo

On-call incident first-response playbook:
  • Environment: IncidentEnvironment — assigns owner (payments/backend/data) based on incident type
  • Success: Requires severity, owner, and first_action in the action
  • Use case: Standardizing incident response with learned playbooks

Web/Convex Demo

Integrates with the web-example Convex backend:
  • Storage: ConvexAdapter — trajectories live in Convex, same as the Next.js web demo
  • Setup: Run web-example and set NEXT_PUBLIC_CONVEX_URL, or use a standalone Convex deployment
  • Optional: ICRL_CONVEX_DATABASE_ID — if omitted, a demo database is created automatically