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/core";
import { defineProfile } from "@agentrail/app";

export const researchAgent = defineAgent({
  id: "researcher",
  model: {
    provider: "anthropic",
    modelId: "claude-sonnet-4-5",
    apiKey: process.env.ANTHROPIC_API_KEY,
  },
  system: "You are a research assistant.",
});

// 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 create lock-in. 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 has a clear responsibility and can be used independently.

@agentrail/core

Agent Runtime

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

@agentrail/capabilities

Capabilities

Sandboxed filesystem and browser tools, knowledge-base retrieval, skills registry, and multi-agent orchestration. They can be mounted with defineProfile({ capabilities: [...] }).

@agentrail/app

Host Layer

createAgentApp mounts chat and stream endpoints in one call. defineProfile wires model, prompt, and capabilities. Session management, plugins, slash commands, and typed config loading are included.

@agentrail/capabilities · orchestration

Multi-Agent Orchestration

Spawn sub-agents, send typed work, wait on conditions, and recover from failures. State can persist across restarts through JSONL-backed mailboxes.

@agentrail/app · SessionManager

Session Management

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

@agentrail/capabilities · sandbox

Sandboxed Execution

Docker-based isolated execution for browser automation, shell commands, and file I/O. Execution is contained per session.

Get started in minutes.

npx @agentrail/cli@latest create
Read the quickstart →

Layered by design.

Start with the recommended SDK path, then drop to lower-level primitives only when tighter control is needed.

4Your App
ProfilesRoutesUIBusiness Logic
↓ depends on
3@agentrail/app
createAgentAppdefineProfileSessionManagerPluginsSlash CommandsConfig
↓ depends on
2@agentrail/capabilities
includes →
filesystembrowserknowledgeskillsorchestrationtoolssandboxmemoryContext
↓ depends on
1@agentrail/corefoundation
Agent LoopTool ContractLLM Provider APIPrompt SDKSession Types