@ariaflowagents/tools 0.4.4 → 0.4.7

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/guides/CAG.md ADDED
@@ -0,0 +1,44 @@
1
+ # CAG Tools
2
+
3
+ Two tools, split responsibilities:
4
+
5
+ - **CAGTool** → retrieval only, returns chunks.
6
+ - **CAGAnswerTool** → answer only, returns `{ type: 'final', text }`.
7
+
8
+ ## CAGTool (retrieve)
9
+
10
+ Input
11
+
12
+ ```ts
13
+ { query: string; topK?: number; hint?: string }
14
+ ```
15
+
16
+ Output
17
+
18
+ ```ts
19
+ { chunks: ChunkDef[] }
20
+ ```
21
+
22
+ ## CAGAnswerTool (answer)
23
+
24
+ Input
25
+
26
+ ```ts
27
+ { query: string; chunks: ChunkDef[] }
28
+ ```
29
+
30
+ Output
31
+
32
+ ```ts
33
+ { type: 'final'; text: string; reasons?: string[]; chunks: ChunkDef[] }
34
+ ```
35
+
36
+ ## Grounding Rules
37
+
38
+ - Retriever selects from approved `KnowledgeSource` chunks only.
39
+ - Answer tool uses only provided chunks.
40
+
41
+ ## Notes
42
+
43
+ - Tool loop is handled by Runtime/FlowManager.
44
+ - Auto-retrieve (always-on) is a runtime feature; it calls the retriever tool and injects context before the model runs.
@@ -0,0 +1,63 @@
1
+ # Getting Started (Tools)
2
+
3
+ ## Install
4
+
5
+ ```bash
6
+ bun add @ariaflowagents/tools @ariaflowagents/rag @ariaflowagents/core ai @ai-sdk/openai
7
+ ```
8
+
9
+ ## Minimal Example
10
+
11
+ ```ts
12
+ import { openai } from '@ai-sdk/openai';
13
+ import { createStaticKnowledgeSource, createLLMRetriever } from '@ariaflowagents/rag';
14
+ import { createCagTool, createCagAnswerTool } from '@ariaflowagents/tools';
15
+
16
+ const supportSource = createStaticKnowledgeSource({
17
+ id: 'support-pack',
18
+ name: 'Support Pack',
19
+ content: 'Refunds: 30 days. Cancellations: anytime.',
20
+ });
21
+
22
+ const retriever = createLLMRetriever({
23
+ model: openai('gpt-4o-mini') as any,
24
+ topK: 4,
25
+ });
26
+
27
+ const cag = createCagTool({ sources: [supportSource], retriever });
28
+ const cagAnswer = createCagAnswerTool({
29
+ generatorModel: openai('gpt-4o') as any,
30
+ });
31
+
32
+ const { chunks } = await cag.execute({ query: 'What is the refund policy?' });
33
+ const result = await cagAnswer.execute({ query: 'What is the refund policy?', chunks });
34
+
35
+ console.log(result.text);
36
+ ```
37
+
38
+ ## Example (runtime loop)
39
+
40
+ Run the bundled example:
41
+
42
+ ```bash
43
+ cd packages/ariaflow-tools/examples/auto-retrieve-runtime
44
+ bunx tsx run.ts
45
+ ```
46
+
47
+ ## Example (auto-retrieve + triage)
48
+
49
+ Structured triage + always-on retrieval.
50
+
51
+ ```bash
52
+ cd packages/ariaflow-tools/examples/auto-retrieve-triage
53
+ bunx tsx run.ts
54
+ ```
55
+
56
+ ## Example (enterprise SOP)
57
+
58
+ Flow-based support SOP with validation + ticketing.
59
+
60
+ ```bash
61
+ cd packages/ariaflow-tools/examples/enterprise-support-agent
62
+ bunx tsx run.ts
63
+ ```
@@ -0,0 +1,17 @@
1
+ # AriaFlow Tools Guides
2
+
3
+ Concise docs for tools in `@ariaflowagents/tools`.
4
+
5
+ ## Getting Started
6
+
7
+ - **[Getting Started](./GETTING_STARTED.md)** - Create CAG tools and run the example
8
+ - **Examples**:
9
+ - `packages/ariaflow-tools/examples/auto-retrieve-runtime/`
10
+ - `packages/ariaflow-tools/examples/auto-retrieve-triage/`
11
+ - `packages/ariaflow-tools/examples/enterprise-support-agent/`
12
+ - `packages/ariaflow-tools/examples/support-multi-packs/`
13
+ - `packages/ariaflow-tools/examples/ecommerce-multi-packs/`
14
+
15
+ ## Guides
16
+
17
+ - **[CAG Tools](./CAG.md)** - Retrieve + answer tool split
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariaflowagents/tools",
3
- "version": "0.4.4",
3
+ "version": "0.4.7",
4
4
  "description": "AriaFlow tools (CAG)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,19 +12,19 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@ariaflowagents/core": "^0.4.4",
16
- "@ariaflowagents/rag": "^0.4.4"
15
+ "@ariaflowagents/core": "^0.4.7",
16
+ "@ariaflowagents/rag": "^0.4.6"
17
17
  },
18
18
  "peerDependencies": {
19
- "@ariaflowagents/core": "^0.4.4",
20
- "@ariaflowagents/rag": "^0.4.4",
19
+ "@ariaflowagents/core": "^0.4.7",
20
+ "@ariaflowagents/rag": "^0.4.6",
21
21
  "ai": "^6.0.0",
22
22
  "zod": "^3.0.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@ai-sdk/openai": "^3.0.0",
26
- "@ariaflowagents/core": "^0.4.4",
27
- "@ariaflowagents/rag": "^0.4.4",
26
+ "@ariaflowagents/core": "^0.4.7",
27
+ "@ariaflowagents/rag": "^0.4.6",
28
28
  "@types/node": "^20.11.0",
29
29
  "ai": "^6.0.0",
30
30
  "typescript": "^5.3.0",
@@ -40,6 +40,7 @@
40
40
  },
41
41
  "files": [
42
42
  "dist",
43
+ "guides",
43
44
  "README.md"
44
45
  ]
45
46
  }