---
title: "AI SDK"
tagline: "Provider SDK"
language: "Go"
license: "MIT"
since: "2026"
canonical: "https://xraph.com/work/ai-sdk"
---

# AI SDK

One Go client across providers, with the parts you end up writing anyway included: structured output through generics and JSON Schema, tool discovery from function signatures, multi-tier memory, budget tracking, circuit breakers and retries. Still alpha, so the API moves.

## Install

```bash
go get github.com/xraph/ai-sdk
```

## What it is

A type-safe AI SDK for Go with a fluent builder API, aimed at high-throughput services rather than scripts. It is alpha, so the API still moves, and test coverage is above 81 per cent.

## What it includes

- Structured output using Go generics with JSON Schema validation.
- Token-by-token streaming, including reasoning steps.
- A RAG pipeline with semantic search and reranking.
- Multi-tier memory: working, short-term, long-term, episodic.
- Tool auto-discovery from Go function signatures.
- A DAG-based workflow engine.
- Prompt templates with versioning and A/B testing.
- Guardrails for PII, injection and toxicity.
- Cost management with budget tracking.
- Resilience: circuit breakers, retries, rate limiting.
- Tracing, profiling and debugging hooks.

## How it relates to the rest

The AI SDK came first, in January 2026, and is the ancestor of the split that followed. Nexus took the gateway concerns, Weave took RAG, Cortex took agents and memory, Shield took safety, Sentinel took evaluation. Each of those is better at its job than the corresponding subsystem here, because a library with one responsibility can be tested against that responsibility.

The SDK remains useful as a single dependency when you want one provider client and the batteries, and I keep it for that.

---

*Unpublished draft. Not peer reviewed and not submitted to a venue.*


## Anatomy

- **Providers**: One interface across model vendors.
- **Streaming**: Token streams normalised per provider.
- **Tools**: Function calling with typed arguments.

## Constraints and trade-offs

- (trade-off) One interface across providers means the newest provider-specific feature always arrives late.
