@lloyal-labs/lloyal-agents 3.0.0 → 3.0.1
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 +56 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,48 +1,43 @@
|
|
|
1
1
|
# @lloyal-labs/lloyal-agents
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Run a team of agents on hardware that serves one.**
|
|
4
4
|
|
|
5
|
-
`lloyal-agents`
|
|
6
|
-
|
|
7
|
-
Built on [lloyal.node](https://github.com/lloyal-ai/lloyal.node), which provides forkable decode state and continuous tree batching over llama.cpp. `lloyal-agents` adds structured concurrency, tool dispatch, and a five-phase tick loop. Orchestration is not a layer above inference — it is inference.
|
|
8
|
-
|
|
9
|
-
<picture>
|
|
10
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/lloyal-ai/hdk/main/assets/continuous-context-dark.svg">
|
|
11
|
-
<img src="https://raw.githubusercontent.com/lloyal-ai/hdk/main/assets/continuous-context.svg" alt="Traditional Agents vs Continuous Context Agents — shared KV prefix, tool prefill, sub-agent spawning" width="100%">
|
|
12
|
-
</picture>
|
|
5
|
+
`lloyal-agents` schedules memory, not strings. An agent is a branch of the model's live attention state: shared context is **inherited, not re-sent** — a new agent attends over everything before its fork point without paying a token for it. Advancing the whole fleet costs one GPU forward pass per tick. The more your agents share, the cheaper they get — the inverse of the API-call model, where every agent re-reads the world on every step.
|
|
13
6
|
|
|
14
7
|
```bash
|
|
15
8
|
npm i @lloyal-labs/lloyal-agents @lloyal-labs/lloyal.node
|
|
16
9
|
```
|
|
17
10
|
|
|
18
|
-
|
|
11
|
+
```typescript
|
|
12
|
+
yield* withSpine({ systemPrompt: PLAYBOOKS, tools }, function* (spine) {
|
|
13
|
+
// spine is a prefilled branch — system prompt + tool schemas already in KV.
|
|
14
|
+
// Every agent forked from it shares that prefix physically.
|
|
15
|
+
return yield* agentPool({
|
|
16
|
+
orchestrate: parallel(
|
|
17
|
+
questions.map((q) => ({ content: q, systemPrompt: WORKER_PROMPT })),
|
|
18
|
+
),
|
|
19
|
+
tools: [...sourceTools, reportTool],
|
|
20
|
+
parent: spine,
|
|
21
|
+
terminalTool: "report",
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
```
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
Three things this buys you that N separate model calls can't:
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
agentPool, // multi-agent pool with a swappable orchestrator
|
|
27
|
-
useAgentPool, // lower-level Effection resource (advanced)
|
|
28
|
-
diverge, // multi-branch perplexity selection
|
|
29
|
-
parallel, chain, fanout, dag, reduce, // orchestrators / combinators
|
|
30
|
-
withSpine, // scoped spine branch with guaranteed teardown
|
|
31
|
-
Tool, Source,
|
|
32
|
-
DefaultAgentPolicy,
|
|
33
|
-
Ctx, Store, Events,
|
|
34
|
-
// App protocol primitives — types + contexts the registry + agent pool
|
|
35
|
-
// pick up. Construction lives in `@lloyal-labs/rig` (`defineApp`,
|
|
36
|
-
// `createAppRegistry`).
|
|
37
|
-
AppRegistryCtx, AppConfigStoreCtx, GrantStoreCtx, RerankerCtx,
|
|
38
|
-
} from "@lloyal-labs/lloyal-agents";
|
|
28
|
+
- **Shared prefix, paid once.** Agents don't get told what their siblings know — they *attended over the same tokens*. Context sharing happens in the attention mechanism, not in prompt plumbing.
|
|
29
|
+
- **True concurrency on one GPU.** Continuous tree batching packs every agent's next token into a single `llama_batch` — eight agents stream in lockstep on hardware that serves one.
|
|
30
|
+
- **Agents are virtual processes over branches of the model's attention.** Structured concurrency gives each branch a real process lifecycle — spawn a sub-agent from a live thought mid-reasoning, halt a subtree and its KV is reclaimed, exit a scope and teardown is guaranteed. If an agent is cut under context pressure, recovery extracts its findings from the attention state it leaves behind.
|
|
31
|
+
- **Deep agents are native, not orchestrated.** Elsewhere, a sub-agent is a fresh conversation handed a task brief — everything the parent knew gets squeezed through a prompt and re-paid for. Here a sub-agent is a fork of the parent's live attention: it inherits everything, instantly, for free — or forks from the clean shared spine when you *want* quarantine. Delegation nests to any depth; each subtree is a scope that unwinds cleanly.
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
Local models, your hardware: prebuilt binaries for macOS (Metal), Linux and Windows (CPU, CUDA, Vulkan) via [`lloyal.node`](https://github.com/lloyal-ai/lloyal.node).
|
|
34
|
+
|
|
35
|
+
**[Docs →](https://docs.lloyal.ai)** · **[The HDK →](https://github.com/lloyal-ai/hdk)** · built on this runtime: [`npx reasoning.run`](https://www.npmjs.com/package/reasoning.run)
|
|
36
|
+
|
|
37
|
+
<picture>
|
|
38
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/lloyal-ai/hdk/main/assets/continuous-context-dark.svg">
|
|
39
|
+
<img src="https://raw.githubusercontent.com/lloyal-ai/hdk/main/assets/continuous-context.svg" alt="Traditional Agents vs Continuous Context Agents — shared KV prefix, tool prefill, sub-agent spawning" width="100%">
|
|
40
|
+
</picture>
|
|
46
41
|
|
|
47
42
|
## Bootstrap
|
|
48
43
|
|
|
@@ -253,6 +248,33 @@ Scaffold an App with `npx harness.dev app <name>`; install one with `npx harness
|
|
|
253
248
|
|
|
254
249
|
Full positioning, mechanics, learn pages, and reference at [docs.lloyal.ai](https://docs.lloyal.ai).
|
|
255
250
|
|
|
251
|
+
## Surface at a glance
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import {
|
|
255
|
+
initAgents, // bootstrap: session, store, event channel
|
|
256
|
+
useAgent, agent, // single-agent helpers
|
|
257
|
+
agentPool, // multi-agent pool with a swappable orchestrator
|
|
258
|
+
useAgentPool, // lower-level Effection resource (advanced)
|
|
259
|
+
diverge, // multi-branch perplexity selection
|
|
260
|
+
parallel, chain, fanout, dag, reduce, // orchestrators / combinators
|
|
261
|
+
withSpine, // scoped spine branch with guaranteed teardown
|
|
262
|
+
Tool, Source,
|
|
263
|
+
DefaultAgentPolicy,
|
|
264
|
+
Ctx, Store, Events,
|
|
265
|
+
// App protocol primitives — types + contexts the registry + agent pool
|
|
266
|
+
// pick up. Construction lives in `@lloyal-labs/rig` (`defineApp`,
|
|
267
|
+
// `createAppRegistry`).
|
|
268
|
+
AppRegistryCtx, AppConfigStoreCtx, GrantStoreCtx, RerankerCtx,
|
|
269
|
+
} from "@lloyal-labs/lloyal-agents";
|
|
270
|
+
|
|
271
|
+
import type {
|
|
272
|
+
App, AppManifest, AppProtocol, AppFactory, AppState,
|
|
273
|
+
AgentRenderCtx, SkillTemplateFn,
|
|
274
|
+
AppConfigStore, GrantStore,
|
|
275
|
+
} from "@lloyal-labs/lloyal-agents";
|
|
276
|
+
```
|
|
277
|
+
|
|
256
278
|
## License
|
|
257
279
|
|
|
258
280
|
See [LICENSE](./LICENSE) (Functional Source License 1.1 — Apache 2.0 Future License) and the [licensing FAQ](./LICENSE-FAQ.md).
|
package/package.json
CHANGED