@operor/core
v0.5.0
Published
Agent OS Core - AI Agent Operating System
Readme
@operor/core
Core framework for Operor — provides the agent runtime, message routing, intent classification, and extensibility points.
Knowledge Base Integration
Agents can opt into knowledge base (KB) powered responses via configuration:
OperorConfig.knowledgeStore— configure the KB backend (SQLite path, embedding provider/model, dimensions)AgentConfig.knowledgeBase: true— opt-in per agent to use KB for context retrieval
const os = new Operor({
knowledgeStore: {
dbPath: './my-kb.db',
embeddingProvider: 'openai',
embeddingModel: 'text-embedding-3-small',
dimensions: 1536,
},
});
os.createAgent({
name: 'support',
triggers: ['*'],
knowledgeBase: true, // this agent uses KB
});Training Mode
Training mode allows whitelisted phone numbers to manage KB content via chat commands.
const os = new Operor({
trainingMode: {
enabled: true,
whitelist: ['+1234567890'],
},
});Available commands (sent as chat messages by whitelisted users):
| Command | Description |
|---------|-------------|
| /teach <content> | Add knowledge to the KB |
| /faq list | List all FAQ entries |
| /faq delete <id> | Delete an FAQ entry |
| /faq search <query> | Search FAQ entries |
| /test <question> | Test KB response |
| /status | Show KB status |
| /help | Show available commands |
Training commands emit training:command events for external handlers to implement the actual KB operations.
Guardrails
Per-agent guardrails control what messages are accepted and what responses are allowed.
os.createAgent({
name: 'support',
triggers: ['*'],
guardrails: {
systemRules: ['Always be polite', 'Never share internal pricing'],
blockedTopics: ['politics', 'religion'],
escalationTriggers: ['speak to a human', 'talk to manager'],
maxResponseLength: 2000,
},
});systemRules— injected into the LLM system promptblockedTopics— messages containing these topics are refused (case-insensitive substring match)escalationTriggers— phrases that trigger human handoffmaxResponseLength— caps response character length
The GuardrailEngine class provides checkInput() and checkOutput() methods for use in agent processing pipelines.
