@nylorun/agents 0.16.0-beta → 0.16.1-beta

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 (3) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +33 -10
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @nylorun/agents
2
2
 
3
+ ## 0.16.1-beta
4
+
5
+ ### Patch Changes
6
+
7
+ - cb29dea: **READMEs for manifest-only agents.** Documentation only; no code changes.
8
+
9
+ - `@nylorun/agents`: the Flow agents example opens the PR with an `http()` tool stage instead of a code tool, and shows how to keep a person's approval: a flow stage cannot take `approval` yet (`flow.approval-unsupported`), so the HTTP tool goes to an agent stage with `approval: "always"`. Requests set `Nylorun-Protocol` 8. The subagents section says `ctx.state`, `ctx.agent` and `ctx.ask`/`ctx.approve` apply only to `tool({ run })` in the local engine.
10
+ - `@nylorun/cli`: no longer says `nylo endpoints` uses the Runtime API or replaces `nylo tenant endpoints`; it was removed with Action endpoints and exits 2.
11
+
3
12
  ## 0.16.0-beta
4
13
 
5
14
  ### Major Changes
package/README.md CHANGED
@@ -127,7 +127,7 @@ eval "$(npx @nylorun/cli env)"
127
127
  # → NYLORUN_RUNTIME_URL, NYLORUN_SERVER_KEY
128
128
  ```
129
129
 
130
- Every request sets `Nylorun-Protocol` (6) and no `Nylorun-Tenant`: the Runtime
130
+ Every request sets `Nylorun-Protocol` (8) and no `Nylorun-Tenant`: the Runtime
131
131
  serves one Tenant. Before the first authenticated
132
132
  request, `Transport` fetches `/health` once, checks protocol compatibility, and
133
133
  throws `IncompatibleRuntimeError` / `incompatible_host` when the Host range or
@@ -218,11 +218,11 @@ const support = Agent({ id: "support" })
218
218
  .subagents(researcher);
219
219
  ```
220
220
 
221
- The tool is named after the agent's `id` and takes `{ task: string }`; the agent's `description` (required) is what the parent's model reads to decide when to delegate. The child starts with a fresh context: it sees its own instructions and the task, nothing of the parent's conversation, and only its final text (or `outputSchema` result) comes back. It keeps its own tools, skills and MCP servers, saved with the parent, shares the session's sandbox, and starts with empty `ctx.state`. Tools can read `ctx.agent` (`{ id, path, delegationId }`). Several delegation calls in one model response run in parallel. An empty answer, a failure (with the child's last text marked as evidence) or a cancelled child reaches the parent's model as a failed tool result, never as success. The Runtime emits `delegation.started` and `delegation.completed`; `session.history({ agent })` filters by `delegationId` (one child invocation) or by path such as `support/researcher` (every concurrent child that shares that path).
221
+ The tool is named after the agent's `id` and takes `{ task: string }`; the agent's `description` (required) is what the parent's model reads to decide when to delegate. The child starts with a fresh context: it sees its own instructions and the task, nothing of the parent's conversation, and only its final text (or `outputSchema` result) comes back. It keeps its own tools, skills and MCP servers, saved with the parent, and shares the session's sandbox. Several delegation calls in one model response run in parallel. An empty answer, a failure (with the child's last text marked as evidence) or a cancelled child reaches the parent's model as a failed tool result, never as success. The Runtime emits `delegation.started` and `delegation.completed`; `session.history({ agent })` filters by `delegationId` (one child invocation) or by path such as `support/researcher` (every concurrent child that shares that path).
222
222
 
223
223
  A flow agent can be a subagent too: `.subagents(researchFlow)` with a `description` like any other. Its manifest is inlined in the parent's, so it is saved with the parent. When the model calls it, the flow runs on the Runtime in its own linked session (a fresh one per call, linked from the parent's with a `node.agent` event at `support/<flow id>`), its agents in theirs, and the flow's output comes back as the tool result; a failed flow is a failed tool result. Cancelling the parent cancels the flow. Flow agents as subagents run on the Runtime only, not in a local `run()`. An approval asked for inside the flow waits on the flow's own session.
