gauss-ts 1.1.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 +499 -0
- package/dist/agent-CHrSUkPz.d.ts +485 -0
- package/dist/agent-CMp1wFzs.d.cts +485 -0
- package/dist/agent.cjs +2 -0
- package/dist/agent.cjs.map +1 -0
- package/dist/agent.d.cts +144 -0
- package/dist/agent.d.ts +144 -0
- package/dist/agent.js +2 -0
- package/dist/agent.js.map +1 -0
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +492 -0
- package/dist/index.d.ts +492 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.cjs +2 -0
- package/dist/mcp.cjs.map +1 -0
- package/dist/mcp.d.cts +282 -0
- package/dist/mcp.d.ts +282 -0
- package/dist/mcp.js +2 -0
- package/dist/mcp.js.map +1 -0
- package/dist/middleware.cjs +2 -0
- package/dist/middleware.cjs.map +1 -0
- package/dist/middleware.d.cts +46 -0
- package/dist/middleware.d.ts +46 -0
- package/dist/middleware.js +2 -0
- package/dist/middleware.js.map +1 -0
- package/dist/orchestration.cjs +2 -0
- package/dist/orchestration.cjs.map +1 -0
- package/dist/orchestration.d.cts +94 -0
- package/dist/orchestration.d.ts +94 -0
- package/dist/orchestration.js +2 -0
- package/dist/orchestration.js.map +1 -0
- package/dist/rag.cjs +2 -0
- package/dist/rag.cjs.map +1 -0
- package/dist/rag.d.cts +43 -0
- package/dist/rag.d.ts +43 -0
- package/dist/rag.js +2 -0
- package/dist/rag.js.map +1 -0
- package/dist/tools.cjs +2 -0
- package/dist/tools.cjs.map +1 -0
- package/dist/tools.d.cts +48 -0
- package/dist/tools.d.ts +48 -0
- package/dist/tools.js +2 -0
- package/dist/tools.js.map +1 -0
- package/dist/types-BkwC4s1P.d.cts +239 -0
- package/dist/types-BkwC4s1P.d.ts +239 -0
- package/package.json +132 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Giulio Leone
|
|
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,499 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🔮 gauss-ts
|
|
4
|
+
|
|
5
|
+
**The AI Agent SDK for TypeScript — powered by Rust**
|
|
6
|
+
|
|
7
|
+
[](https://github.com/giulio-leone/gauss/actions/workflows/ci.yml)
|
|
8
|
+
[](https://www.npmjs.com/package/gauss-ts)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
**Multi-provider • Teams • Tools • MCP • Graphs • Workflows • Memory • RAG**
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install gauss-ts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### One-liner
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { gauss } from "gauss-ts";
|
|
27
|
+
|
|
28
|
+
const answer = await gauss("Explain quantum computing in 3 sentences");
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Auto-detects your API key from environment variables. That's it.
|
|
32
|
+
|
|
33
|
+
### Full control
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { Agent, OPENAI_DEFAULT } from "gauss-ts";
|
|
37
|
+
|
|
38
|
+
const agent = new Agent({
|
|
39
|
+
name: "assistant",
|
|
40
|
+
model: OPENAI_DEFAULT, // "gpt-5.2"
|
|
41
|
+
instructions: "You are a helpful assistant.",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const result = await agent.run("What is quantum computing?");
|
|
45
|
+
console.log(result.text);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
### 🤖 Agents
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { Agent, OPENAI_DEFAULT } from "gauss-ts";
|
|
56
|
+
|
|
57
|
+
const agent = new Agent({
|
|
58
|
+
name: "researcher",
|
|
59
|
+
model: OPENAI_DEFAULT, // "gpt-5.2"
|
|
60
|
+
instructions: "You are a research assistant.",
|
|
61
|
+
temperature: 0.7,
|
|
62
|
+
maxSteps: 5,
|
|
63
|
+
tools: [searchTool, calculateTool],
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Run
|
|
67
|
+
const result = await agent.run("Find the population of Tokyo");
|
|
68
|
+
console.log(result.text);
|
|
69
|
+
console.log(`Steps: ${result.steps}, Tokens: ${result.inputTokens + result.outputTokens}`);
|
|
70
|
+
|
|
71
|
+
// Stream
|
|
72
|
+
for await (const event of agent.streamIter("Tell me a story")) {
|
|
73
|
+
if (event.type === "text_delta") process.stdout.write(event.delta);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 🛠️ Tools
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const weatherTool = {
|
|
81
|
+
name: "get_weather",
|
|
82
|
+
description: "Get current weather for a location",
|
|
83
|
+
parameters: {
|
|
84
|
+
type: "object",
|
|
85
|
+
properties: {
|
|
86
|
+
city: { type: "string", description: "City name" },
|
|
87
|
+
},
|
|
88
|
+
required: ["city"],
|
|
89
|
+
},
|
|
90
|
+
execute: async (args: { city: string }) => {
|
|
91
|
+
return { temperature: 22, condition: "sunny" };
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const agent = new Agent({
|
|
96
|
+
name: "weather-bot",
|
|
97
|
+
model: OPENAI_DEFAULT,
|
|
98
|
+
tools: [weatherTool],
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 👥 Teams
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import { Agent, Team } from "gauss-ts";
|
|
106
|
+
|
|
107
|
+
const team = new Team({
|
|
108
|
+
name: "research-team",
|
|
109
|
+
agents: [
|
|
110
|
+
new Agent({ name: "researcher", model: "gpt-5.2", instructions: "Research topics deeply." }),
|
|
111
|
+
new Agent({ name: "writer", model: "claude-sonnet-4-20250514", instructions: "Write clear summaries." }),
|
|
112
|
+
new Agent({ name: "critic", model: "gemini-2.5-flash", instructions: "Review and critique." }),
|
|
113
|
+
],
|
|
114
|
+
strategy: "round-robin",
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const result = await team.run("Analyze the impact of AI on healthcare");
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 📊 Graph Pipelines
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { Agent, Graph } from "gauss-ts";
|
|
124
|
+
|
|
125
|
+
const researcher = new Agent({ name: "researcher", instructions: "Research thoroughly" });
|
|
126
|
+
const writer = new Agent({ name: "writer", instructions: "Write clearly" });
|
|
127
|
+
|
|
128
|
+
const pipeline = new Graph()
|
|
129
|
+
.addNode("research", researcher)
|
|
130
|
+
.addNode("write", writer)
|
|
131
|
+
.addEdge("research", "write");
|
|
132
|
+
|
|
133
|
+
const result = await pipeline.run("Explain quantum computing");
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 🔄 Workflows
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
import { Agent, Workflow } from "gauss-ts";
|
|
140
|
+
|
|
141
|
+
const planner = new Agent({ name: "planner" });
|
|
142
|
+
const executor = new Agent({ name: "executor" });
|
|
143
|
+
|
|
144
|
+
const wf = new Workflow()
|
|
145
|
+
.addStep("plan", planner)
|
|
146
|
+
.addStep("execute", executor)
|
|
147
|
+
.addDependency("execute", "plan");
|
|
148
|
+
|
|
149
|
+
const result = await wf.run("Build a REST API");
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 🌐 Multi-Agent Network
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import { Agent, Network } from "gauss-ts";
|
|
156
|
+
|
|
157
|
+
const analyst = new Agent({ name: "analyst" });
|
|
158
|
+
const coder = new Agent({ name: "coder" });
|
|
159
|
+
|
|
160
|
+
const net = new Network()
|
|
161
|
+
.addAgent(analyst)
|
|
162
|
+
.addAgent(coder)
|
|
163
|
+
.setSupervisor("analyst");
|
|
164
|
+
|
|
165
|
+
const result = await net.delegate("coder", "Implement a sorting algorithm");
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 🧠 Memory
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { Agent, Memory } from "gauss-ts";
|
|
172
|
+
|
|
173
|
+
const memory = new Memory();
|
|
174
|
+
const agent = new Agent({
|
|
175
|
+
name: "assistant",
|
|
176
|
+
model: OPENAI_DEFAULT,
|
|
177
|
+
memory,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// Memory persists across conversations
|
|
181
|
+
await agent.run("My name is Alice and I love hiking.");
|
|
182
|
+
const result = await agent.run("What do you know about me?");
|
|
183
|
+
// → "You're Alice, and you enjoy hiking!"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 📚 RAG / Vector Store
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import { VectorStore } from "gauss-ts";
|
|
190
|
+
|
|
191
|
+
const store = new VectorStore();
|
|
192
|
+
await store.add("TypeScript is a typed superset of JavaScript.");
|
|
193
|
+
await store.add("Rust is a systems programming language.");
|
|
194
|
+
|
|
195
|
+
const results = await store.search("What is TypeScript?");
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 🔗 MCP Server
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
import { McpServer } from "gauss-ts";
|
|
202
|
+
|
|
203
|
+
const server = new McpServer("my-tools", "1.0.0");
|
|
204
|
+
|
|
205
|
+
server.addTool({
|
|
206
|
+
name: "calculate",
|
|
207
|
+
description: "Evaluate a math expression",
|
|
208
|
+
parameters: { type: "object", properties: { expr: { type: "string" } } },
|
|
209
|
+
execute: async ({ expr }) => ({ result: eval(expr) }),
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const response = await server.handle(requestMessage);
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 🎯 Structured Output
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
import { Agent, structured } from "gauss-ts";
|
|
219
|
+
|
|
220
|
+
const agent = new Agent({ model: OPENAI_DEFAULT });
|
|
221
|
+
|
|
222
|
+
const { data } = await structured(agent, "List 3 programming languages", {
|
|
223
|
+
schema: {
|
|
224
|
+
type: "object",
|
|
225
|
+
properties: {
|
|
226
|
+
languages: { type: "array", items: { type: "string" } },
|
|
227
|
+
},
|
|
228
|
+
required: ["languages"],
|
|
229
|
+
},
|
|
230
|
+
maxParseRetries: 2,
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
console.log(data.languages); // ["TypeScript", "Rust", "Python"]
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 💭 Reasoning
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
import { Agent, OPENAI_REASONING, ANTHROPIC_PREMIUM } from "gauss-ts";
|
|
240
|
+
|
|
241
|
+
// OpenAI reasoning models (o4-mini)
|
|
242
|
+
const reasoner = new Agent({
|
|
243
|
+
name: "solver",
|
|
244
|
+
model: OPENAI_REASONING,
|
|
245
|
+
reasoningEffort: "high",
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// Anthropic extended thinking
|
|
249
|
+
const thinker = new Agent({
|
|
250
|
+
name: "analyst",
|
|
251
|
+
model: ANTHROPIC_PREMIUM,
|
|
252
|
+
thinkingBudget: 10000,
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
const result = await thinker.run("Analyze this complex problem...");
|
|
256
|
+
console.log(result.thinking); // Internal reasoning process
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 📝 Prompt Templates
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import { template, summarize, translate, codeReview } from "gauss-ts";
|
|
263
|
+
|
|
264
|
+
// Custom template
|
|
265
|
+
const greet = template("Hello {{name}}, you are a {{role}}.");
|
|
266
|
+
console.log(greet({ name: "Alice", role: "developer" }));
|
|
267
|
+
|
|
268
|
+
// Built-in templates
|
|
269
|
+
const prompt = summarize({ format: "article", style: "bullet points", text: "..." });
|
|
270
|
+
const translated = translate({ language: "French", text: "Hello world" });
|
|
271
|
+
const review = codeReview({ language: "typescript", code: "const x = 1;" });
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### ⚡ Batch Processing
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
import { batch } from "gauss-ts";
|
|
278
|
+
|
|
279
|
+
const results = await batch(
|
|
280
|
+
["Translate: Hello", "Translate: World", "Translate: Goodbye"],
|
|
281
|
+
{ concurrency: 2, provider: "openai" },
|
|
282
|
+
);
|
|
283
|
+
results.forEach((r) => console.log(r.result?.text ?? r.error?.message));
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### 🔁 Retry with Backoff
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
import { withRetry, retryable } from "gauss-ts";
|
|
290
|
+
|
|
291
|
+
const data = await withRetry(() => agent.run("Summarize this"), {
|
|
292
|
+
maxRetries: 3,
|
|
293
|
+
backoff: "exponential", // "fixed" | "linear" | "exponential"
|
|
294
|
+
baseDelayMs: 1000,
|
|
295
|
+
jitter: 0.1,
|
|
296
|
+
onRetry: (err, attempt, delay) => console.log(`Retry ${attempt} in ${delay}ms`),
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// Or wrap an agent
|
|
300
|
+
const resilientRun = retryable(agent, { maxRetries: 5 });
|
|
301
|
+
const result = await resilientRun("Hello");
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### 🛡️ Resilience
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
import { createFallbackProvider, createCircuitBreaker, createResilientAgent } from "gauss-ts";
|
|
308
|
+
|
|
309
|
+
const fallback = createFallbackProvider([
|
|
310
|
+
{ provider: "openai", model: "gpt-5.2" },
|
|
311
|
+
{ provider: "anthropic", model: "claude-sonnet-4-20250514" },
|
|
312
|
+
]);
|
|
313
|
+
|
|
314
|
+
const breaker = createCircuitBreaker({ failureThreshold: 5, resetTimeoutMs: 30000 });
|
|
315
|
+
const agent = createResilientAgent({ fallback, circuitBreaker: breaker });
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### 🔀 Pipeline & Async Helpers
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
import { pipe, mapAsync, filterAsync, reduceAsync, compose } from "gauss-ts";
|
|
322
|
+
|
|
323
|
+
const result = await pipe(
|
|
324
|
+
"Explain AI",
|
|
325
|
+
(prompt) => agent.run(prompt),
|
|
326
|
+
(result) => result.text.toUpperCase(),
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
const descriptions = await mapAsync(
|
|
330
|
+
["apple", "banana", "cherry"],
|
|
331
|
+
(fruit) => agent.run(`Describe ${fruit}`),
|
|
332
|
+
{ concurrency: 2 },
|
|
333
|
+
);
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## 📐 Model Constants
|
|
339
|
+
|
|
340
|
+
Import model constants as the single source of truth:
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
import {
|
|
344
|
+
// OpenAI
|
|
345
|
+
OPENAI_DEFAULT, // "gpt-5.2"
|
|
346
|
+
OPENAI_FAST, // "gpt-4.1"
|
|
347
|
+
OPENAI_REASONING, // "o4-mini"
|
|
348
|
+
OPENAI_IMAGE, // "gpt-image-1"
|
|
349
|
+
|
|
350
|
+
// Anthropic
|
|
351
|
+
ANTHROPIC_DEFAULT, // "claude-sonnet-4-20250514"
|
|
352
|
+
ANTHROPIC_PREMIUM, // "claude-opus-4-20250414"
|
|
353
|
+
ANTHROPIC_FAST, // "claude-haiku-4-20250414"
|
|
354
|
+
|
|
355
|
+
// Google
|
|
356
|
+
GOOGLE_DEFAULT, // "gemini-2.5-flash"
|
|
357
|
+
GOOGLE_PREMIUM, // "gemini-2.5-pro"
|
|
358
|
+
GOOGLE_IMAGE, // "gemini-2.0-flash"
|
|
359
|
+
|
|
360
|
+
// OpenRouter
|
|
361
|
+
OPENROUTER_DEFAULT, // "openai/gpt-5.2"
|
|
362
|
+
|
|
363
|
+
// DeepSeek
|
|
364
|
+
DEEPSEEK_DEFAULT, // "deepseek-chat"
|
|
365
|
+
DEEPSEEK_REASONING, // "deepseek-reasoner"
|
|
366
|
+
|
|
367
|
+
// Helpers
|
|
368
|
+
PROVIDER_DEFAULTS, // Record<string, string>
|
|
369
|
+
defaultModel, // (provider: string) => string
|
|
370
|
+
} from "gauss-ts";
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## 🌐 Providers
|
|
376
|
+
|
|
377
|
+
| Provider | Env Variable | Default Model |
|
|
378
|
+
|----------|-------------|---------------|
|
|
379
|
+
| OpenAI | `OPENAI_API_KEY` | `gpt-5.2` |
|
|
380
|
+
| Anthropic | `ANTHROPIC_API_KEY` | `claude-sonnet-4-20250514` |
|
|
381
|
+
| Google | `GOOGLE_API_KEY` | `gemini-2.5-flash` |
|
|
382
|
+
| DeepSeek | `DEEPSEEK_API_KEY` | `deepseek-chat` |
|
|
383
|
+
| Groq | `GROQ_API_KEY` | `llama-3.3-70b-versatile` |
|
|
384
|
+
| Ollama | — (local) | `llama3.2` |
|
|
385
|
+
| OpenRouter | `OPENROUTER_API_KEY` | `openai/gpt-5.2` |
|
|
386
|
+
|
|
387
|
+
Set one environment variable and Gauss auto-detects the provider:
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
export OPENAI_API_KEY=sk-...
|
|
391
|
+
# or
|
|
392
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
393
|
+
# or
|
|
394
|
+
export GOOGLE_API_KEY=AIza...
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## 🧩 All Features
|
|
400
|
+
|
|
401
|
+
| Feature | Module | Description |
|
|
402
|
+
|---------|--------|-------------|
|
|
403
|
+
| **Agent** | `Agent`, `gauss()` | LLM agent with tools, structured output, streaming |
|
|
404
|
+
| **Streaming** | `AgentStream` | Async iterable streaming with `for await` |
|
|
405
|
+
| **Batch** | `batch()` | Parallel prompt execution with concurrency control |
|
|
406
|
+
| **Graph** | `Graph` | DAG-based multi-agent pipeline |
|
|
407
|
+
| **Workflow** | `Workflow` | Step-based execution with dependencies |
|
|
408
|
+
| **Team** | `Team` | Multi-agent team with strategy (round-robin, etc.) |
|
|
409
|
+
| **Network** | `Network` | Multi-agent delegation with supervisor |
|
|
410
|
+
| **Memory** | `Memory` | Persistent conversation memory |
|
|
411
|
+
| **VectorStore** | `VectorStore` | Embedding storage and semantic search (RAG) |
|
|
412
|
+
| **MCP** | `McpServer` | Model Context Protocol server |
|
|
413
|
+
| **Middleware** | `MiddlewareChain` | Request/response processing pipeline |
|
|
414
|
+
| **Guardrails** | `GuardrailChain` | Content moderation, PII, token limits, regex |
|
|
415
|
+
| **Retry** | `withRetry`, `retryable` | Exponential/linear/fixed backoff with jitter |
|
|
416
|
+
| **Resilience** | `createResilientAgent` | Fallback providers + circuit breaker |
|
|
417
|
+
| **Structured** | `structured()` | Typed JSON extraction with auto-retry |
|
|
418
|
+
| **Templates** | `template()` | Composable prompt templates with built-ins |
|
|
419
|
+
| **Pipeline** | `pipe`, `mapAsync`, `compose` | Async data flow composition |
|
|
420
|
+
| **Evaluation** | `EvalRunner` | Agent quality scoring with datasets |
|
|
421
|
+
| **Telemetry** | `Telemetry` | Spans, metrics, and export |
|
|
422
|
+
| **Approval** | `ApprovalManager` | Human-in-the-loop approval flow |
|
|
423
|
+
| **Checkpoint** | `CheckpointStore` | Save/restore agent state |
|
|
424
|
+
| **Tokens** | `countTokens` | Token counting and context window info |
|
|
425
|
+
| **Plugins** | `PluginRegistry` | Extensible plugin system |
|
|
426
|
+
| **Config** | `parseAgentConfig` | JSON config parsing with env resolution |
|
|
427
|
+
| **A2A** | `A2aClient` | Agent-to-Agent protocol client |
|
|
428
|
+
| **Tool Registry** | `ToolRegistry` | Searchable tool catalog with examples |
|
|
429
|
+
| **Spec Parsers** | `AgentSpec`, `SkillSpec` | AGENTS.MD & SKILL.MD discovery and parsing |
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## 🏗️ Architecture
|
|
434
|
+
|
|
435
|
+
Gauss-TS is a thin SDK wrapping **[gauss-core](https://github.com/giulio-leone/gauss-core)** (Rust) via NAPI bindings. All heavy lifting — agent loops, tool execution, middleware, graph/workflow orchestration — runs at native speed in Rust.
|
|
436
|
+
|
|
437
|
+
```
|
|
438
|
+
TypeScript SDK (30+ modules)
|
|
439
|
+
│
|
|
440
|
+
▼
|
|
441
|
+
NAPI Bindings (80+ functions)
|
|
442
|
+
│
|
|
443
|
+
▼
|
|
444
|
+
gauss-core (Rust engine)
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## 📁 Examples
|
|
450
|
+
|
|
451
|
+
See the [`examples/`](examples/) directory for **23 complete examples** covering every feature:
|
|
452
|
+
|
|
453
|
+
| # | Example | Feature |
|
|
454
|
+
|---|---------|---------|
|
|
455
|
+
| 01 | Basic Agent | Agent creation, run, stream |
|
|
456
|
+
| 02 | Planning Agent | Multi-step planning |
|
|
457
|
+
| 03 | Sub-agent Orchestration | Agent delegation |
|
|
458
|
+
| 04 | MCP Integration | Model Context Protocol |
|
|
459
|
+
| 05 | Persistent Memory | Conversation memory |
|
|
460
|
+
| 06 | Full-Featured | All features combined |
|
|
461
|
+
| 07 | Plugin System | Custom plugins |
|
|
462
|
+
| 08 | A2A Server | Agent-to-Agent protocol |
|
|
463
|
+
| 09 | CLI & REST | HTTP + CLI interfaces |
|
|
464
|
+
| 10 | Team Coordination | Multi-agent teams |
|
|
465
|
+
| 11 | Voice Pipeline | Audio/voice processing |
|
|
466
|
+
| 12 | Workflow DSL | Declarative workflows |
|
|
467
|
+
| 13 | Multimodal Vision | Image understanding |
|
|
468
|
+
| 14 | Video Processing | Video analysis |
|
|
469
|
+
| 15 | Universal Provider | Cross-provider usage |
|
|
470
|
+
| 16 | LLM Recording | Record & replay |
|
|
471
|
+
| 17 | Zero Config | Auto-detect everything |
|
|
472
|
+
| 18 | Tool Registry | Searchable tools |
|
|
473
|
+
| 19 | Graph Pipeline | DAG pipelines |
|
|
474
|
+
| 20 | Network Delegation | Supervisor networks |
|
|
475
|
+
| 21 | Structured Output | JSON extraction |
|
|
476
|
+
| 22 | DX Utilities | Developer experience helpers |
|
|
477
|
+
| 23 | Reasoning | o4-mini, extended thinking |
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## 🔗 Ecosystem
|
|
482
|
+
|
|
483
|
+
| Package | Language | Description |
|
|
484
|
+
|---------|----------|-------------|
|
|
485
|
+
| [`gauss-core`](https://github.com/giulio-leone/gauss-core) | Rust | Core engine — NAPI + PyO3 + WASM |
|
|
486
|
+
| [`gauss-ts`](https://github.com/giulio-leone/gauss) | TypeScript | This SDK (NAPI bindings) |
|
|
487
|
+
| [`gauss-py`](https://github.com/giulio-leone/gauss-py) | Python | Python SDK (PyO3 bindings) |
|
|
488
|
+
|
|
489
|
+
## API Reference
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
npm run docs
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
Generates HTML docs in `docs/api/` from JSDoc comments in the source.
|
|
496
|
+
|
|
497
|
+
## License
|
|
498
|
+
|
|
499
|
+
MIT © [Giulio Leone](https://github.com/giulio-leone)
|