ai-code-agents 0.1.0-beta.1 → 0.2.0
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 +27 -23
- package/dist/index.cjs +703 -635
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +289 -567
- package/dist/index.d.ts +289 -567
- package/dist/index.js +752 -639
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -7
package/README.md
CHANGED
|
@@ -13,12 +13,18 @@ A TypeScript SDK for creating AI agents that interact with sandboxed code execut
|
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
|
-
You will need
|
|
16
|
+
You will need:
|
|
17
|
+
|
|
18
|
+
- Node.js 20+
|
|
19
|
+
- `npm` or another package manager
|
|
20
|
+
- AI SDK v6+ and zod v4+ (see below)
|
|
17
21
|
|
|
18
22
|
```bash
|
|
19
|
-
npm install ai-code-agents
|
|
23
|
+
npm install ai-code-agents ai zod
|
|
20
24
|
```
|
|
21
25
|
|
|
26
|
+
To explore the SDK via a command-line interface, see [`@ai-code-agents/cli`](https://www.npmjs.com/package/@ai-code-agents/cli).
|
|
27
|
+
|
|
22
28
|
## Quick Start
|
|
23
29
|
|
|
24
30
|
```typescript
|
|
@@ -33,14 +39,15 @@ const environment = createEnvironment('docker', {
|
|
|
33
39
|
|
|
34
40
|
// Create an agent with all tools
|
|
35
41
|
const agent = createCodeAgent({
|
|
36
|
-
model: openai('gpt-
|
|
42
|
+
model: openai('gpt-5'),
|
|
37
43
|
environment,
|
|
38
44
|
environmentToolsDefinition: 'all',
|
|
39
45
|
maxSteps: 10,
|
|
46
|
+
logStep: (log: string) => console.log(log),
|
|
40
47
|
});
|
|
41
48
|
|
|
42
49
|
// Run the agent
|
|
43
|
-
const result = await agent.
|
|
50
|
+
const result = await agent.generate({
|
|
44
51
|
prompt: 'Create a simple Node.js HTTP server in server.js',
|
|
45
52
|
});
|
|
46
53
|
|
|
@@ -53,23 +60,27 @@ console.log(result.text);
|
|
|
53
60
|
|
|
54
61
|
Environments provide sandboxed execution contexts for agents. All tools are built against environment interfaces, ensuring complete interoperability.
|
|
55
62
|
|
|
56
|
-
**
|
|
63
|
+
**Built-in:**
|
|
57
64
|
|
|
58
65
|
- `docker` - Docker container environments
|
|
59
66
|
- `node-filesystem` - Node.js filesystem operations (read-only recommended)
|
|
60
67
|
- `unsafe-local` - Local filesystem with command execution (development only)
|
|
61
68
|
- `mock-filesystem` - In-memory filesystem for testing
|
|
62
69
|
|
|
70
|
+
**Additional:**
|
|
71
|
+
|
|
72
|
+
- [`@ai-code-agents/just-bash`](https://www.npmjs.com/package/@ai-code-agents/just-bash) - Simulated bash environments using "just-bash"
|
|
73
|
+
- [`@ai-code-agents/vercel-sandbox`](https://www.npmjs.com/package/@ai-code-agents/vercel-sandbox) - Vercel sandbox environments
|
|
74
|
+
|
|
63
75
|
**Planned:**
|
|
64
76
|
|
|
65
77
|
- `e2b` - E2B cloud sandboxes
|
|
66
|
-
- `vercel-sandbox` - Vercel sandbox environments
|
|
67
78
|
|
|
68
79
|
### Tools
|
|
69
80
|
|
|
70
81
|
Tools enable agents to interact with their environments. Each tool has a well-defined purpose with comprehensive input/output validation.
|
|
71
82
|
|
|
72
|
-
**
|
|
83
|
+
**Built-in:**
|
|
73
84
|
|
|
74
85
|
- `read_file` - Read file contents
|
|
75
86
|
- `write_file` - Write or create files
|
|
@@ -97,14 +108,7 @@ Tools enable agents to interact with their environments. Each tool has a well-de
|
|
|
97
108
|
|
|
98
109
|
### Agent Integrations
|
|
99
110
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
- [Vercel AI SDK](https://ai-sdk.dev/) - Integration with AI SDK agents
|
|
103
|
-
|
|
104
|
-
**Planned:**
|
|
105
|
-
|
|
106
|
-
- [Mastra](https://mastra.ai/) - Integration with Mastra agents
|
|
107
|
-
- [AI SDK Tools](https://ai-sdk-tools.dev/) - Integration with AI SDK Tools agents
|
|
111
|
+
The agent infrastructure from the AI SDK is used by default. The `createCodeAgent` function will return an instance of `ToolLoopAgent`.
|
|
108
112
|
|
|
109
113
|
## Usage Examples
|
|
110
114
|
|
|
@@ -119,7 +123,7 @@ const environment = createEnvironment('unsafe-local', {
|
|
|
119
123
|
});
|
|
120
124
|
|
|
121
125
|
const agent = createCodeAgent({
|
|
122
|
-
model: anthropic('claude-
|
|
126
|
+
model: anthropic('claude-sonnet-4.5'),
|
|
123
127
|
environment,
|
|
124
128
|
environmentToolsDefinition: 'basic', // Read/write only, no deletions
|
|
125
129
|
maxSteps: 15,
|
|
@@ -128,7 +132,7 @@ const agent = createCodeAgent({
|
|
|
128
132
|
},
|
|
129
133
|
});
|
|
130
134
|
|
|
131
|
-
const result = await agent.
|
|
135
|
+
const result = await agent.generate({
|
|
132
136
|
prompt: 'Create a Python script that calculates fibonacci numbers',
|
|
133
137
|
});
|
|
134
138
|
```
|
|
@@ -153,7 +157,7 @@ const environments = {
|
|
|
153
157
|
|
|
154
158
|
// Configure tools per environment
|
|
155
159
|
const agent = createCodeAgent({
|
|
156
|
-
model: openai('gpt-
|
|
160
|
+
model: openai('gpt-5'),
|
|
157
161
|
environments,
|
|
158
162
|
environmentToolsDefinition: {
|
|
159
163
|
frontend: 'all',
|
|
@@ -162,7 +166,7 @@ const agent = createCodeAgent({
|
|
|
162
166
|
maxSteps: 20,
|
|
163
167
|
});
|
|
164
168
|
|
|
165
|
-
const result = await agent.
|
|
169
|
+
const result = await agent.generate({
|
|
166
170
|
prompt: 'Create a React frontend and Flask backend for a todo app',
|
|
167
171
|
});
|
|
168
172
|
```
|
|
@@ -178,7 +182,7 @@ const environment = createEnvironment('node-filesystem', {
|
|
|
178
182
|
});
|
|
179
183
|
|
|
180
184
|
const agent = createCodeAgent({
|
|
181
|
-
model: google('gemini-2.
|
|
185
|
+
model: google('gemini-2.5-pro'),
|
|
182
186
|
environment,
|
|
183
187
|
environmentToolsDefinition: [
|
|
184
188
|
'read_file',
|
|
@@ -201,7 +205,7 @@ Enable agents to signal completion before reaching max steps:
|
|
|
201
205
|
|
|
202
206
|
```typescript
|
|
203
207
|
const agent = createCodeAgent({
|
|
204
|
-
model: openai('gpt-
|
|
208
|
+
model: openai('gpt-5'),
|
|
205
209
|
environment,
|
|
206
210
|
environmentToolsDefinition: 'all',
|
|
207
211
|
maxSteps: 20,
|
|
@@ -215,7 +219,7 @@ Track agent execution with detailed step logs:
|
|
|
215
219
|
|
|
216
220
|
```typescript
|
|
217
221
|
const agent = createCodeAgent({
|
|
218
|
-
model: anthropic('claude-
|
|
222
|
+
model: anthropic('claude-sonnet-4.5'),
|
|
219
223
|
environment,
|
|
220
224
|
environmentToolsDefinition: 'all',
|
|
221
225
|
maxSteps: 15,
|
|
@@ -228,4 +232,4 @@ const agent = createCodeAgent({
|
|
|
228
232
|
|
|
229
233
|
## Contributing
|
|
230
234
|
|
|
231
|
-
Contributions to the AI Code Agents SDK are welcome and highly appreciated.
|
|
235
|
+
Contributions to the AI Code Agents SDK are welcome and highly appreciated. Please review the [contributing guidelines](https://github.com/felixarntz/ai-code-agents/blob/main/CONTRIBUTING.md) to learn more about how you can contribute.
|