Unigent

Build stateful agent workflows with typed outputs, reusable tools, session forks, and ordinary TypeScript.

LLM Mart
1 views 12k listing impressions

Build stateful agent workflows with typed outputs, reusable tools, session forks, and ordinary TypeScript.

npm version License: MIT GitHub stars Works with Pi SDK Claude CLI Codex CLI

Examples


Why Unigent?

The agent CLIs you already have installed — Pi, Claude Code, Codex — are powerful, but each has its own API, its own session model, and no way to get a typed value back. Unigent puts one TypeScript surface over all of them.

  • 🔀 One API, every harness. Write your workflow once against Pi, Claude Code, or Codex CLI. Swap the backend with a one-line change; the agent, tools, sessions, and structured outputs stay the same.
  • 🧠 Deterministic host, fuzzy agent. Orchestration — control flow, branching, parallelism, recursion — lives in your TypeScript, where it is testable and reviewable. The model is invoked only for genuinely fuzzy work: judgment and language.
  • 📦 Typed structured outputs, never scraped from prose. Ask a run for a Zod (or any Standard Schema) value and get back the inferred TypeScript type through a reserved completion tool. Markdown preambles and trailing commentary cannot corrupt the value.
  • 🧩 Agents are ordinary functions. A tool is a named function; a nested agent is a function that calls .run(). Composition, error handling, and testing are plain async/await and try/catch — no new runtime to learn.
  • 🌳 Built for real workflows. Sessions keep conversation context, forks branch it in parallel, scopes group runs with budgets and deadlines, and checkpoints reuse finished work across reruns.
  • 🔍 See everything that happened. Every run returns a full trace — nested runs, tool calls, prompts, usage, cost — and the unigent tui inspector renders the live run tree as it happens.

Quickstart

Prerequisites: Node.js 24 or newer, plus at least one authenticated harness: Pi configured locally, or the official Claude Code / Codex CLIs installed and signed in. The live trace inspector (unigent tui) additionally requires Bun. Published packages are ESM-only.

npm install unigent-sdk zod
npm install -g unigent-cli

Write your first agent:

import { agent, piAgent } from "unigent-sdk";

const writer = agent({
  name: "writer",
  backend: piAgent(),
  model: "openrouter/deepseek/deepseek-v4-flash",
});

const result = await writer.run("Write one sentence about durable software.");
console.log(result.output);

result also contains token usage, any cost reported by the harness, and the full trace. The run starts immediately, can be aborted, and exposes its events as an async iterable while you await the final result.

Run it through the CLI to get live traces:

unigent your-script.ts "your prompt"
unigent tui your-script.ts "your prompt"   # live trace inspector

From the project's README.

Comments (0)

Sign in to join the conversation.

No comments yet.

Related tools