Welcome to AgentLIB
AgentLIB is a type-safe, composable AI agent framework for Node.js. Build production-ready AI agents with pluggable reasoning engines, memory providers, tool calling, middleware, and full observability — all with a clean, fluent TypeScript API.Quick Example
Here’s a simple weather agent in under 20 lines:Get Started
Quickstart
Build your first agent in 5 minutes
Core Concepts
Learn about agents, tools, memory, and reasoning
API Reference
Explore the complete API documentation
Examples
Browse working examples and use cases
Key Features
Fluent Builder API
Chain configuration methods for a clean, readable agent setup:Type-Safe Throughout
Full generics for agent state (AgentInstance<TData>) and typed tool arguments:
Pluggable Reasoning Engines
Swap reasoning strategies without changing agent code:ReAct
Tool-using agents with Thought → Action → Observation loops
Chain of Thought
Step-by-step reasoning for complex math and logic
Planner
Multi-step task decomposition and execution
Reflect
Self-critique and revision for accuracy-critical tasks
Autonomous
Long-horizon open-ended task execution
Custom
Implement the
ReasoningEngine interfacePersistent Memory
Multiple strategies for conversation history management:- BufferMemory — Keep last N messages in memory
- SlidingWindowMemory — Token-aware eviction
- SummarizingMemory — Compress old context with LLM
- CompositeMemory — Chain providers together
Middleware System
Intercept any lifecycle event for logging, rate limiting, or custom logic:run:before, run:after, step:before, step:after, tool:before, tool:after
Event Emitter
Lightweight pub/sub for observability:Session Support
Multi-user memory isolation viasessionId:
Policy Enforcement
Stop runs before hitting cost or safety limits:Architecture
AgentLIB is built as a modular monorepo with focused packages:| Package | Description |
|---|---|
@agentlib/core | Core runtime — Agent, types, tool system, events, middleware |
@agentlib/openai | OpenAI model provider (GPT-4o, o1, o3-mini, any OpenAI-compatible API) |
@agentlib/memory | Memory providers — Buffer, SlidingWindow, Summarizing, Composite |
@agentlib/reasoning | Reasoning engines — ReAct, Planner, CoT, Reflect, Autonomous |
@agentlib/logger | Structured logging middleware with timing and custom transports |
All packages require Node.js 18.0.0 or higher and are fully compatible with TypeScript 5.4+.
Next Steps
Installation
Install AgentLIB and set up your environment
Quickstart Guide
Build your first agent step-by-step