@getenki/ai-darwin-arm64 0.5.40 → 0.5.41
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 +68 -0
- package/enki-ai.darwin-arm64.node +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,11 @@ The current package surface is:
|
|
|
36
36
|
- `NativeEnkiAgent.withMemory(...)`
|
|
37
37
|
- `NativeEnkiAgent.withToolsAndMemory(...)`
|
|
38
38
|
|
|
39
|
+
It also supports two loop customization levels:
|
|
40
|
+
|
|
41
|
+
- `agenticLoop` constructor arguments for prompt-level loop customization
|
|
42
|
+
- `setAgentLoopHandler(...)` for a JavaScript-defined loop override
|
|
43
|
+
|
|
39
44
|
`NativeMultiAgentRuntime` supports:
|
|
40
45
|
|
|
41
46
|
- `new(...)`
|
|
@@ -101,9 +106,70 @@ Constructor arguments:
|
|
|
101
106
|
- `model?: string`
|
|
102
107
|
- `maxIterations?: number`
|
|
103
108
|
- `workspaceHome?: string`
|
|
109
|
+
- `agenticLoop?: string`
|
|
104
110
|
|
|
105
111
|
If omitted, the runtime falls back to built-in defaults for name, prompt, and max iterations.
|
|
106
112
|
|
|
113
|
+
## Custom Agentic Loops
|
|
114
|
+
|
|
115
|
+
Use the optional `agenticLoop` argument when you want to replace the default loop instructions seen by the model but still keep the normal Rust runtime loop:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
const { NativeEnkiAgent } = require('@getenki/ai')
|
|
119
|
+
|
|
120
|
+
const agent = new NativeEnkiAgent(
|
|
121
|
+
'Assistant',
|
|
122
|
+
'Answer clearly and keep responses short.',
|
|
123
|
+
'ollama::qwen3.5:latest',
|
|
124
|
+
20,
|
|
125
|
+
process.cwd(),
|
|
126
|
+
[
|
|
127
|
+
'1. Understand the request.',
|
|
128
|
+
'2. Decide whether a tool is needed.',
|
|
129
|
+
'3. Summarize observations.',
|
|
130
|
+
'4. Return the final answer.',
|
|
131
|
+
].join('\n'),
|
|
132
|
+
)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Use `setAgentLoopHandler(...)` when you want JavaScript to own the loop itself:
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
const { NativeEnkiAgent } = require('@getenki/ai')
|
|
139
|
+
|
|
140
|
+
const agent = new NativeEnkiAgent(
|
|
141
|
+
'Assistant',
|
|
142
|
+
'Answer clearly and keep responses short.',
|
|
143
|
+
'ollama::qwen3.5:latest',
|
|
144
|
+
8,
|
|
145
|
+
process.cwd(),
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
agent.setAgentLoopHandler((requestJson) => {
|
|
149
|
+
const request = JSON.parse(requestJson)
|
|
150
|
+
return JSON.stringify({
|
|
151
|
+
content: `Handled in JavaScript for: ${request.user_message}`,
|
|
152
|
+
steps: [
|
|
153
|
+
{
|
|
154
|
+
index: 1,
|
|
155
|
+
phase: 'Custom',
|
|
156
|
+
kind: 'final',
|
|
157
|
+
detail: 'Returned a final answer from JavaScript',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The handler receives a JSON request containing the current transcript, system prompt, tool catalog, model, iteration limit, and workspace paths.
|
|
165
|
+
|
|
166
|
+
Use `clearAgentLoopHandler()` to restore the default runtime loop.
|
|
167
|
+
|
|
168
|
+
Repository examples:
|
|
169
|
+
|
|
170
|
+
- [`example/basic-js/custom-agent-loop.js`](/I:/projects/enki/core-next/example/basic-js/custom-agent-loop.js)
|
|
171
|
+
- [`example/basic-js/react-custom-agent-loop.js`](/I:/projects/enki/core-next/example/basic-js/react-custom-agent-loop.js)
|
|
172
|
+
|
|
107
173
|
## Tools
|
|
108
174
|
|
|
109
175
|
Tools can be attached with `NativeEnkiAgent.withTools(...)`. Each tool object must provide:
|
|
@@ -542,6 +608,8 @@ JavaScript example:
|
|
|
542
608
|
cd example/basic-js
|
|
543
609
|
npm install
|
|
544
610
|
npm start
|
|
611
|
+
npm run start:custom-agent-loop
|
|
612
|
+
npm run start:react-custom-agent-loop
|
|
545
613
|
npm run start:multi-agent-tools-memory
|
|
546
614
|
```
|
|
547
615
|
|
|
Binary file
|