@cognipeer/agent-sdk 0.7.0 → 0.7.2

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/README.md CHANGED
@@ -36,6 +36,7 @@ Highlights:
36
36
  - **Planning mode** – adaptive system prompt + TODO tool supports full plan writes and version-safe partial updates.
37
37
  - **Unified reasoning surface** – one `reasoning` config controls provider-native reasoning and post-tool plain-text reflections.
38
38
  - **Structured output** – provide a Zod schema and the agent injects a finalize tool to capture JSON deterministically.
39
+ - **Skills / progressive disclosure** – expose cheap capability headers first, then bind skill tools on demand with `open_skill` and `bind_skill_tools`.
39
40
  - **Multi-agent and handoffs** – wrap agents as tools or transfer control mid-run with `asTool` / `asHandoff`.
40
41
  - **Human-in-the-loop** – `needsApproval` tools pause for review; `humanInTheLoop.askUser` enables a built-in `ask_user_question` tool that pauses with a structured multi-choice prompt and resumes from the user's answer.
41
42
  - **Usage + events** – normalize provider usage, surface `tool_call`, `tool_approval`, `user_question`, `plan`, `summarization`, `reflection`, `metadata`, and `handoff` events.
@@ -165,7 +166,33 @@ Tool-response retention is lazy and summarizer-driven:
165
166
  - `criticalTools` are never reduced. The built-in list covers `response`, `manage_todo_list`, and `get_tool_response`.
166
167
  - `maxToolResponseChars` / `maxToolResponseTokens` only drive an eager hard-cap truncation when a single tool output is big enough to blow up the very next model call. The truncated head always points at `get_tool_response` for recovery.
167
168
 
168
- The smart wrapper now supports runtime presets (`fast`, `balanced`, `deep`, `research`), custom profiles layered on top of a base preset, structured summarization, hybrid context compaction, configurable tool-response retention, in-memory fact storage, delegation limits, and an eval harness via `runSmartAgentEvalHarness(...)`.
169
+ The smart wrapper now supports runtime presets (`fast`, `balanced`, `deep`, `research`), custom profiles layered on top of a base preset, structured summarization, hybrid context compaction, skill-based progressive disclosure, configurable tool-response retention, in-memory fact storage, delegation limits, and an eval harness via `runSmartAgentEvalHarness(...)`.
170
+
171
+ For large or optional tool catalogs, pass `skills` instead of binding every tool directly:
172
+
173
+ ```ts
174
+ import { createSmartAgent, type Skill } from "@cognipeer/agent-sdk";
175
+
176
+ const pdfSkill: Skill = {
177
+ key: "builtin:pdf",
178
+ title: "PDF",
179
+ header: "read and summarize PDF files when the user references a PDF",
180
+ prompt: "Use pdf_read before pdf_summarize and preserve file ids in the answer.",
181
+ listToolIndex: () => [
182
+ { name: "pdf_read", description: "Extract PDF text by file id" },
183
+ { name: "pdf_summarize", description: "Summarize extracted PDF text" },
184
+ ],
185
+ bindTools: (names) => bindPdfTools(names),
186
+ };
187
+
188
+ const agent = createSmartAgent({
189
+ model,
190
+ skills: [pdfSkill],
191
+ skillPolicy: { maxOpenSkills: 2, maxBoundToolsPerSkill: 8, maxBoundToolsTotal: 24 },
192
+ });
193
+ ```
194
+
195
+ The model sees the skill header first. It calls `open_skill` to load the skill prompt and either bind a small skill immediately or get a tool index for `bind_skill_tools`.
169
196
 
170
197
  You can also define a custom profile by extending a built-in preset and overriding only the knobs you need:
171
198