Next-generation open-source AI agent development framework and runtime platform
下一代开源 AI 智能体开发框架与运行时平台
Event-driven Runtime · Multi-provider LLM · RoleX Integration · TypeScript First
Build an AI agent in a few lines of TypeScript:
import { createAgentX } from "agentxjs";
import { nodePlatform } from "@agentxjs/node-platform";
import { createMonoDriver } from "@agentxjs/mono-driver";
const createDriver = (config) => createMonoDriver({
...config,
apiKey: process.env.ANTHROPIC_API_KEY,
provider: "anthropic",
});
const platform = await nodePlatform({ createDriver }).resolve();
const ax = createAgentX({ platform, createDriver });
// Create a conversation and chat
const agent = await ax.chat.create({
name: "My Assistant",
embody: { systemPrompt: "You are a helpful assistant." },
});
ax.on("text_delta", (e) => process.stdout.write(e.data.text));
await agent.send("Hello!");Expose your agent as a WebSocket server:
const ax = createAgentX({ platform, createDriver });
const server = await ax.serve({ port: 5200 });Connect to a running AgentX server:
import { createAgentX } from "agentxjs";
const ax = createAgentX();
const client = await ax.connect("ws://localhost:5200");
// Same API as local mode
const agent = await client.chat.create({ name: "My Assistant" });
await agent.send("Hello!");Interactive terminal chat:
cd apps/cli
cp .env.example .env.local # Set DEEPRACTICE_API_KEY
bun run devAgentX uses a layered concept model inspired by container runtimes:
Prototype (template) → Image (persistent) → Agent (runtime)
↓ ↓ ↓
Reusable definition Stored in DB Running in memory
Registered once Has session Has lifecycle
Like Dockerfile Like Docker image Like container
- Prototype — a reusable, registered agent definition (name, embody, etc.)
- Embodiment — runtime config for an agent's "body": model, system prompt, MCP servers
- Image — persistent record created from a prototype, with session and message history
- Chat — a conversation backed by an Image, accessed via
AgentHandle
ax.chat.* // Conversation management (create, list, get → AgentHandle)
ax.prototype.* // Prototype registry (create, list, get, update, delete)
ax.provider.* // LLM provider configuration
ax.runtime.* // Low-level subsystems (image, agent, session, container, prototype)Register a prototype once, create many conversations from it:
// Register a prototype
const proto = await ax.prototype.create({
containerId: "default",
name: "Code Reviewer",
embody: {
model: "claude-sonnet-4-6",
systemPrompt: "You are a code review assistant.",
},
});
// Create conversations from the prototype
const agent = await ax.chat.create({ prototypeId: proto.record.prototypeId });
await agent.send("Review this pull request...");| Package | Description |
|---|---|
| agentxjs | Client SDK — local, remote, and server modes |
| @agentxjs/core | Core abstractions — Container, Image, Session, Driver |
| @agentxjs/node-platform | Node.js platform — SQLite persistence, WebSocket |
| @agentxjs/mono-driver | Multi-provider LLM driver (Anthropic, OpenAI, Google, etc.) |
| @agentxjs/claude-driver | Claude-specific driver with extended features |
| @agentxjs/devtools | BDD testing tools — MockDriver, RecordingDriver, Fixtures |
MonoDriver supports multiple LLM providers via Vercel AI SDK:
- Anthropic (Claude) —
provider: "anthropic" - OpenAI (GPT) —
provider: "openai" - Google (Gemini) —
provider: "google" - DeepSeek —
provider: "deepseek" - Mistral —
provider: "mistral" - xAI (Grok) —
provider: "xai" - OpenAI-compatible —
provider: "openai-compatible"
MonoDriver integrates with RoleX for AI role management — identity, goals, knowledge, and cognitive growth cycles:
import { localPlatform } from "@rolexjs/local-platform";
const driver = createMonoDriver({
...config,
rolex: {
platform: localPlatform(),
roleId: "my-role",
},
});Event-driven architecture with layered design:
SERVER SIDE SYSTEMBUS CLIENT SIDE
═══════════════════════════════════════════════════════════════════════════
║
┌─────────────────┐ ║
│ Environment │ ║
│ • LLMProvider │ emit ║
│ • Sandbox │─────────────────>║
└─────────────────┘ ║
║
║
┌─────────────────┐ subscribe ║
│ Agent Layer │<─────────────────║
│ • AgentEngine │ ║
│ • Agent │ emit ║
│ │─────────────────>║ ┌─────────────────┐
│ 4-Layer Events │ ║ │ │
│ • Stream │ ║ broadcast │ WebSocket │
│ • State │ ║════════>│ (Event Stream) │
│ • Message │ ║<════════│ │
│ • Turn │ ║ input │ AgentX API │
└─────────────────┘ ║ └─────────────────┘
║
║
┌─────────────────┐ ║
│ Runtime Layer │ ║
│ │ emit ║
│ • Persistence │─────────────────>║
│ • Container │ ║
│ • WebSocket │<─────────────────╫
│ │─────────────────>║
└─────────────────┘ ║
║
[ Event Bus ]
[ RxJS Pub/Sub ]
Event Flow:
→ Input: Client → WebSocket → BUS → LLM Driver
← Output: Driver → BUS → AgentEngine → BUS → Client
AgentX is in active development. We welcome your ideas, feedback, and contributions!
Part of the Deepractice AI infrastructure:
- RoleX — AI role management system (identity, cognition, growth)
- ResourceX — Unified resource manager
- IssueX — Structured issue tracking for AI collaboration
Built with ❤️ by Deepractice
