@framers/agentos 0.1.97 → 0.1.99
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 +58 -13
- package/dist/api/agency.d.ts +51 -0
- package/dist/api/agency.d.ts.map +1 -0
- package/dist/api/agency.js +645 -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 +94 -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 +806 -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/discovery/CapabilityDiscoveryEngine.d.ts +7 -0
- package/dist/discovery/CapabilityDiscoveryEngine.d.ts.map +1 -1
- package/dist/discovery/CapabilityDiscoveryEngine.js +21 -0
- package/dist/discovery/CapabilityDiscoveryEngine.js.map +1 -1
- package/dist/discovery/types.d.ts +2 -0
- package/dist/discovery/types.d.ts.map +1 -1
- package/dist/emergent/EmergentCapabilityEngine.d.ts +16 -0
- package/dist/emergent/EmergentCapabilityEngine.d.ts.map +1 -1
- package/dist/emergent/EmergentCapabilityEngine.js +51 -0
- package/dist/emergent/EmergentCapabilityEngine.js.map +1 -1
- package/dist/emergent/EmergentToolRegistry.d.ts +8 -0
- package/dist/emergent/EmergentToolRegistry.d.ts.map +1 -1
- package/dist/emergent/EmergentToolRegistry.js +42 -1
- package/dist/emergent/EmergentToolRegistry.js.map +1 -1
- package/dist/emergent/ToolPackage.d.ts +57 -0
- package/dist/emergent/ToolPackage.d.ts.map +1 -0
- package/dist/emergent/ToolPackage.js +145 -0
- package/dist/emergent/ToolPackage.js.map +1 -0
- package/dist/emergent/index.d.ts +2 -0
- package/dist/emergent/index.d.ts.map +1 -1
- package/dist/emergent/index.js +1 -0
- package/dist/emergent/index.js.map +1 -1
- package/dist/emergent/types.d.ts +27 -0
- package/dist/emergent/types.d.ts.map +1 -1
- package/dist/emergent/types.js +2 -0
- package/dist/emergent/types.js.map +1 -1
- 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,55 @@ 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, and observability in the same config
|
|
191
|
+
object — see [`docs/AGENCY_API.md`](./docs/AGENCY_API.md) for the full reference.
|
|
192
|
+
|
|
193
|
+
### Single-Agent and Low-Level Helpers
|
|
194
|
+
|
|
195
|
+
Use the streamlined helpers when you want AI SDK-style text generation, image
|
|
196
|
+
generation, or a single stateful session without a multi-agent team.
|
|
159
197
|
|
|
160
198
|
```typescript
|
|
161
199
|
import { agent, generateImage, generateText, streamText } from '@framers/agentos';
|
|
162
200
|
|
|
163
|
-
// Provider-first:
|
|
201
|
+
// Provider-first: AgentOS picks the best default model automatically.
|
|
164
202
|
// Requires OPENAI_API_KEY (or the matching env var) to be set.
|
|
165
203
|
const quick = await generateText({
|
|
166
204
|
provider: 'openai',
|
|
@@ -219,8 +257,7 @@ With `enabled: true`, AgentOS writes to the shared home ledger at `~/.framers/us
|
|
|
219
257
|
|
|
220
258
|
Built-in image providers: `openai`, `openrouter`, `stability`, and `replicate`.
|
|
221
259
|
|
|
222
|
-
Use `providerOptions` when you need provider-native controls without leaving the
|
|
223
|
-
high-level API:
|
|
260
|
+
Use `providerOptions` when you need provider-native controls without leaving the high-level API:
|
|
224
261
|
|
|
225
262
|
```typescript
|
|
226
263
|
const poster = await generateImage({
|
|
@@ -239,9 +276,11 @@ const poster = await generateImage({
|
|
|
239
276
|
|
|
240
277
|
Runnable examples: [`examples/high-level-api.mjs`](./examples/high-level-api.mjs), [`examples/generate-image.mjs`](./examples/generate-image.mjs)
|
|
241
278
|
|
|
242
|
-
|
|
279
|
+
### Advanced: AgentGraph and Full Runtime
|
|
243
280
|
|
|
244
|
-
|
|
281
|
+
Use `AgentGraph` or the full `AgentOS` runtime when you need programmatic graph
|
|
282
|
+
construction with custom edge callbacks, extensions, workflow DSL, personas,
|
|
283
|
+
chunk-level streaming events, or full runtime lifecycle control.
|
|
245
284
|
|
|
246
285
|
```typescript
|
|
247
286
|
import { AgentOS, AgentOSResponseChunkType } from '@framers/agentos';
|
|
@@ -261,6 +300,10 @@ for await (const chunk of agent.processRequest({
|
|
|
261
300
|
}
|
|
262
301
|
```
|
|
263
302
|
|
|
303
|
+
See [`docs/AGENT_GRAPH.md`](./docs/AGENT_GRAPH.md) for the `AgentGraph` programmatic
|
|
304
|
+
graph builder and [`docs/WORKFLOW_DSL.md`](./docs/WORKFLOW_DSL.md) for the workflow
|
|
305
|
+
DSL.
|
|
306
|
+
|
|
264
307
|
---
|
|
265
308
|
|
|
266
309
|
## System Architecture
|
|
@@ -1857,10 +1900,12 @@ Wildcard exports support paths up to 4 levels deep:
|
|
|
1857
1900
|
|
|
1858
1901
|
## Internal Documentation
|
|
1859
1902
|
|
|
1860
|
-
The `docs/` directory contains
|
|
1903
|
+
The `docs/` directory contains specification and reference documents:
|
|
1861
1904
|
|
|
1862
1905
|
| Document | Description |
|
|
1863
1906
|
|----------|-------------|
|
|
1907
|
+
| [`AGENCY_API.md`](docs/AGENCY_API.md) | `agency()` reference: all 5 strategies, HITL, guardrails, RAG, voice, nested agencies, full-featured example |
|
|
1908
|
+
| [`HIGH_LEVEL_API.md`](docs/HIGH_LEVEL_API.md) | `generateText()`, `streamText()`, `generateImage()`, single `agent()` |
|
|
1864
1909
|
| [`ARCHITECTURE.md`](docs/ARCHITECTURE.md) | Complete system architecture with data flow diagrams |
|
|
1865
1910
|
| [`SAFETY_PRIMITIVES.md`](docs/SAFETY_PRIMITIVES.md) | Circuit breaker, cost guard, stuck detection, dedup API reference |
|
|
1866
1911
|
| [`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,EAON,MAAM,YAAY,CAAC;AAOpB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,KAAK,CA0PjD"}
|