Core overview
@lite-agent/core is the pluggable, event-driven agent kernel of lite-agent: a lean, provider-agnostic core built from swappable strategy interfaces, an onion middleware pipeline, and a typed event stream. Use it when you want to assemble your own agent from primitives — full control over the model, the tools, the persistence, and every layer in between — without forking a framework. Its public API is shaped after @anthropic-ai/claude-agent-sdk, but the kernel is self-built, so it can also drive local small models via pluggable tool-call codecs.
Getting started
fakeProvider is a built-in test double. For a real model, pass a ModelProvider — see Providers.
The design in three words
Everything in the kernel is one of three ideas:
- Strategy — a swappable part, one implementation per role, resolved at agent construction. There are nine:
ModelProvider,ToolCallCodec,Tool,Compactor,PermissionPolicy,ApprovalHandler,InputHandler,Store,Sandbox. Swap, don't fork. See Strategies. - Middleware — an added layer around the loop. Lifecycle hooks plus two wrappers (
wrapModelCall,wrapToolCall) fold into the classic onion; permissions and compaction are just middleware, not kernel code. See Middleware. - Event — a typed
AgentEventstream observes everything the loop does. Events are observational, never control flow. See Events.
The loop that ties them together — encode → call → decode → execute → feed back — is documented in The kernel.
Core vs. SDK
The core knows nothing about permissions, compaction, or sessions by default — those are strategies and middleware you plug in. @lite-agent/sdk is the batteries-included composition of this same kernel: built-in tools, skills, subagents, sessions, and permission gating, with the ContextEngine enabled out of the box. Reach for the core when the SDK's defaults don't fit — an in-house inference gateway, a bespoke tool-call protocol, a custom persistence backend — and you want to wire the primitives yourself.
See also
- The kernel — the turn loop, step by step, and drain semantics.
- Strategies — the nine swappable roles.
- Middleware — the onion model and built-in layers.
- Events — the full
AgentEventreference. - SDK overview — the batteries-included agent built on this core.