agentblit 0.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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/index.cjs +760 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +127 -0
- package/dist/index.d.ts +127 -0
- package/dist/index.js +720 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Datablit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# AgentBlit TypeScript SDK
|
|
2
|
+
|
|
3
|
+
Build LLM agents that combine AgentBlit remote tools with optional local TypeScript tools.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Published package:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install agentblit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Developing this repo locally:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install
|
|
17
|
+
npm run build
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
From this repo (uses `tsx` to run TypeScript directly):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
export OPENAI_API_KEY="your-openai-key"
|
|
26
|
+
export AGENTBLIT_API_KEY="your-agentblit-key"
|
|
27
|
+
# optional: export AGENTBLIT_URL="https://console.agentblit.com"
|
|
28
|
+
# optional: export MODEL="openai/gpt-4o-mini"
|
|
29
|
+
npm install
|
|
30
|
+
npm run example
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Source: [`examples/basic-agent.ts`](examples/basic-agent.ts).
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { Agent, tool } from "agentblit";
|
|
39
|
+
|
|
40
|
+
const add = tool({
|
|
41
|
+
description: "Add two integers.",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {
|
|
45
|
+
a: { type: "integer" },
|
|
46
|
+
b: { type: "integer" },
|
|
47
|
+
},
|
|
48
|
+
required: ["a", "b"],
|
|
49
|
+
},
|
|
50
|
+
})((a: number, b: number) => a + b);
|
|
51
|
+
|
|
52
|
+
const agent = new Agent({
|
|
53
|
+
model: "openai/gpt-4o-mini",
|
|
54
|
+
apiKey: process.env.OPENAI_API_KEY ?? "",
|
|
55
|
+
agentblitApiKey: process.env.AGENTBLIT_API_KEY ?? "",
|
|
56
|
+
customTools: [add],
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
for await (const chunk of agent.run("What is 200 + 30? Use tools if needed.")) {
|
|
60
|
+
process.stdout.write(chunk);
|
|
61
|
+
}
|
|
62
|
+
process.stdout.write("\n");
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Feature Parity with Python SDK
|
|
66
|
+
|
|
67
|
+
- Vendor routing for `openai`, `anthropic`, `gemini`, and `openrouter`
|
|
68
|
+
- AgentBlit remote tool listing/calling and local tool overrides
|
|
69
|
+
- `needs_approval` gating with callback or stdin prompt
|
|
70
|
+
- Streaming `agent.run()` loop with multi-round tool calling
|
|
71
|
+
- Memory summarization (`maxHistory`) with summary insertion
|
|
72
|
+
- Event tracking and batch flush (`agent_init`, `user_prompt`, `llm_call`, `tool_call`, `tools_updated`, `agent_loop_error`)
|
|
73
|
+
- `track()` for custom events
|