@smooai/smooth-operator-core
v0.20.4
Published
Native TypeScript implementation of the smooth-operator agent engine — an in-process, OpenAI-compatible agentic tool-calling loop with knowledge grounding. The TypeScript sibling of the Rust reference engine, the C# core, and the Python core.
Readme
The TypeScript sibling of the Rust reference engine. Agents, tools, knowledge/RAG, memory, checkpointing, human-in-the-loop, cost budgets, and workflows — as one embeddable npm package. It's the engine, not a notebook demo.
@smooai/smooth-operator-core is the native TypeScript implementation of the Smoo AI agent engine — the in-process observe→think→act loop that powers lom.smoo.ai. It's a sibling of the Rust reference engine and one of the polyglot set (Rust, TypeScript, Python, Go, C#/.NET) whose behavior is held at parity by a shared eval suite.
It's a library, not a client to a remote server: it is the agent, running in your Node process. Every surface is covered by fast, offline tests built on a deterministic MockLlmProvider, so the loop is verified — not vibe-coded.
Install
npm install @smooai/smooth-operator-coreQuickstart
A complete agent — no credentials needed — using the deterministic mock provider the engine's own tests run on:
import { SmoothAgent, MockLlmProvider } from '@smooai/smooth-operator-core';
const provider = new MockLlmProvider().pushText('the answer is 42');
const agent = new SmoothAgent(provider, { instructions: 'You are a helpful assistant' });
const response = await agent.run('what is the answer?');
console.log(response.text);SmoothAgent's constructor takes a ChatClientLike (the MockLlmProvider implements it — swap in any OpenAI-compatible client) and an AgentOptions object. run returns an AgentRunResponse whose text is the final answer.
Features
The full parity surface — every engine in the polyglot set ships it:
- Agentic tool-calling loop — observe→think→act, looping until the model answers.
- Typed tools — register
Tools the model can call, with parallel dispatch. - Knowledge / RAG + vectors —
InMemoryKnowledge/VectorKnowledgeground the turn in retrieved documents. - Memory —
InMemoryMemoryrecalls long-term entries into context each turn. - Compaction — a sliding-window token budget keeps the prompt under a ceiling.
- Cost / budget —
CostTracker+CostBudgetwith per-model pricing and early stop. - Checkpointing —
InMemoryCheckpointStore(and theCheckpointStoreseam) persist/resume a conversation. - Rerank —
LexicalRerankerreranks retrieved hits before injection. - Sub-agents / delegation —
delegateToolspawns child agents for sub-tasks. - Cast + clearance —
Cast,Clearance,makeRolefor per-role tool-access policy. - Human-in-the-loop gate —
HumanGaterequires approval before designated tool calls run. - Conversation thread —
SmoothAgentThreadcarries a conversation across multipleruncalls. LlmProviderseam +MockLlmProvider— inject any OpenAI-compatible client; the record/replay mock drives the offline tests.- Deferred tools +
tool_search—ToolSearchhides rarely-used tool schemas behind a meta-tool the model calls to promote the ones it needs. - Typed workflow graph —
Workflowwith typed nodes/edges, alongside the agent loop. - Parallel tool calls — dispatch ≥2 tool calls concurrently (transcript order preserved).
- Retry / backoff — retry transient model-call failures with exponential backoff.
- Streaming — stream incremental text, tool calls, and tool results as the turn runs.
Streaming
runStream is an async generator over a StreamEvent tagged union (discriminated on type): text deltas as the model produces them, each tool_call before dispatch, each tool_result after it finishes, and a terminal done event carrying the same response run would have returned.
for await (const event of agent.runStream('what is the answer?')) {
if (event.type === 'text') process.stdout.write(event.text);
if (event.type === 'done') console.log(`\n${event.response.text}`);
}runStream requires a streaming-capable client (chat.completions.createStream); the MockLlmProvider supplies one, replaying the same script as the non-streaming path.
Part of Smoo AI
smooth-operator-core is built and open-sourced by Smoo AI — the AI-powered business platform with AI built into every product: CRM, customer support, campaigns, field service, observability, and developer tools.
- 🚀 Smooth on the platform — smoo.ai/th
- 🧰 More open source from Smoo AI — smoo.ai/open-source
- 🧩 Run it hosted — lom.smoo.ai
Links
- lom.smoo.ai — run it hosted
- smooth-operator-core — the polyglot engine repo
- Polyglot Engines — install + hello-agent in all five languages
- smoo.ai — the product · smoo.ai/open-source — more open source
License
MIT — see LICENSE.
