AI Infrastructure2025Open Source

Gen AI Toolkit

Provider-agnostic tool calling and structured output framework

Lightweight, production-grade toolkit for building generative AI applications with unified tool calling, structured outputs, and provider abstraction across OpenAI, Anthropic, Gemini, and local Ollama models.

TypeScriptLLM APIsJSON SchemaStreamingTool Calling

Visual evidence

System visualization

Modular glowing nodes and connector buses representing a unified multi-provider AI interface

Case study

Problem, Build, Outcome

Problem

Every LLM provider has divergent tool calling formats, schema definitions, and streaming protocols, forcing teams into vendor lock-in or fragile wrapper code.

Build

Engineered an extensible TypeScript toolkit that normalizes tool execution, schema definition, retries, and output streaming into a single predictable interface.

Outcome

Enables developers to swap models from cloud providers to local instances with zero downstream code changes, with full type safety.

Architecture

System Flow

1App code
2Unified Agent API
3Provider adapter
4Model & tool loop

Architecture Notes

  • Adapter pattern decouples application logic from provider-specific wire protocols.
  • Schema normalizer converts standard JSON Schema to provider-native tool definitions.
  • Execution loop manages multi-step tool calls with recursion limits and error recovery.

Engineering choices

Technical Decisions

Designed around standard Web Fetch and Streams APIs for runtime portability across Node.js, Bun, and edge environments.

Implemented strict tool execution timeouts and cancellation tokens to prevent runaway agent loops.

Separated tool declaration from tool execution for safe sandboxing and permission gating.

Evidence

Proof Points

Unified tool-calling abstraction across 4 provider families

Zero-dependency core runtime with optional provider adapters

Comprehensive test coverage including streaming and timeout failure modes

Next read

Related Deep Dives