@lssm-tech/lib.ai-agent
Define AI agents in TypeScript, run them with deterministic tool calling, capture working memory, and route low-confidence decisions to human reviewers.
Explore the agent ecosystem
This page is the package API reference. For end-to-end guidance on multi-agent collaboration, governed self-improvement, durable runtimes, deployment, and production qualification, use the Agent Ecosystem guide.
Installation
bun add @lssm-tech/lib.ai-agentDefine & register
typescript
import { defineAgent, AgentRegistry } from '@lssm-tech/lib.contracts-spec/agent';
const SupportBot = defineAgent({
meta: {
key: 'support.bot',
version: '1.0.0',
description: 'Resolve tickets and escalate low-confidence decisions.',
owners: ['support'],
tags: ['support'],
stability: 'experimental',
},
instructions: 'Resolve tickets. Escalate when confidence < 0.75.',
tools: [{ name: 'support_resolve_ticket' }],
policy: {
confidence: { min: 0.7, default: 0.6 },
escalation: { confidenceThreshold: 0.75 },
},
});
const registry = new AgentRegistry().register(SupportBot);Run with approvals
typescript
import { createUnifiedAgent, ApprovalWorkflow } from '@lssm-tech/lib.ai-agent';
const approvals = new ApprovalWorkflow();
const agent = createUnifiedAgent(SupportBot, {
backend: 'ai-sdk',
tools: new Map([['support_resolve_ticket', async (input) => resolveTicket(input)]]),
});
const result = await agent.run(ticket.body);
// Route low-confidence or manual-review flows through approvals when needed.
What's inside
createUnifiedAgent,ContractSpecAgent,UnifiedAgentMCP, operation-backed, memory, and subagent tool adapters
InMemoryAgentMemoryplus interfaces for custom storesApprovalWorkflow+ApprovalStorefor human-in-the-loop reviews