Man in
the Middle

TypeScript-first AI agent SDK. Tools, memory, guardrails, handoffs, and tracing built in.

Quick Start Documentation GitHub
$npm install mitm-ai
ToolsMemoryGuardrailsHandoffsTracingEventsRetriesTimeoutsProvidersStructured OutputLoop PreventionSessions ToolsMemoryGuardrailsHandoffsTracingEventsRetriesTimeoutsProvidersStructured OutputLoop PreventionSessions
Core Features

Everything an agent needs

Quick Start

Running in under a minute

Install, set a key, define tools, build the agent. The loop, dispatch, and tracing are handled.

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));

const result = await agent.run("Build hello.py");
const trace  = agent.getLastTrace();
// trace.durationMs  trace.tokenUsage
Why not the others

What MITM has that they don't

CapabilityMITM LangChainVercel AIOpenAI SDK
Tool guardrails
Full run tracing
Session persistence
Multi-agent handoffs
Stuck loop detection
No framework lock-in
Pluggable providers
TypeScript-first
Open Source · MIT

Start building today

Read the source, contribute, or ship.

Read the Docs Star on GitHub npm package