Skip to content

Open Source · Pre-GA · Apache 2.0

Build, host, and
orchestrate tool-using
AI agents.

Agentrail gives you a composable runtime, a hosted server layer, multi-agent orchestration, and a clear extension model — without locking you into any platform.

agent.ts
import { defineAgent } from "@agentrail/runtime-core";
import { createWebSearchTool } from "@agentrail/tools";

export const researchAgent = defineAgent({
  name: "researcher",
  model: {
    provider: "anthropic",
    modelId: "claude-opus-4-5",
    apiKey: process.env.ANTHROPIC_API_KEY,
  },
  systemPrompt: "You are a research assistant.",
  tools: [createWebSearchTool()],
});

// stream a response
const result = await researchAgent.stream(
  "What are the latest advances in agentic AI?",
);

The right level of abstraction.

Most teams land between two extremes — scripts that break at scale and platforms that make you dependent. Agentrail is designed to sit in between.

Too little structure

Ad hoc scripts

  • No session management
  • Tool contracts are implicit
  • Orchestration is bespoke every time
  • Testing is painful
  • Hard to extend without rewriting

Too much lock-in

Hosted platforms

  • Opaque internals
  • Metered billing surprises
  • Limited extensibility
  • Vendor controls your data
  • GUI-first, not code-first

Everything you need to ship agents.

A focused set of packages — each with a clear responsibility, each independently usable.

@agentrail/runtime-core

Agent Runtime

Define agents with typed tool contracts. The LLM loop, tool dispatch, provider abstractions, and usage tracking — all in one stable core.

@agentrail/host

Host Layer

Chat and stream request lifecycles, profile resolution, session context assembly, and a plugin system for cross-cutting behavior.

@agentrail/orchestration

Multi-Agent Orchestration

Spawn sub-agents, send typed work, wait on conditions, and recover from failures. Persistent state across restarts via JSONL-backed mailboxes.

@agentrail/prompts

Prompt SDK

Compose system prompts from versioned fragments and bundles. File-based prompt authoring with hot-reload and variable interpolation.

@agentrail/memo

Session Memory

Filesystem-backed session storage with append-only JSONL history, automatic context compaction, and conversation branching.

@agentrail/sandbox

Sandboxed Execution

Docker-based isolated execution environment. Browser automation, shell commands, and file I/O — all safely contained per session.

Get started in minutes.

npm install @agentrail/runtime-core
Read the quickstart →

Layered by design.

Start with the opinionated SDK, then drop to lower-level primitives only when you need tighter control.

4Your App
ProfilesRoutesUIBusiness Logic
↓ depends on
3Plugins & Workflows
plugin-user-memoryslash-commandsdeep-research
↓ depends on
2Host & host/defaults
consumes →
@agentrail/prompts@agentrail/orchestration@agentrail/memo@agentrail/knowledge@agentrail/sandbox@agentrail/tools@agentrail/events@agentrail/skills
↓ depends on
1runtime-corefoundation
Agent LoopTool ContractLLM Provider APIUsage Tracking

Released under the Apache 2.0 License.