agent-neckbeard 1.1.2 → 1.1.3
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 +32 -10
- package/dist/index.cjs +346 -180
- package/dist/index.d.cts +96 -25
- package/dist/index.d.ts +96 -25
- package/dist/index.js +347 -181
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -34,7 +34,10 @@ import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
|
34
34
|
import { z } from 'zod';
|
|
35
35
|
|
|
36
36
|
const agent = new Agent({
|
|
37
|
-
|
|
37
|
+
sandbox: {
|
|
38
|
+
provider: 'e2b',
|
|
39
|
+
template: 'code-interpreter-v1',
|
|
40
|
+
},
|
|
38
41
|
inputSchema: z.object({ topic: z.string() }),
|
|
39
42
|
outputSchema: z.object({
|
|
40
43
|
title: z.string(),
|
|
@@ -56,7 +59,7 @@ const agent = new Agent({
|
|
|
56
59
|
},
|
|
57
60
|
});
|
|
58
61
|
|
|
59
|
-
const sandboxId = await agent.deploy(); // bundles, uploads
|
|
62
|
+
const sandboxId = await agent.deploy(); // bundles, uploads, returns sandboxId
|
|
60
63
|
const result = await agent.run({ topic: 'TypeScript generics' });
|
|
61
64
|
```
|
|
62
65
|
|
|
@@ -70,16 +73,22 @@ npm install agent-neckbeard
|
|
|
70
73
|
|
|
71
74
|
```bash
|
|
72
75
|
export E2B_API_KEY=your-key
|
|
76
|
+
export DAYTONA_API_KEY=your-key
|
|
73
77
|
export ANTHROPIC_API_KEY=your-key # Pass via envs config, not auto-forwarded
|
|
74
78
|
```
|
|
75
79
|
|
|
80
|
+
Pick the sandbox backend explicitly with `sandbox.provider`. Use the same public `sandbox.template` field for both providers: it maps to an E2B template or a Daytona snapshot.
|
|
81
|
+
|
|
76
82
|
## The Details
|
|
77
83
|
|
|
78
84
|
The constructor takes a few options:
|
|
79
85
|
|
|
80
86
|
```typescript
|
|
81
87
|
new Agent({
|
|
82
|
-
|
|
88
|
+
sandbox: {
|
|
89
|
+
provider: 'e2b' | 'daytona',
|
|
90
|
+
template: string, // E2B template or Daytona snapshot
|
|
91
|
+
},
|
|
83
92
|
inputSchema: ZodSchema,
|
|
84
93
|
outputSchema: ZodSchema,
|
|
85
94
|
run: (input, ctx) => Promise,
|
|
@@ -102,7 +111,7 @@ const sandboxId = await agent.deploy();
|
|
|
102
111
|
const result = await agent.run({ topic: 'hello' }, { sandboxId });
|
|
103
112
|
```
|
|
104
113
|
|
|
105
|
-
The `files` option downloads things into the sandbox before your agent runs—useful for models or config files. Relative paths resolve from `/home/user
|
|
114
|
+
The `files` option downloads things into the sandbox before your agent runs—useful for models or config files. Relative paths resolve from the sandbox home directory: `/home/user` on E2B and `/home/daytona` on Daytona.
|
|
106
115
|
|
|
107
116
|
The `claudeDir` option uploads a local `.claude/` directory to the sandbox, enabling Claude Agent SDK skills. Point it at a directory containing `.claude/skills/*/SKILL.md` files.
|
|
108
117
|
|
|
@@ -110,7 +119,10 @@ The `envs` option passes environment variables to the sandbox. These are availab
|
|
|
110
119
|
|
|
111
120
|
```typescript
|
|
112
121
|
const agent = new Agent({
|
|
113
|
-
|
|
122
|
+
sandbox: {
|
|
123
|
+
provider: 'e2b',
|
|
124
|
+
template: 'code-interpreter-v1',
|
|
125
|
+
},
|
|
114
126
|
envs: {
|
|
115
127
|
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
|
|
116
128
|
MY_API_KEY: process.env.MY_API_KEY,
|
|
@@ -121,7 +133,17 @@ const agent = new Agent({
|
|
|
121
133
|
|
|
122
134
|
Some packages can't be bundled because they spawn child processes or have native modules. The Claude Agent SDK is like this. These get automatically marked as external and installed via npm in the sandbox.
|
|
123
135
|
|
|
124
|
-
The `run` function gets a context object with an `executionId`, an `AbortSignal`, environment variables, and a logger
|
|
136
|
+
The `run` function gets a context object with an `executionId`, an `AbortSignal`, environment variables, sandbox paths, and a logger:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
run: async (input, ctx) => {
|
|
140
|
+
const notesPath = `${ctx.sandbox.homeDir}/data/notes.txt`;
|
|
141
|
+
const cwd = ctx.sandbox.agentDir;
|
|
142
|
+
// ...
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Use `ctx.sandbox.homeDir` and `ctx.sandbox.agentDir` instead of hardcoding `/home/user` if you want the same agent code to work on both providers.
|
|
125
147
|
|
|
126
148
|
## Testing
|
|
127
149
|
|
|
@@ -129,19 +151,19 @@ The `run` function gets a context object with an `executionId`, an `AbortSignal`
|
|
|
129
151
|
npm test
|
|
130
152
|
```
|
|
131
153
|
|
|
132
|
-
Jest drives both the fast local suite and the live
|
|
154
|
+
Jest drives both the fast local suite and the live smoke suites. Each live suite automatically skips when its provider key is not set:
|
|
133
155
|
|
|
134
156
|
```bash
|
|
135
|
-
|
|
157
|
+
npm run test:e2e:e2b
|
|
158
|
+
npm run test:e2e:daytona
|
|
136
159
|
```
|
|
137
160
|
|
|
138
161
|
Optional environment variables:
|
|
139
162
|
|
|
140
163
|
- `NECKBEARD_E2E_TEMPLATE` to override the default `code-interpreter-v1` test template
|
|
164
|
+
- `NECKBEARD_DAYTONA_TEMPLATE` to override the default Daytona smoke snapshot (`daytona-small`)
|
|
141
165
|
- `NECKBEARD_E2E_TIMEOUT_MS` to increase the live test timeout for slower environments
|
|
142
166
|
|
|
143
|
-
The GitHub Actions workflow runs `npm test` on every push and pull request, and runs `npm run test:e2e` with the repository `E2B_API_KEY` secret when it is configured.
|
|
144
|
-
|
|
145
167
|
## License
|
|
146
168
|
|
|
147
169
|
MIT
|