Build provider-agnostic AI agents and workflows in TypeScript.
Anvia is a TypeScript runtime for agents, tools, structured extraction, retrieval, pipelines, and observability inside your application code.
It gives teams more structure than raw model calls without forcing a heavyweight orchestration stack. You bring the product, data, permissions, persistence, deployment, and side effects. Anvia gives you typed AI workflow primitives that fit around them.
- Provider-neutral clients for OpenAI-compatible APIs, Anthropic, Gemini, and Mistral.
- Agent and tool APIs that keep application behavior explicit and typed.
- Structured extraction and output schemas for turning model responses into usable data.
- Pipeline primitives for composing functions, agents, extractors, batches, and parallel branches.
- Retrieval adapters for in-memory search, local embeddings, ChromaDB, Qdrant, and pgvector.
- Optional Studio, MCP, local skills, Langfuse, and OpenTelemetry integrations.
Install the core runtime and a provider adapter:
pnpm add @anvia/core @anvia/openaiCreate a provider client, build an agent, and run it from your app:
import { AgentBuilder } from "@anvia/core";
import { OpenAIClient } from "@anvia/openai";
const client = new OpenAIClient({ apiKey });
const model = client.completionModel("gpt-5.5");
const supportAgent = new AgentBuilder("support", model)
.instructions("Answer support questions clearly. Ask for missing details.")
.build();
const response = await supportAgent
.prompt("A customer cannot reset their password. What should I check first?")
.send();
console.log(response.output);Use the same runtime shape with other providers:
pnpm add @anvia/anthropic @anvia/gemini @anvia/mistralAnvia clients take explicit constructor values and do not read environment variables on their own, so credentials stay in your existing configuration layer.
Anvia includes @anvia/studio, a local browser UI for inspecting and running agents, tools, sessions, traces, pipelines, memory, status, and knowledge during development. Add one line to serve any agent in Studio:
new Studio([agent]).start({ port: 4021 });
Preview of Anvia Studio from packages/tools/studio.
| Capability | Use it for |
|---|---|
| Agents | Promptable workflows with instructions, context, tools, hooks, history, streaming, and typed outputs. |
| Tools | Safe, typed access to application-owned actions such as lookup, search, mutation, approval, or dispatch. |
| Extractors | Schema-shaped data from text, tickets, documents, messages, and model responses. |
| Pipelines | Explicit multi-step workflows that combine functions, agents, extraction, branching, and batching. |
| Retrieval | Embeddings, vector search, document context, metadata filters, and RAG workflows. |
| Observability | Run, generation, tool, usage, trace, and eval events for production visibility. |
| Studio | A local browser UI for inspecting agents, sessions, traces, pipelines, tools, approvals, and knowledge. |
The cookbook is the fastest way to see Anvia in motion. It walks from a first text call through tools, structured output, providers, multimodal inputs, pipelines, retrieval, multi-agent workflows, evals, Studio, and integrations.
Run the first example from the repository root:
pnpm install
pnpm cookbook:basics:01Run Studio locally:
pnpm cookbook:studio:01MIT