Skip to content

Introduction

@witqq/agent-sdk is a TypeScript abstraction layer for building AI agent applications. It provides a unified interface across four AI backends:

  • Copilot CLI — GitHub Copilot’s CLI-based agent runtime
  • Claude CLI — Anthropic’s Claude CLI-based agent runtime
  • Vercel AI — API-based backend via Vercel AI SDK
  • Mock LLM — Deterministic backend for automated testing

CLI backends (Copilot, Claude) spawn a CLI subprocess that drives the tool loop. The CLI decides when to call tools and when to respond. You provide tool definitions and the SDK handles communication.

API backends (Vercel AI) make HTTP calls to model providers. The SDK drives the tool loop via generateText() / streamText(). You have more control but manage the conversation loop yourself.

Mock LLM extends BaseAgent like real backends. It participates in the full lifecycle — retry, heartbeat, activity timeout, middleware, and usage enrichment. No API keys needed.

Your App
└── IAgentService (createAgentService / createMockLLMService)
└── IAgent (run, stream, runStructured, abort, dispose, …)
└── BaseAgent (shared logic)
└── Backend-specific execution

Every backend implements IAgentService — its createAgent() method produces IAgent instances. IAgent exposes run(), stream(), and runStructured(). The BaseAgent abstract class provides shared functionality — state management, usage tracking, middleware pipeline.

AreaWhat You Get
Backends4 backends with identical IAgentService / IAgent interfaces
ToolsType-safe tool definitions with Zod schemas, permission scoping
Streaming15 typed event types via AsyncIterable<AgentEvent>
AuthBackend-specific auth helpers, token refresh
StorageSQLite-based chat storage, provider config management
TestingMock LLM backend, mock factories, test utilities
Chat UIReact components for chat interfaces (separate entry point)