Anvia

Introduction

Anvia is a TypeScript runtime for building provider-agnostic agents and SDK-owned AI workflows.

Anvia is a TypeScript SDK for building agents, tools, structured extraction, retrieval, pipelines, and observability inside your application code.

It is designed for teams that want more structure than raw model calls without giving up ownership of data, permissions, persistence, deployment, and side effects.

Core Primitives

PrimitiveWhat it doesStart here
ClientConfigures provider access, credentials, base URLs, and provider SDK wiringClients and Models
ModelProvides a reusable completion or embedding capabilityClients and Models
AgentRuns prompts with instructions, context, tools, hooks, turn limits, and output schemasAgent Builder
ToolExposes typed application-owned behavior to agentsCreating Tools
ExtractorConverts unstructured text into schema-shaped dataExtractors
PipelineComposes functions, agents, extractors, and parallel branchesPipeline Builder
Vector StoreStores and searches embedded documents for retrieval workflowsVector Stores
ObserverRecords runs, generations, tool calls, usage, and tracesObservers

The Basic Shape

Most Anvia workflows follow the same shape:

  1. Create a provider client.
  2. Create a reusable model.
  3. Build an agent around that model.
  4. Prompt the agent from application code.
  5. Add tools, history, context, structured output, retrieval, or tracing as the workflow grows.
import { AgentBuilder } from "@anvia/core";
import { OpenAIClient } from "@anvia/openai";

const client = new OpenAIClient({ apiKey });
const model = client.completionModel("gpt-5");

const agent = new AgentBuilder("support", model)
  .instructions("Answer support questions clearly and concisely.")
  .build();

const response = await agent.prompt("How do I reset my password?").send();

console.log(response.output);

Why Anvia

Anvia keeps the runtime small and explicit:

  • TypeScript-first APIs and Zod-backed validation
  • provider-agnostic model, message, tool, and streaming shapes
  • application-owned side effects through tools
  • clear boundaries between clients, models, agents, and requests
  • testable workflows that can use fake completion models
  • optional layers for MCP, skills, retrieval, tracing, and Studio

The SDK does not need to own your database, auth system, queue, retries, or deployment. Keep those in your product code and pass only the model capabilities, context, and tools a workflow needs.

Capabilities

CapabilityUse it whenDocs
AgentsYou need a promptable runtime with instructions, tools, context, and historyAgents
ToolsThe model needs to call application-owned behaviorTools
HistoryYou need multi-turn conversation stateMessages and History
Structured OutputYou need schema-shaped data instead of free-form textStructured Output
PipelinesYou need explicit workflow compositionPipelines
RetrievalYou need embeddings, vector search, or dynamic contextRetrieval
MCPYou need to connect Model Context Protocol serversMCP
StreamingYou need incremental text, tool, and final eventsStreaming Events
ObservabilityYou need run, generation, tool, usage, and trace eventsObservers

Where To Start

Choose the path that matches what you are building:

GoalFirst pageThen read
Run your first agentGetting StartedBuild an Agent
Understand the SDK shapeRuntime BoundariesClients and Models
Persist conversationsPersist ConversationsHistory
Add application actionsAdd ToolsTools on Agents
Return typed dataReturn Structured OutputAgent Output
Compose multi-step workflowsBuild a PipelineParallel Branches
Add retrievalAdd RetrievalRAG Context
Add tracesAdd ObservabilityTracing
Inspect agents locallyStudioRun Studio

Continue with Getting Started for a runnable first agent.