@lssm/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.
Define & register
import { defineAgent, AgentRegistry } from '@lssm/lib.ai-agent';
const SupportBot = defineAgent({
meta: { name: 'support.bot', version: 1 },
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
import { AgentRunner, ToolExecutor, ApprovalWorkflow } from '@lssm/lib.ai-agent';
const runner = new AgentRunner({
registry,
llm: mistralProvider,
toolExecutor: new ToolExecutor({ tools: supportTools }),
approvalWorkflow: new ApprovalWorkflow(),
});
const result = await runner.run({ agent: 'support.bot', input: ticket.body });
if (result.approvalRequestId) {
// show in ApprovalQueue UI
}What's inside
defineAgent,AgentRegistry,AgentRunnerToolExecutorwith schema-enforced tool definitionsInMemoryAgentMemoryplus interfaces for custom storesApprovalWorkflow+ApprovalStorefor human-in-the-loop reviews