v0.1.0 — Now on npm

The Agent SDK that sits
in the middle

TypeScript-first SDK for building production-grade AI agents. Tools, memory, guardrails, handoffs, and tracing — composable by design.

Quick Start View on GitHub Documentation
$ npm install mitm-ai
Why MITM

Everything you need.
Nothing you don't.

Most AI SDKs give you too much magic or too little control. MITM sits in the middle — every part is a plain interface you can swap, extend, or ignore.

10
Core Features
0
Framework Lock-in
100%
TypeScript
MIT
License
Features

Built for production agents

Tools & Validation

Define typed tools with JSON input schemas. Automatic validation, retries, and per-tool timeouts built in.

Memory & Sessions

Multi-turn conversations with pluggable adapters. In-memory, file-based, or any database with a 3-method interface.

Guardrails

Input, output, and tool-level guardrails. Block, modify, or pass through at every layer. Safe by default.

Agent Handoffs

Delegate tasks between specialized agents. Context is preserved. Loop detection is automatic.

Tracing

Full run traces: step timing, token usage, tool calls, handoffs, errors. One call to get everything.

Provider Abstraction

OpenAI built in. Swap to any LLM with a 2-method interface. Works with OpenRouter, Groq, Gemini, local models.

From zero to running agent in under a minute

Install the package, set an API key, define your tools, and build your agent. The SDK handles the loop, tool dispatch, error recovery, and tracing.

Full Guide npm package
import { Agent, OpenAIProvider } from "mitm-ai";

const agent = Agent.builder()
  .setName("myAgent")
  .setProvider(new OpenAIProvider())
  .setInstructions("You are helpful.")
  .tool(myTool)
  .setMemory(new FileAdapter(), "user-1")
  .addInputGuardrail(safetyCheck)
  .setTimeout(30_000)
  .build();

agent.on("step", (e) =>
  console.log(e.step, e.content)
);

const result = await agent.run("Build hello.py");
const trace = agent.getLastTrace();
Open Source

Built in public. Free forever.

MIT licensed. Read the source, contribute, or fork it.

Read the Docs Star on GitHub View on npm