224
224
 
225
- Delegate when the parent should keep the answer. When a specialist should own the rest of the conversation, send the next message with a turn manifest that has the specialist's instructions instead. This version is one level deep and non-interactive: a delegated agent cannot use agents as tools, its tools cannot declare `approval` (keep those on the parent), and `ctx.ask`, `ctx.approve`, `ctx.sleep` or `ctx.waitFor` inside it fail with `delegation.interaction-unsupported`. Delegation is not an approval boundary; approvals live on tools.
225
+ Delegate when the parent should keep the answer. When a specialist should own the rest of the conversation, send the next message with a turn manifest that has the specialist's instructions instead. This version is one level deep and non-interactive: a delegated agent cannot use agents as tools, and its tools cannot declare `approval` (keep those on the parent). In the local engine (`@nylorun/harness/run`), a delegated agent's `tool({ run })` tools start with empty `ctx.state`, can read `ctx.agent` (`{ id, path, delegationId }`), and fail with `delegation.interaction-unsupported` on `ctx.ask`, `ctx.approve`, `ctx.sleep` or `ctx.waitFor`. Delegation is not an approval boundary; approvals live on tools.
226
226
 
227
227
  ## Flow agents
228
228
 
@@ -239,7 +239,7 @@ gets the previous stage's output. So each agent returns, through its `.output()`
239
239
  what the next stage needs.
240
240
 
241
241
  ```ts
242
- import { Agent, VerdictSchema, tool } from "@nylorun/agents";
242
+ import { Agent, VerdictSchema, http } from "@nylorun/agents";
243
243
  import { z } from "zod";
244
244
 
245
245
  const planner = Agent({ id: "planner" })
@@ -258,13 +258,13 @@ const prWriter = Agent({ id: "pr-writer" })
258
258
  .instructions("Return the summaries you are given as { summaries }.")
259
259
  .output(z.object({ summaries: z.array(z.string()) }));
260
260
 
261
- const openPr = tool({
262
- name: "open-pr",
261
+ // Your service serves POST /pull-requests and answers { url }.
262
+ const openPr = http({
263
+ name: "open_pr",
263
264
  input: z.object({ summaries: z.array(z.string()) }),
264
- async run({ summaries }, ctx) {
265
- if (!(await ctx.approve("Open the PR?"))) throw new Error("Rejected");
266
- return { opened: true, count: summaries.length };
267
- },
265
+ output: z.object({ url: z.string() }),
266
+ url: "https://ci.example.com/pull-requests",
267
+ credential: "github",
268
268
  });
269
269
 
270
270
  export const shipFeature = Agent({ id: "ship-feature" })
@@ -275,6 +275,29 @@ export const shipFeature = Agent({ id: "ship-feature" })
275
275
  export const agents = [shipFeature];
276
276
  ```
277
277
 
278
+ A flow stage cannot take `approval` yet (`flow.approval-unsupported`). To have a person
279
+ approve opening the PR, give the HTTP tool to an agent as the last stage instead: that
280
+ agent's turn pauses until the call is approved, and the flow session's `pending()` lists
281
+ the wait:
282
+
283
+ ```ts
284
+ const prOpener = Agent({ id: "pr-opener" })
285
+ .instructions("Open one pull request with open_pr from the summaries you are given.")
286
+ .tools(
287
+ http({
288
+ name: "open_pr",
289
+ description: "Open a pull request with the given summaries.",
290
+ input: z.object({ summaries: z.array(z.string()) }),
291
+ url: "https://ci.example.com/pull-requests",
292
+ credential: "github",
293
+ approval: "always",
294
+ }),
295
+ );
296
+
297
+ // …
298
+ .pipe(prWriter, prOpener);
299
+ ```
300
+
278
301
  | Stage | Role |
279
302
  | --- | --- |
280
303
  | **`.pipe(a, b, …)`** | Run agents, tools or `flow()`s in order; each one's output is the next one's input |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/agents",
3
- "version": "0.16.0-beta",
3
+ "version": "0.16.1-beta",
4
4
  "description": "Nylorun agent definitions and session client",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",