agentic-api 2.0.641 → 2.0.642

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.
Files changed (2) hide show
  1. package/README.md +43 -7
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -324,30 +324,66 @@ console.log('Messages:', result.messages.length);
324
324
 
325
325
  ## MapLLM Document Processing
326
326
 
327
- Map-reduce pattern for large documents:
327
+ True map-reduce pattern for large documents with structured outputs and callback-driven accumulation:
328
328
 
329
329
  ```typescript
330
- import { MapLLM, FileNativeLoader } from '@agentic-api';
330
+ import { MapLLM, FileNativeLoader, StringNativeLoader } from '@agentic-api';
331
331
 
332
+ // Chunking strategies: lines, pages, paragraphs, overlap
332
333
  const loader = new FileNativeLoader('document.pdf', { type: 'pages', size: 1 });
333
334
  const mapper = new MapLLM(loader);
334
335
 
335
336
  const config = {
336
- digestPrompt: "Analyze this chunk for key information.",
337
- reducePrompt: "Merge analysis with previous results."
337
+ digestPrompt: "Analyze this chunk and extract key points.",
338
+ reducePrompt: "Merge this analysis with previous results.",
339
+ reduceModulo: 5 // Optional: reduce every N chunks
338
340
  };
339
341
 
342
+ // Callback controls accumulation and termination
340
343
  const result = await mapper.reduce(config, (result, currentValue) => {
341
- result.acc = result.acc + `\n${currentValue}\n`;
344
+ // Structured output support
345
+ result.format = { name: "analysis", schema: myJsonSchema, strict: true };
346
+ result.acc = { ...result.acc, ...currentValue };
347
+
348
+ // Stop conditions
342
349
  if (result.metadata.iterations > 20) result.maxIterations = true;
343
350
  return result;
344
- }, { acc: "", model: 'LOW-fast', verbose: true });
351
+ }, { acc: {}, model: 'LOW', verbose: true });
345
352
  ```
346
353
 
347
354
  **Documentation:** [MapLLM](./docs/10.AGENTS.MAPLLM.md)
348
355
 
349
356
  ---
350
357
 
358
+ ## JobRunner (Plan → Execute → Reduce)
359
+
360
+ Sequential task execution engine for complex multi-objective requests:
361
+
362
+ ```typescript
363
+ import { JobRunner, jobPlannerPrompt } from '@agentic-api';
364
+
365
+ // JobRunner workflow:
366
+ // 1. Planner: userRequest → JobPlan (list of TaskSpec)
367
+ // 2. Executor: TaskSpec + memory → TaskResult
368
+ // 3. Reducer: (prevMemory, task, result) → ReducedJobMemory (via MapLLM)
369
+
370
+ // Features:
371
+ // - Strict contracts (structured outputs / schema validation)
372
+ // - Context reduction after each task via MapLLM reducer
373
+ // - Error policy: 2 attempts max per task, then thrown → synthesis
374
+ // - Sequential deterministic execution (V1)
375
+ ```
376
+
377
+ **Key Contracts:**
378
+ - `JobPlan`: jobId, goal, tasks[]
379
+ - `TaskSpec`: id, title, type, dependsOn[], acceptance[]
380
+ - `TaskResult`: taskId, ok, summary, data, artifacts[], error
381
+ - `ReducedJobMemory`: memory (short canonical), index (stable refs)
382
+
383
+ **Documentation:** [JobRunner](./docs/10.AGENTS.JOB.md)
384
+
385
+ ---
386
+
351
387
  ## Rules Management System
352
388
 
353
389
  Git-based workflow for business documents:
@@ -409,7 +445,7 @@ npm test
409
445
 
410
446
  ## License
411
447
 
412
- MIT License - Copyright (c) 2024-2026 Pilet & Renaud SA
448
+ MIT License - Copyright (c) 2024-2026 olivier@evaletolab.ch
413
449
 
414
450
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
415
451
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-api",
3
- "version": "2.0.641",
3
+ "version": "2.0.642",
4
4
  "description": "API pour l'orchestration d'agents intelligents avec séquences et escalades automatiques",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",