framework-agents 0.0.0-stage → 0.1.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 +66 -2
- package/dist/agent-25ZNQBEB.js +6 -0
- package/dist/agent-ZWGIDKF6.js +7 -0
- package/dist/agent-ZWGIDKF6.js.map +1 -0
- package/dist/chunk-77OZE2QD.js +1811 -0
- package/dist/chunk-77OZE2QD.js.map +1 -0
- package/dist/chunk-LUGUQQLR.js +1033 -0
- package/dist/cli.js +1209 -0
- package/dist/index.d.ts +2842 -0
- package/dist/index.js +3951 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -4
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# framework-agents
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript agent framework: a ReAct loop with validated tools, streaming, token/cost budgets, a middleware stack with human-in-the-loop, multi-agent orchestration (sequential / parallel / router, DAG workflows, swarms), a typed semantic graph, A2A serving, MCP clients, and a React companion package.
|
|
4
|
+
|
|
5
|
+
- **Runtime**: Node >= 20. Two production dependencies only (TogetherAI/OpenAI-compatible, Anthropic, and Ollama providers are `fetch`-based — no SDK lock-in).
|
|
6
|
+
- **Docs**: full guides + API reference live in the repo (`docs/` is an MkDocs site; published via GitHub Pages).
|
|
7
|
+
- **Live-tested**: every feature has an offline + gated live test suite hitting the real provider APIs.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install framework-agents
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Needs an OpenAI-compatible endpoint, Anthropic, or a local Ollama — configured via env keys (`TOGETHER_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `OLLAMA_*`) or passed inline.
|
|
16
|
+
|
|
17
|
+
## Agent + tool in 15 lines
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { Agent, defineTool, initChatModel } from "framework-agents";
|
|
21
|
+
import { z } from "zod";
|
|
22
|
+
|
|
23
|
+
const weather = defineTool({
|
|
24
|
+
name: "get_weather",
|
|
25
|
+
description: "Get the weather for a city.",
|
|
26
|
+
schema: z.object({ city: z.string() }), // reaches the provider wire: models see real arg shapes
|
|
27
|
+
execute: async ({ city }) => `18c in ${city}`,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const agent = new Agent({
|
|
31
|
+
model: initChatModel("together:Qwen/Qwen3.5-9B", { maxTokens: 1500 }),
|
|
32
|
+
tools: [weather],
|
|
33
|
+
budgets: { maxTokens: 5000, maxCostUsd: 0.05 }, // enforced after every model call
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const res = await agent.run("What's the weather in Tokyo?");
|
|
37
|
+
console.log(res.text, res.toolCalls, res.usage.costUsd);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Streaming
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
for await (const e of agent.stream("Plan my trip to Berlin")) {
|
|
44
|
+
if (e.type === "token") process.stdout.write(e.delta);
|
|
45
|
+
if (e.type === "tool_call") console.log("\n[tool]", e.name);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Token deltas arrive per model call; tool events stream live the moment the model dispatches (and the moment the result lands). Completions carry real `usage` (with `reasoningTokens`) and `costUsd` computed from the built-in price table — never guessed.
|
|
50
|
+
|
|
51
|
+
## Surface
|
|
52
|
+
|
|
53
|
+
| Area | Highlights |
|
|
54
|
+
|---|---|
|
|
55
|
+
| Event streaming | `run()` / `stream()` with typed events, abort + timeout, both `reasoning` field families (Together/OpenAI) parsed |
|
|
56
|
+
| Structured output | zod schemas as native `response_format` or a self-repairing tool loop |
|
|
57
|
+
| Budgets | token / USD / per-run deadline enforcement, per-model pricing table |
|
|
58
|
+
| Middleware | before/after model+tool hooks, retries with backoff honoring retryable verdicts, human-in-the-loop (checkpointed resume, wildcard approvals), fallback chains, PII redaction, filesystem + subagents + todos |
|
|
59
|
+
| State | persist history/state across restarts, snapshots, `pause()`/`resume()`, message edit + branching with timelines |
|
|
60
|
+
| Multi-agent | orchestration (3 strategies), DAG workflows per-node retries, autonomous handoff swarms with loop detection |
|
|
61
|
+
| Semantic | graph store with RDFS/OWL entailment + `why()` proofs, SHACL shapes, a validated write path, entity linking, ontology migration with conformance batteries |
|
|
62
|
+
| Serving | A2A server/client (JSON-RPC + SSE), per-context isolation, MCP stdio + HTTP clients |
|
|
63
|
+
| Python | same surface in `framework_agents` on PyPI — the A2A wire contract is conformance-tested across both stacks |
|
|
64
|
+
|
|
65
|
+
## Publishing docs
|
|
66
|
+
|
|
67
|
+
`docs/` builds with MkDocs (`mkdocs build --strict`) and deploys to GitHub Pages via `.github/workflows/docs.yml`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|