@recallbricks/runtime 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +502 -0
- package/dist/adapters/api/index.d.ts +2 -0
- package/dist/adapters/api/index.d.ts.map +1 -0
- package/dist/adapters/api/index.js +6 -0
- package/dist/adapters/api/index.js.map +1 -0
- package/dist/adapters/api/server.d.ts +13 -0
- package/dist/adapters/api/server.d.ts.map +1 -0
- package/dist/adapters/api/server.js +241 -0
- package/dist/adapters/api/server.js.map +1 -0
- package/dist/adapters/mcp/index.d.ts +2 -0
- package/dist/adapters/mcp/index.d.ts.map +1 -0
- package/dist/adapters/mcp/index.js +6 -0
- package/dist/adapters/mcp/index.js.map +1 -0
- package/dist/adapters/mcp/server.d.ts +27 -0
- package/dist/adapters/mcp/server.d.ts.map +1 -0
- package/dist/adapters/mcp/server.js +227 -0
- package/dist/adapters/mcp/server.js.map +1 -0
- package/dist/adapters/typescript/index.d.ts +4 -0
- package/dist/adapters/typescript/index.d.ts.map +1 -0
- package/dist/adapters/typescript/index.js +24 -0
- package/dist/adapters/typescript/index.js.map +1 -0
- package/dist/api/RecallBricksClient.d.ts +53 -0
- package/dist/api/RecallBricksClient.d.ts.map +1 -0
- package/dist/api/RecallBricksClient.js +129 -0
- package/dist/api/RecallBricksClient.js.map +1 -0
- package/dist/api/TelemetryClient.d.ts +54 -0
- package/dist/api/TelemetryClient.d.ts.map +1 -0
- package/dist/api/TelemetryClient.js +190 -0
- package/dist/api/TelemetryClient.js.map +1 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +6 -0
- package/dist/api/index.js.map +1 -0
- package/dist/config/index.d.ts +13 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +206 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/AgentRuntime.d.ts +45 -0
- package/dist/core/AgentRuntime.d.ts.map +1 -0
- package/dist/core/AgentRuntime.js +328 -0
- package/dist/core/AgentRuntime.js.map +1 -0
- package/dist/core/AutoSaver.d.ts +26 -0
- package/dist/core/AutoSaver.d.ts.map +1 -0
- package/dist/core/AutoSaver.js +162 -0
- package/dist/core/AutoSaver.js.map +1 -0
- package/dist/core/CircuitBreaker.d.ts +64 -0
- package/dist/core/CircuitBreaker.d.ts.map +1 -0
- package/dist/core/CircuitBreaker.js +201 -0
- package/dist/core/CircuitBreaker.js.map +1 -0
- package/dist/core/ContextLoader.d.ts +31 -0
- package/dist/core/ContextLoader.d.ts.map +1 -0
- package/dist/core/ContextLoader.js +236 -0
- package/dist/core/ContextLoader.js.map +1 -0
- package/dist/core/ContextWeaver.d.ts +49 -0
- package/dist/core/ContextWeaver.d.ts.map +1 -0
- package/dist/core/ContextWeaver.js +216 -0
- package/dist/core/ContextWeaver.js.map +1 -0
- package/dist/core/IdentityValidator.d.ts +24 -0
- package/dist/core/IdentityValidator.d.ts.map +1 -0
- package/dist/core/IdentityValidator.js +161 -0
- package/dist/core/IdentityValidator.js.map +1 -0
- package/dist/core/LLMAdapter.d.ts +19 -0
- package/dist/core/LLMAdapter.d.ts.map +1 -0
- package/dist/core/LLMAdapter.js +223 -0
- package/dist/core/LLMAdapter.js.map +1 -0
- package/dist/core/Metrics.d.ts +96 -0
- package/dist/core/Metrics.d.ts.map +1 -0
- package/dist/core/Metrics.js +271 -0
- package/dist/core/Metrics.js.map +1 -0
- package/dist/core/RateLimiter.d.ts +39 -0
- package/dist/core/RateLimiter.d.ts.map +1 -0
- package/dist/core/RateLimiter.js +251 -0
- package/dist/core/RateLimiter.js.map +1 -0
- package/dist/core/ReflectionEngine.d.ts +70 -0
- package/dist/core/ReflectionEngine.d.ts.map +1 -0
- package/dist/core/ReflectionEngine.js +319 -0
- package/dist/core/ReflectionEngine.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +259 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +38 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +91 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 RecallBricks
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
# RecallBricks Agent Runtime
|
|
2
|
+
|
|
3
|
+
**Universal cognitive runtime for AI systems - persistent identity, continuous memory, and self-improving intelligence.**
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](https://www.python.org/)
|
|
9
|
+
|
|
10
|
+
## What is RecallBricks Runtime?
|
|
11
|
+
|
|
12
|
+
RecallBricks is **Layer 3 of the RecallBricks cognitive stack** - a universal runtime that sits between any LLM and your application to provide:
|
|
13
|
+
|
|
14
|
+
- **Persistent Identity** - Stable personality and behavior across all sessions
|
|
15
|
+
- **Continuous Memory** - Automatic context loading with zero manual management
|
|
16
|
+
- **Self-Improving Intelligence** - Learns from every interaction via the Metacognition Engine
|
|
17
|
+
- **Universal Compatibility** - Works with Anthropic, OpenAI, Gemini, Ollama, and local models
|
|
18
|
+
- **Self-Reflection** - Built-in metacognition with automatic reflection and reasoning
|
|
19
|
+
|
|
20
|
+
This is not just memory infrastructure. This is **cognitive infrastructure**.
|
|
21
|
+
|
|
22
|
+
## The Three-Layer Cognitive Stack
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
┌─────────────────────────────────────────┐
|
|
26
|
+
│ Layer 1: Metacognition Engine │
|
|
27
|
+
│ Learns, optimizes, predicts patterns │
|
|
28
|
+
└─────────────┬───────────────────────────┘
|
|
29
|
+
│
|
|
30
|
+
▼ Feeds pattern detection
|
|
31
|
+
┌─────────────────────────────────────────┐
|
|
32
|
+
│ Layer 2: Memory Graph │
|
|
33
|
+
│ Stores knowledge semantically │
|
|
34
|
+
└─────────────┬───────────────────────────┘
|
|
35
|
+
│
|
|
36
|
+
▼ Queries for context
|
|
37
|
+
┌─────────────────────────────────────────┐
|
|
38
|
+
│ Layer 3: Agent Runtime (THIS) │ ◄─ YOU ARE HERE
|
|
39
|
+
│ Delivers persistent identity │
|
|
40
|
+
└─────────────┬───────────────────────────┘
|
|
41
|
+
│
|
|
42
|
+
▼ Universal LLM interface
|
|
43
|
+
Your Application
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
### Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# TypeScript/JavaScript
|
|
52
|
+
npm install @recallbricks/runtime
|
|
53
|
+
|
|
54
|
+
# Python
|
|
55
|
+
pip install recallbricks
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 30-Second Example
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { AgentRuntime } from '@recallbricks/runtime';
|
|
62
|
+
|
|
63
|
+
const agent = new AgentRuntime({
|
|
64
|
+
agentId: 'sales_bot',
|
|
65
|
+
userId: 'customer_123',
|
|
66
|
+
llmProvider: 'anthropic',
|
|
67
|
+
llmApiKey: process.env.ANTHROPIC_API_KEY,
|
|
68
|
+
apiKey: process.env.RECALLBRICKS_API_KEY,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Chat with automatic context loading
|
|
72
|
+
const response = await agent.chat("What did we discuss last time?");
|
|
73
|
+
console.log(response.response);
|
|
74
|
+
// Agent remembers everything - no manual memory management!
|
|
75
|
+
|
|
76
|
+
// Optional: Trigger self-reflection
|
|
77
|
+
const reflection = await agent.reflect();
|
|
78
|
+
console.log(reflection.insights);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**That's it.** The runtime handles:
|
|
82
|
+
- Loading relevant context from past conversations
|
|
83
|
+
- Injecting agent identity and behavioral rules
|
|
84
|
+
- Calling the LLM with enriched context
|
|
85
|
+
- Validating response for identity leakage
|
|
86
|
+
- Saving conversation for future reference
|
|
87
|
+
|
|
88
|
+
## Key Features
|
|
89
|
+
|
|
90
|
+
### 1. Automatic Context Loading
|
|
91
|
+
|
|
92
|
+
No manual memory management required:
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// Day 1
|
|
96
|
+
await runtime.chat("I'm working on a machine learning project");
|
|
97
|
+
|
|
98
|
+
// Day 30 - different session
|
|
99
|
+
await runtime.chat("Can you remind me what I was working on?");
|
|
100
|
+
// Agent: "You were working on a machine learning project..."
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The runtime automatically:
|
|
104
|
+
- Loads recent conversations
|
|
105
|
+
- Retrieves relevant memories
|
|
106
|
+
- Includes predicted context
|
|
107
|
+
- Optimizes token usage
|
|
108
|
+
|
|
109
|
+
### 2. Persistent Identity
|
|
110
|
+
|
|
111
|
+
Your agent maintains stable identity across all sessions:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// Bad: "I'm Claude, an AI assistant made by Anthropic"
|
|
115
|
+
// Auto-corrected: "I'm SalesBot, your sales assistant"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Identity validation detects and corrects:
|
|
119
|
+
- Base model references (Claude, ChatGPT, etc.)
|
|
120
|
+
- Generic AI assistant language
|
|
121
|
+
- Inconsistent behavior
|
|
122
|
+
- Identity contradictions
|
|
123
|
+
|
|
124
|
+
### 3. Universal LLM Support
|
|
125
|
+
|
|
126
|
+
Switch providers without code changes:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// Anthropic Claude
|
|
130
|
+
llmProvider: 'anthropic'
|
|
131
|
+
|
|
132
|
+
// OpenAI GPT
|
|
133
|
+
llmProvider: 'openai'
|
|
134
|
+
|
|
135
|
+
// Google Gemini
|
|
136
|
+
llmProvider: 'gemini'
|
|
137
|
+
|
|
138
|
+
// Ollama (local)
|
|
139
|
+
llmProvider: 'ollama'
|
|
140
|
+
|
|
141
|
+
// Custom local models
|
|
142
|
+
llmProvider: 'local'
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 4. Multi-User Isolation
|
|
146
|
+
|
|
147
|
+
Each user gets separate memory and context:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
const alice = new AgentRuntime({ userId: 'alice', ... });
|
|
151
|
+
const bob = new AgentRuntime({ userId: 'bob', ... });
|
|
152
|
+
|
|
153
|
+
// Alice and Bob have completely isolated conversations
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 5. Self-Reflection & Metacognition
|
|
157
|
+
|
|
158
|
+
Agents can analyze their own behavior and improve:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
// Trigger manual reflection
|
|
162
|
+
const reflection = await agent.reflect();
|
|
163
|
+
console.log(reflection.insights);
|
|
164
|
+
// ["User prefers concise answers", "Topic focus: machine learning"]
|
|
165
|
+
|
|
166
|
+
// Explain reasoning (Chain of Thought)
|
|
167
|
+
const trace = await agent.explain("Why did you recommend that?");
|
|
168
|
+
console.log(trace.steps);
|
|
169
|
+
console.log(trace.conclusion);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 6. Continuous Learning
|
|
173
|
+
|
|
174
|
+
Every interaction feeds the Metacognition Engine:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
User interaction
|
|
178
|
+
↓
|
|
179
|
+
Auto-save to API
|
|
180
|
+
↓
|
|
181
|
+
Metacognition Engine
|
|
182
|
+
↓
|
|
183
|
+
Pattern detection
|
|
184
|
+
↓
|
|
185
|
+
Improved predictions
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Integration Options
|
|
189
|
+
|
|
190
|
+
### 1. TypeScript/JavaScript SDK
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import { AgentRuntime } from '@recallbricks/runtime';
|
|
194
|
+
|
|
195
|
+
const runtime = new AgentRuntime({
|
|
196
|
+
agentId: 'my_bot',
|
|
197
|
+
userId: 'user_123',
|
|
198
|
+
llmApiKey: 'sk-...',
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const response = await runtime.chat('Hello!');
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### 2. Python SDK
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
from recallbricks import AgentRuntime
|
|
208
|
+
|
|
209
|
+
runtime = AgentRuntime(
|
|
210
|
+
agent_id='my_bot',
|
|
211
|
+
user_id='user_123',
|
|
212
|
+
llm_api_key='sk-...'
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
response = runtime.chat('Hello!')
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 3. REST API
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Start server
|
|
222
|
+
npm run build
|
|
223
|
+
PORT=3000 node dist/adapters/api/server.js
|
|
224
|
+
|
|
225
|
+
# Use from any language
|
|
226
|
+
curl -X POST http://localhost:3000/chat \
|
|
227
|
+
-H "Content-Type: application/json" \
|
|
228
|
+
-d '{"message": "Hello!"}'
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 4. MCP (Claude Desktop)
|
|
232
|
+
|
|
233
|
+
Add to `claude_desktop_config.json`:
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"mcpServers": {
|
|
238
|
+
"recallbricks": {
|
|
239
|
+
"command": "node",
|
|
240
|
+
"args": ["/path/to/dist/adapters/mcp/server.js"],
|
|
241
|
+
"env": {
|
|
242
|
+
"RECALLBRICKS_AGENT_ID": "my_bot",
|
|
243
|
+
"RECALLBRICKS_USER_ID": "user_123",
|
|
244
|
+
"RECALLBRICKS_API_URL": "https://recallbricks-api-clean.onrender.com"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Note:** No Anthropic API key needed! Claude Desktop already has Claude running. The MCP server only loads/saves context from RecallBricks API.
|
|
252
|
+
|
|
253
|
+
## Architecture
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
User Message
|
|
257
|
+
│
|
|
258
|
+
▼
|
|
259
|
+
┌────────────────────┐
|
|
260
|
+
│ Save Previous Turn │ ──► Metacognition Engine (Layer 1)
|
|
261
|
+
└────────┬───────────┘
|
|
262
|
+
│
|
|
263
|
+
▼
|
|
264
|
+
┌────────────────────┐
|
|
265
|
+
│ Load Context │ ◄── Memory Graph (Layer 2)
|
|
266
|
+
└────────┬───────────┘
|
|
267
|
+
│
|
|
268
|
+
▼
|
|
269
|
+
┌────────────────────┐
|
|
270
|
+
│ Inject Identity + │
|
|
271
|
+
│ Context │
|
|
272
|
+
└────────┬───────────┘
|
|
273
|
+
│
|
|
274
|
+
▼
|
|
275
|
+
┌────────────────────┐
|
|
276
|
+
│ Call LLM │ ──► Anthropic/OpenAI/etc.
|
|
277
|
+
└────────┬───────────┘
|
|
278
|
+
│
|
|
279
|
+
▼
|
|
280
|
+
┌────────────────────┐
|
|
281
|
+
│ Validate Response │
|
|
282
|
+
│ (Identity Check) │
|
|
283
|
+
└────────┬───────────┘
|
|
284
|
+
│
|
|
285
|
+
▼
|
|
286
|
+
Return to User
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Use Cases
|
|
290
|
+
|
|
291
|
+
### Customer Support
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
const support = new AgentRuntime({
|
|
295
|
+
agentId: 'support_bot',
|
|
296
|
+
userId: customerId,
|
|
297
|
+
llmApiKey: key,
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// Remembers customer issues, preferences, history
|
|
301
|
+
const response = await support.chat("Status of my order?");
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Sales Assistant
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
const sales = new AgentRuntime({
|
|
308
|
+
agentId: 'sales_assistant',
|
|
309
|
+
userId: leadId,
|
|
310
|
+
llmApiKey: key,
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// Tracks leads, conversations, deal status
|
|
314
|
+
const response = await sales.chat("Can you remind me of our last call?");
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Personal AI Assistant
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
const assistant = new AgentRuntime({
|
|
321
|
+
agentId: 'personal_assistant',
|
|
322
|
+
userId: userId,
|
|
323
|
+
llmApiKey: key,
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// Remembers tasks, preferences, context
|
|
327
|
+
const response = await assistant.chat("What's on my agenda?");
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Configuration
|
|
331
|
+
|
|
332
|
+
### All Options
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
const runtime = new AgentRuntime({
|
|
336
|
+
// Required
|
|
337
|
+
agentId: 'your_agent',
|
|
338
|
+
userId: 'your_user',
|
|
339
|
+
llmApiKey: 'your_key',
|
|
340
|
+
|
|
341
|
+
// Optional
|
|
342
|
+
apiUrl: 'https://recallbricks-api.example.com',
|
|
343
|
+
llmProvider: 'anthropic', // anthropic, openai, cohere, local
|
|
344
|
+
llmModel: 'claude-sonnet-4-5-20250929',
|
|
345
|
+
tier: 'starter', // starter, professional, enterprise
|
|
346
|
+
autoSave: true, // Auto-save conversations
|
|
347
|
+
validateIdentity: true, // Validate agent identity
|
|
348
|
+
cacheEnabled: true, // Enable context caching
|
|
349
|
+
cacheTTL: 300000, // Cache TTL (5 min)
|
|
350
|
+
maxContextTokens: 4000, // Max context tokens
|
|
351
|
+
debug: false, // Debug logging
|
|
352
|
+
});
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Environment Variables
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
RECALLBRICKS_AGENT_ID=your_agent
|
|
359
|
+
RECALLBRICKS_USER_ID=your_user
|
|
360
|
+
RECALLBRICKS_API_KEY=your_llm_key
|
|
361
|
+
RECALLBRICKS_LLM_PROVIDER=anthropic
|
|
362
|
+
RECALLBRICKS_TIER=starter
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## API Reference
|
|
366
|
+
|
|
367
|
+
### Core Methods
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
// Send a message
|
|
371
|
+
const response = await agent.chat(message);
|
|
372
|
+
|
|
373
|
+
// Get agent identity
|
|
374
|
+
const identity = agent.getIdentity();
|
|
375
|
+
|
|
376
|
+
// Get memory context
|
|
377
|
+
const context = await agent.getContext();
|
|
378
|
+
|
|
379
|
+
// Refresh context (bypass cache)
|
|
380
|
+
await agent.refreshContext();
|
|
381
|
+
|
|
382
|
+
// Trigger self-reflection
|
|
383
|
+
const reflection = await agent.reflect();
|
|
384
|
+
|
|
385
|
+
// Explain reasoning for a query
|
|
386
|
+
const trace = await agent.explain("Why?");
|
|
387
|
+
|
|
388
|
+
// Get conversation history
|
|
389
|
+
const history = agent.getConversationHistory();
|
|
390
|
+
|
|
391
|
+
// Clear session history
|
|
392
|
+
agent.clearConversationHistory();
|
|
393
|
+
|
|
394
|
+
// Flush pending saves
|
|
395
|
+
await agent.flush();
|
|
396
|
+
|
|
397
|
+
// Graceful shutdown
|
|
398
|
+
await agent.shutdown();
|
|
399
|
+
|
|
400
|
+
// Get validation stats
|
|
401
|
+
const stats = agent.getValidationStats();
|
|
402
|
+
|
|
403
|
+
// Get reflection history
|
|
404
|
+
const reflections = agent.getReflectionHistory();
|
|
405
|
+
|
|
406
|
+
// Get runtime version
|
|
407
|
+
const version = agent.getVersion();
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
See [API Reference](./docs/api-reference.md) for complete documentation.
|
|
411
|
+
|
|
412
|
+
## Examples
|
|
413
|
+
|
|
414
|
+
Check the `/examples` directory for:
|
|
415
|
+
- **basic-usage.ts** - Simple quickstart example
|
|
416
|
+
- **multi-provider.ts** - Using different LLM providers
|
|
417
|
+
- **reflection-demo.ts** - Self-reflection and Chain of Thought
|
|
418
|
+
- **typescript-agent/** - Full TypeScript integration example
|
|
419
|
+
- **python-agent/** - Python SDK usage example
|
|
420
|
+
- **api-integration/** - REST API usage example
|
|
421
|
+
- **mcp-quickstart/** - Claude Desktop integration guide
|
|
422
|
+
|
|
423
|
+
## Documentation
|
|
424
|
+
|
|
425
|
+
- **[Quickstart Guide](./docs/quickstart.md)** - Get started in 5 minutes
|
|
426
|
+
- **[Architecture](./docs/architecture.md)** - Deep dive into system design
|
|
427
|
+
- **[API Reference](./docs/api-reference.md)** - Complete API documentation
|
|
428
|
+
|
|
429
|
+
## Testing
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
# Install dependencies
|
|
433
|
+
npm install
|
|
434
|
+
|
|
435
|
+
# Run tests
|
|
436
|
+
npm test
|
|
437
|
+
|
|
438
|
+
# Coverage report
|
|
439
|
+
npm run test:coverage
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## Building from Source
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
# Clone repository
|
|
446
|
+
git clone https://github.com/recallbricks/agent-runtime.git
|
|
447
|
+
cd agent-runtime
|
|
448
|
+
|
|
449
|
+
# Install dependencies
|
|
450
|
+
npm install
|
|
451
|
+
|
|
452
|
+
# Build
|
|
453
|
+
npm run build
|
|
454
|
+
|
|
455
|
+
# Run examples
|
|
456
|
+
npm run build
|
|
457
|
+
node dist/examples/typescript-agent/index.js
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
## Contributing
|
|
461
|
+
|
|
462
|
+
We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
|
463
|
+
|
|
464
|
+
## Roadmap
|
|
465
|
+
|
|
466
|
+
- [x] Core runtime with identity validation
|
|
467
|
+
- [x] TypeScript/JavaScript SDK
|
|
468
|
+
- [x] Python SDK
|
|
469
|
+
- [x] REST API adapter
|
|
470
|
+
- [x] MCP adapter for Claude Desktop
|
|
471
|
+
- [x] Google Gemini support
|
|
472
|
+
- [x] Ollama (local models) support
|
|
473
|
+
- [x] ReflectionEngine for self-analysis
|
|
474
|
+
- [x] ContextWeaver for advanced context building
|
|
475
|
+
- [ ] Streaming support
|
|
476
|
+
- [ ] Telemetry and usage analytics
|
|
477
|
+
- [ ] Advanced circuit breaker patterns
|
|
478
|
+
- [ ] Metrics export (Prometheus/StatsD)
|
|
479
|
+
- [ ] Multi-agent communication
|
|
480
|
+
- [ ] Custom embedding models
|
|
481
|
+
- [ ] Advanced graph traversal
|
|
482
|
+
- [ ] Temporal reasoning
|
|
483
|
+
|
|
484
|
+
## License
|
|
485
|
+
|
|
486
|
+
MIT License - See [LICENSE](./LICENSE) for details.
|
|
487
|
+
|
|
488
|
+
## Product Positioning
|
|
489
|
+
|
|
490
|
+
**"RecallBricks Agent Runtime - The universal cognitive runtime for AI systems. Turn any LLM into a persistent agent with continuous memory, stable identity, and self-improving intelligence."**
|
|
491
|
+
|
|
492
|
+
This is not just memory infrastructure.
|
|
493
|
+
|
|
494
|
+
This is not just a wrapper around LLMs.
|
|
495
|
+
|
|
496
|
+
This is **cognitive infrastructure for the AI era**.
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
**Built by [RecallBricks](https://recallbricks.com)**
|
|
501
|
+
|
|
502
|
+
Questions? Issues? [Open an issue](https://github.com/recallbricks/agent-runtime/issues) or reach out to support@recallbricks.com
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/api/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecallBricksAPIServer = void 0;
|
|
4
|
+
var server_1 = require("./server");
|
|
5
|
+
Object.defineProperty(exports, "RecallBricksAPIServer", { enumerable: true, get: function () { return server_1.RecallBricksAPIServer; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/api/index.ts"],"names":[],"mappings":";;;AAIA,mCAAiD;AAAxC,+GAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
export declare class RecallBricksAPIServer {
|
|
3
|
+
private app;
|
|
4
|
+
private runtime?;
|
|
5
|
+
private port;
|
|
6
|
+
constructor(port?: number);
|
|
7
|
+
private setupMiddleware;
|
|
8
|
+
private setupRoutes;
|
|
9
|
+
private handleError;
|
|
10
|
+
start(): void;
|
|
11
|
+
getApp(): express.Application;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/adapters/api/server.ts"],"names":[],"mappings":"AAMA,OAAO,OAA4C,MAAM,SAAS,CAAC;AAsBnE,qBAAa,qBAAqB;IAChC,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,OAAO,CAAC,CAAe;IAC/B,OAAO,CAAC,IAAI,CAAS;gBAET,IAAI,SAAO;IAUvB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,WAAW;IAwNnB,OAAO,CAAC,WAAW;IAuBnB,KAAK,IAAI,IAAI;IAUb,MAAM,IAAI,OAAO,CAAC,WAAW;CAG9B"}
|