@framers/agentos 0.1.98 → 0.1.100
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 +60 -13
- package/dist/api/agency.d.ts +51 -0
- package/dist/api/agency.d.ts.map +1 -0
- package/dist/api/agency.js +814 -0
- package/dist/api/agency.js.map +1 -0
- package/dist/api/agent.d.ts +15 -54
- package/dist/api/agent.d.ts.map +1 -1
- package/dist/api/agent.js +14 -7
- package/dist/api/agent.js.map +1 -1
- package/dist/api/generateText.d.ts +16 -0
- package/dist/api/generateText.d.ts.map +1 -1
- package/dist/api/generateText.js.map +1 -1
- package/dist/api/hitl.d.ts +139 -0
- package/dist/api/hitl.d.ts.map +1 -0
- package/dist/api/hitl.js +211 -0
- package/dist/api/hitl.js.map +1 -0
- package/dist/api/strategies/debate.d.ts +16 -0
- package/dist/api/strategies/debate.d.ts.map +1 -0
- package/dist/api/strategies/debate.js +118 -0
- package/dist/api/strategies/debate.js.map +1 -0
- package/dist/api/strategies/hierarchical.d.ts +20 -0
- package/dist/api/strategies/hierarchical.d.ts.map +1 -0
- package/dist/api/strategies/hierarchical.js +140 -0
- package/dist/api/strategies/hierarchical.js.map +1 -0
- package/dist/api/strategies/index.d.ts +41 -0
- package/dist/api/strategies/index.d.ts.map +1 -0
- package/dist/api/strategies/index.js +95 -0
- package/dist/api/strategies/index.js.map +1 -0
- package/dist/api/strategies/parallel.d.ts +17 -0
- package/dist/api/strategies/parallel.d.ts.map +1 -0
- package/dist/api/strategies/parallel.js +122 -0
- package/dist/api/strategies/parallel.js.map +1 -0
- package/dist/api/strategies/review-loop.d.ts +18 -0
- package/dist/api/strategies/review-loop.d.ts.map +1 -0
- package/dist/api/strategies/review-loop.js +153 -0
- package/dist/api/strategies/review-loop.js.map +1 -0
- package/dist/api/strategies/sequential.d.ts +15 -0
- package/dist/api/strategies/sequential.d.ts.map +1 -0
- package/dist/api/strategies/sequential.js +205 -0
- package/dist/api/strategies/sequential.js.map +1 -0
- package/dist/api/strategies/shared.d.ts +36 -0
- package/dist/api/strategies/shared.d.ts.map +1 -0
- package/dist/api/strategies/shared.js +82 -0
- package/dist/api/strategies/shared.js.map +1 -0
- package/dist/api/types.d.ts +808 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +25 -0
- package/dist/api/types.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
|
|
25
25
|
- [Overview](#overview)
|
|
26
26
|
- [Quick Start](#quick-start)
|
|
27
|
-
- [
|
|
28
|
-
- [Low-Level
|
|
27
|
+
- [Multi-Agent Teams with agency()](#multi-agent-teams-with-agency)
|
|
28
|
+
- [Single-Agent and Low-Level Helpers](#single-agent-and-low-level-helpers)
|
|
29
|
+
- [Advanced: AgentGraph and Full Runtime](#advanced-agentgraph-and-full-runtime)
|
|
29
30
|
- [System Architecture](#system-architecture)
|
|
30
31
|
- [Architecture Diagram](#architecture-diagram)
|
|
31
32
|
- [Request Lifecycle](#request-lifecycle)
|
|
@@ -149,18 +150,57 @@ npm install @framers/agentos
|
|
|
149
150
|
|
|
150
151
|
**Start here:**
|
|
151
152
|
|
|
152
|
-
- Use [`
|
|
153
|
-
- Use [`
|
|
154
|
-
-
|
|
153
|
+
- Use [`agency()`](./docs/AGENCY_API.md) to coordinate a team of agents with a single call.
|
|
154
|
+
- Use [`generateText()` / `streamText()` / `generateImage()` / `agent()`](./docs/HIGH_LEVEL_API.md) for the fastest path from prompt to working code.
|
|
155
|
+
- Use [`AgentOS`](#advanced-agentgraph-and-full-runtime) when you need extensions, workflows, personas, or full runtime lifecycle control.
|
|
156
|
+
- Browse the live docs at [docs.agentos.sh/getting-started/high-level-api](https://docs.agentos.sh/getting-started/high-level-api) and [docs.agentos.sh/api](https://docs.agentos.sh/api).
|
|
155
157
|
|
|
156
|
-
###
|
|
158
|
+
### Multi-Agent Teams with `agency()`
|
|
157
159
|
|
|
158
|
-
|
|
160
|
+
`agency()` is the recommended starting point for any task that benefits from
|
|
161
|
+
multiple specialised agents. Three lines to go from prompt to a coordinated
|
|
162
|
+
research-and-writing pipeline:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import { agency } from '@framers/agentos';
|
|
166
|
+
|
|
167
|
+
const team = agency({
|
|
168
|
+
agents: {
|
|
169
|
+
researcher: { instructions: 'Find relevant facts.' },
|
|
170
|
+
writer: { instructions: 'Write a clear, concise summary.' },
|
|
171
|
+
},
|
|
172
|
+
strategy: 'sequential',
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
const result = await team.generate('Summarise recent advances in fusion energy.');
|
|
176
|
+
console.log(result.text);
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Set `OPENAI_API_KEY` (or another provider's key) and the agency auto-detects the
|
|
180
|
+
provider. All five strategies are available out of the box:
|
|
181
|
+
|
|
182
|
+
| Strategy | What it does |
|
|
183
|
+
|---|---|
|
|
184
|
+
| `sequential` | Agents run in order; each receives the previous output as context |
|
|
185
|
+
| `parallel` | All agents run concurrently; results are merged by a synthesis step |
|
|
186
|
+
| `debate` | Agents argue and refine a shared answer over multiple rounds |
|
|
187
|
+
| `review-loop` | One agent drafts, another reviews and requests revisions |
|
|
188
|
+
| `hierarchical` | A coordinator dispatches sub-tasks to specialist agents at runtime |
|
|
189
|
+
|
|
190
|
+
Add guardrails, HITL, resource controls, observability, `listen()` for voice
|
|
191
|
+
transport, `connect()` for channel adapters, RAG context injection, and real
|
|
192
|
+
per-agent stream events in the same config object — see
|
|
193
|
+
[`docs/AGENCY_API.md`](./docs/AGENCY_API.md) for the full reference.
|
|
194
|
+
|
|
195
|
+
### Single-Agent and Low-Level Helpers
|
|
196
|
+
|
|
197
|
+
Use the streamlined helpers when you want AI SDK-style text generation, image
|
|
198
|
+
generation, or a single stateful session without a multi-agent team.
|
|
159
199
|
|
|
160
200
|
```typescript
|
|
161
201
|
import { agent, generateImage, generateText, streamText } from '@framers/agentos';
|
|
162
202
|
|
|
163
|
-
// Provider-first:
|
|
203
|
+
// Provider-first: AgentOS picks the best default model automatically.
|
|
164
204
|
// Requires OPENAI_API_KEY (or the matching env var) to be set.
|
|
165
205
|
const quick = await generateText({
|
|
166
206
|
provider: 'openai',
|
|
@@ -219,8 +259,7 @@ With `enabled: true`, AgentOS writes to the shared home ledger at `~/.framers/us
|
|
|
219
259
|
|
|
220
260
|
Built-in image providers: `openai`, `openrouter`, `stability`, and `replicate`.
|
|
221
261
|
|
|
222
|
-
Use `providerOptions` when you need provider-native controls without leaving the
|
|
223
|
-
high-level API:
|
|
262
|
+
Use `providerOptions` when you need provider-native controls without leaving the high-level API:
|
|
224
263
|
|
|
225
264
|
```typescript
|
|
226
265
|
const poster = await generateImage({
|
|
@@ -239,9 +278,11 @@ const poster = await generateImage({
|
|
|
239
278
|
|
|
240
279
|
Runnable examples: [`examples/high-level-api.mjs`](./examples/high-level-api.mjs), [`examples/generate-image.mjs`](./examples/generate-image.mjs)
|
|
241
280
|
|
|
242
|
-
|
|
281
|
+
### Advanced: AgentGraph and Full Runtime
|
|
243
282
|
|
|
244
|
-
|
|
283
|
+
Use `AgentGraph` or the full `AgentOS` runtime when you need programmatic graph
|
|
284
|
+
construction with custom edge callbacks, extensions, workflow DSL, personas,
|
|
285
|
+
chunk-level streaming events, or full runtime lifecycle control.
|
|
245
286
|
|
|
246
287
|
```typescript
|
|
247
288
|
import { AgentOS, AgentOSResponseChunkType } from '@framers/agentos';
|
|
@@ -261,6 +302,10 @@ for await (const chunk of agent.processRequest({
|
|
|
261
302
|
}
|
|
262
303
|
```
|
|
263
304
|
|
|
305
|
+
See [`docs/AGENT_GRAPH.md`](./docs/AGENT_GRAPH.md) for the `AgentGraph` programmatic
|
|
306
|
+
graph builder and [`docs/WORKFLOW_DSL.md`](./docs/WORKFLOW_DSL.md) for the workflow
|
|
307
|
+
DSL.
|
|
308
|
+
|
|
264
309
|
---
|
|
265
310
|
|
|
266
311
|
## System Architecture
|
|
@@ -1857,10 +1902,12 @@ Wildcard exports support paths up to 4 levels deep:
|
|
|
1857
1902
|
|
|
1858
1903
|
## Internal Documentation
|
|
1859
1904
|
|
|
1860
|
-
The `docs/` directory contains
|
|
1905
|
+
The `docs/` directory contains specification and reference documents:
|
|
1861
1906
|
|
|
1862
1907
|
| Document | Description |
|
|
1863
1908
|
|----------|-------------|
|
|
1909
|
+
| [`AGENCY_API.md`](docs/AGENCY_API.md) | `agency()` reference: all 5 strategies, HITL, guardrails, RAG, voice, nested agencies, full-featured example |
|
|
1910
|
+
| [`HIGH_LEVEL_API.md`](docs/HIGH_LEVEL_API.md) | `generateText()`, `streamText()`, `generateImage()`, single `agent()` |
|
|
1864
1911
|
| [`ARCHITECTURE.md`](docs/ARCHITECTURE.md) | Complete system architecture with data flow diagrams |
|
|
1865
1912
|
| [`SAFETY_PRIMITIVES.md`](docs/SAFETY_PRIMITIVES.md) | Circuit breaker, cost guard, stuck detection, dedup API reference |
|
|
1866
1913
|
| [`PLANNING_ENGINE.md`](docs/PLANNING_ENGINE.md) | ReAct reasoning, multi-step task planning specification |
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file agency.ts
|
|
3
|
+
* Multi-agent agency factory for the AgentOS high-level API.
|
|
4
|
+
*
|
|
5
|
+
* `agency()` accepts an {@link AgencyOptions} configuration, compiles the
|
|
6
|
+
* requested orchestration strategy, wires resource controls, and returns a
|
|
7
|
+
* single {@link Agent}-compatible interface that coordinates all sub-agents.
|
|
8
|
+
*
|
|
9
|
+
* The returned instance exposes `generate`, `stream`, `session`, `usage`, and
|
|
10
|
+
* `close` — identical surface to a single `agent()` instance — so callers can
|
|
11
|
+
* swap between them transparently.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { agency, hitl } from '@framers/agentos';
|
|
16
|
+
*
|
|
17
|
+
* const myAgency = agency({
|
|
18
|
+
* model: 'openai:gpt-4o',
|
|
19
|
+
* strategy: 'sequential',
|
|
20
|
+
* agents: {
|
|
21
|
+
* researcher: { instructions: 'Find relevant information.' },
|
|
22
|
+
* writer: { instructions: 'Write a clear summary.' },
|
|
23
|
+
* },
|
|
24
|
+
* controls: { maxTotalTokens: 50_000, onLimitReached: 'warn' },
|
|
25
|
+
* hitl: { approvals: { beforeTool: ['delete'] }, handler: hitl.autoApprove() },
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const result = await myAgency.generate('Summarise recent AI research.');
|
|
29
|
+
* console.log(result.text);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import type { AgencyOptions, Agent } from './types.js';
|
|
33
|
+
/**
|
|
34
|
+
* Creates a multi-agent agency that coordinates a named roster of sub-agents
|
|
35
|
+
* using the specified orchestration strategy.
|
|
36
|
+
*
|
|
37
|
+
* The agency validates configuration immediately and throws an
|
|
38
|
+
* {@link AgencyConfigError} on any structural problem so issues surface at
|
|
39
|
+
* wiring time rather than the first call.
|
|
40
|
+
*
|
|
41
|
+
* @param opts - Full agency configuration including the `agents` roster, optional
|
|
42
|
+
* `strategy`, `controls`, `hitl`, and `observability` settings.
|
|
43
|
+
* @returns An {@link Agent} instance whose `generate` / `stream` / `session` methods
|
|
44
|
+
* invoke the compiled strategy over the configured sub-agents.
|
|
45
|
+
* @throws {AgencyConfigError} When the configuration is structurally invalid
|
|
46
|
+
* (e.g. no agents defined, emergent enabled without hierarchical strategy,
|
|
47
|
+
* HITL approvals configured without a handler, parallel/debate without a
|
|
48
|
+
* synthesis model).
|
|
49
|
+
*/
|
|
50
|
+
export declare function agency(opts: AgencyOptions): Agent;
|
|
51
|
+
//# sourceMappingURL=agency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agency.d.ts","sourceRoot":"","sources":["../../src/api/agency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,KAAK,EACV,aAAa,EACb,KAAK,EASN,MAAM,YAAY,CAAC;AAOpB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,KAAK,CAoXjD"}
|