@praesidia/neurogent 0.2.0 → 0.3.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 +225 -10
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @praesidia/neurogent
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@praesidia/neurogent)
|
|
4
|
-
[](https://github.com/praesidia/neurogent/blob/main/LICENSE)
|
|
4
|
+
[](https://github.com/praesidia-ai/neurogent/blob/main/LICENSE)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
|
|
7
7
|
**Multi-agent terminal shell and SDK for building A2A-ready AI agents** — run a team of specialists in one TUI session, or scaffold, develop, and ship agents with a single CLI.
|
|
@@ -20,7 +20,7 @@ Global CLI (recommended for `neurogent` / `neurogent-shell` on your `PATH`):
|
|
|
20
20
|
npm install -g @praesidia/neurogent
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
**Requirements:** Node.js **20+** (ESM). Set **`ANTHROPIC_API_KEY
|
|
23
|
+
**Requirements:** Node.js **20+** (ESM). Set **`ANTHROPIC_API_KEY`**, **`OPENAI_API_KEY`**, and/or **`MISTRAL_API_KEY`** in your environment.
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
@@ -80,9 +80,106 @@ neurogent --help
|
|
|
80
80
|
| `neurogent build` | Validate config and generate an AgentCard. |
|
|
81
81
|
| `neurogent deploy` | Generate production Docker artifacts. |
|
|
82
82
|
| `neurogent register` | Publish your AgentCard to an A2A directory registry. |
|
|
83
|
-
| `neurogent start` |
|
|
83
|
+
| `neurogent start` | Launch persistent ZeroClaw agent servers from a YAML config file. |
|
|
84
84
|
| `neurogent connect` | Connect the shell to a remote ZeroClaw agent server. |
|
|
85
|
-
| `neurogent status` |
|
|
85
|
+
| `neurogent status` | Health-check all registered ZeroClaw agents. |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## ZeroClaw — persistent agent runtime
|
|
90
|
+
|
|
91
|
+
ZeroClaw turns each agent definition into a **long-running HTTP server**. Instead of spawning a fresh LLM call per message, agents stay alive between turns, maintain conversation history, and expose a stable webhook URL for task delivery.
|
|
92
|
+
|
|
93
|
+
The shell automatically routes messages through ZeroClaw when a running instance is detected, falling back to a direct LLM call when no server is available.
|
|
94
|
+
|
|
95
|
+
### Starting agents
|
|
96
|
+
|
|
97
|
+
`neurogent start` reads your shell YAML config and starts one Hono HTTP server per agent, beginning at port **4100** by default:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
neurogent start # auto-discovers neurogent-shell.yaml
|
|
101
|
+
neurogent start --config marketing.yaml # explicit config
|
|
102
|
+
neurogent start --base-port 5000 # start ports from 5000
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Each agent gets its own port (`4100`, `4101`, `4102`, ...`). On startup, agent URLs are saved to **`.neurogent/runtime.json`** so the shell and CLI can discover them automatically. The servers run until `Ctrl+C`, which gracefully stops all instances and clears the runtime file.
|
|
106
|
+
|
|
107
|
+
### Checking status
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
neurogent status # one-shot health check
|
|
111
|
+
neurogent status --watch # refresh every 3 seconds
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Output shows each agent's URL, online/offline indicator, and uptime in seconds. If no agents are registered it prints instructions to run `neurogent start` or `neurogent connect`.
|
|
115
|
+
|
|
116
|
+
### Connecting to a remote server
|
|
117
|
+
|
|
118
|
+
When your ZeroClaw servers run on a remote host (or a different machine), use `neurogent connect` to point the shell at them:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Connect all agents to a single remote host
|
|
122
|
+
neurogent connect --url http://my-server:4100
|
|
123
|
+
|
|
124
|
+
# Connect a specific agent only
|
|
125
|
+
neurogent connect --url http://my-server:4101 --agent engineer
|
|
126
|
+
|
|
127
|
+
# Remove the remote connection and fall back to local LLM
|
|
128
|
+
neurogent connect --clear
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The command pings the target before saving, so you get an immediate error if the server is unreachable.
|
|
132
|
+
Remote connections are stored in `.neurogent/runtime.json` alongside local ones. If `--agent` is omitted a wildcard entry (`id: "*"`) is written, which the shell uses for any agent not otherwise registered.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## ZeroClaw HTTP API
|
|
137
|
+
|
|
138
|
+
Every agent server started by `neurogent start` (or `createAgentServer`) exposes these endpoints:
|
|
139
|
+
|
|
140
|
+
| Method | Path | Description |
|
|
141
|
+
|--------|------|-------------|
|
|
142
|
+
| `GET` | `/health` | Liveness probe. Returns `{ status, agent, role, port, uptime, tasks }`. |
|
|
143
|
+
| `GET` | `/.well-known/agent.json` | A2A AgentCard (name, version, capabilities, endpoints). |
|
|
144
|
+
| `POST` | `/webhook` | Deliver a task or message to the agent. |
|
|
145
|
+
| `GET` | `/a2a/tasks/:taskId` | Fetch the status of a specific task. |
|
|
146
|
+
| `GET` | `/a2a/tasks` | List the last 20 tasks. |
|
|
147
|
+
|
|
148
|
+
### POST /webhook — request body
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"message": "Explain the auth flow",
|
|
153
|
+
"stream": true
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
| Field | Type | Default | Description |
|
|
158
|
+
|-------|------|---------|-------------|
|
|
159
|
+
| `message` | `string` | required | The user prompt. Also accepted as `text` or `prompt`. |
|
|
160
|
+
| `stream` | `boolean` | `false` | Stream the response as SSE. |
|
|
161
|
+
|
|
162
|
+
**Non-streaming response:**
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"taskId": "task_1710000000_abc123",
|
|
167
|
+
"state": "COMPLETED",
|
|
168
|
+
"result": "The auth flow works as follows..."
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Streaming response** — `Content-Type: text/event-stream`, one event per chunk:
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
data: {"chunk":"The auth"}
|
|
176
|
+
data: {"chunk":" flow works..."}
|
|
177
|
+
data: {"done":true,"taskId":"task_1710000000_abc123"}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
On error the stream emits `data: {"error":"<message>"}` and closes.
|
|
181
|
+
|
|
182
|
+
The `X-Task-Id` response header contains the task ID regardless of streaming mode.
|
|
86
183
|
|
|
87
184
|
---
|
|
88
185
|
|
|
@@ -105,16 +202,72 @@ const agent = createAgent(config);
|
|
|
105
202
|
// Use Tool, memory helpers, and streaming per your setup.
|
|
106
203
|
```
|
|
107
204
|
|
|
108
|
-
### ZeroClaw
|
|
205
|
+
### ZeroClaw runtime — start a persistent server
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
import { createAgentServer } from '@praesidia/neurogent';
|
|
209
|
+
|
|
210
|
+
const server = createAgentServer(
|
|
211
|
+
{
|
|
212
|
+
id: 'engineer',
|
|
213
|
+
name: 'Engineer',
|
|
214
|
+
role: 'Full-Stack',
|
|
215
|
+
emoji: '⚡',
|
|
216
|
+
inkColor: 'cyan',
|
|
217
|
+
expertise: ['code', 'typescript', 'react'],
|
|
218
|
+
systemPrompt: 'You are a senior full-stack engineer.',
|
|
219
|
+
},
|
|
220
|
+
4100, // port
|
|
221
|
+
{ provider: 'anthropic', name: 'claude-3-5-sonnet-20241022' }, // optional global model — also: 'openai' | 'mistral' | 'ollama'
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
const instance = await server.start();
|
|
225
|
+
// instance.url → "http://localhost:4100"
|
|
226
|
+
|
|
227
|
+
// Graceful stop
|
|
228
|
+
server.stop();
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### ZeroClaw client — send messages and manage the runtime registry
|
|
109
232
|
|
|
110
233
|
```ts
|
|
111
234
|
import {
|
|
112
|
-
createAgentServer,
|
|
113
235
|
sendMessage,
|
|
114
236
|
pingAgent,
|
|
237
|
+
loadRuntime,
|
|
238
|
+
saveRuntime,
|
|
239
|
+
clearRuntime,
|
|
240
|
+
getAgentUrl,
|
|
115
241
|
} from '@praesidia/neurogent';
|
|
242
|
+
|
|
243
|
+
// Health check
|
|
244
|
+
const health = await pingAgent('http://localhost:4100');
|
|
245
|
+
// { alive: true, agent: 'Engineer', uptime: 42 }
|
|
246
|
+
|
|
247
|
+
// Stream a response
|
|
248
|
+
for await (const chunk of sendMessage('http://localhost:4100', 'Write a login handler')) {
|
|
249
|
+
process.stdout.write(chunk);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Read the runtime registry written by `neurogent start`
|
|
253
|
+
const runtime = loadRuntime();
|
|
254
|
+
// { agents: [{ id, name, url, port, pid, startedAt }], startedAt }
|
|
255
|
+
|
|
256
|
+
// Look up a specific agent's URL
|
|
257
|
+
const url = getAgentUrl('engineer'); // "http://localhost:4100" or null
|
|
116
258
|
```
|
|
117
259
|
|
|
260
|
+
### Shell executor — ZeroClaw routing
|
|
261
|
+
|
|
262
|
+
When the shell calls `executeAgent`, it checks for a ZeroClaw URL in this priority order:
|
|
263
|
+
|
|
264
|
+
1. `agent.zeroClawUrl` — inline URL on the agent definition
|
|
265
|
+
2. `getAgentUrl(agent.id)` — lookup by agent ID in `.neurogent/runtime.json`
|
|
266
|
+
3. `getAgentUrl('*')` — wildcard entry written by `neurogent connect`
|
|
267
|
+
4. Falls through to a direct LLM call if none are found
|
|
268
|
+
|
|
269
|
+
This means you can mix locally-served agents, remotely-connected agents, and live-LLM agents in the same shell session.
|
|
270
|
+
|
|
118
271
|
### Security hooks (optional dedicated import)
|
|
119
272
|
|
|
120
273
|
```ts
|
|
@@ -125,6 +278,68 @@ Types are published with the package (`dist/*.d.ts`).
|
|
|
125
278
|
|
|
126
279
|
---
|
|
127
280
|
|
|
281
|
+
## Shell YAML config format
|
|
282
|
+
|
|
283
|
+
```yaml
|
|
284
|
+
shell:
|
|
285
|
+
name: "My Team"
|
|
286
|
+
|
|
287
|
+
# Global model — agents inherit this unless they override it
|
|
288
|
+
model:
|
|
289
|
+
provider: anthropic # anthropic | openai | mistral | ollama
|
|
290
|
+
name: claude-3-5-sonnet-20241022
|
|
291
|
+
max_tokens: 1024 # optional
|
|
292
|
+
temperature: 0.7 # optional
|
|
293
|
+
base_url: http://... # optional, for Ollama or custom endpoints
|
|
294
|
+
|
|
295
|
+
agents:
|
|
296
|
+
- id: engineer # lowercase alphanumeric + _ or -
|
|
297
|
+
name: Engineer
|
|
298
|
+
role: Full-Stack
|
|
299
|
+
emoji: "⚡"
|
|
300
|
+
color: cyan # ink terminal color name
|
|
301
|
+
expertise:
|
|
302
|
+
- code
|
|
303
|
+
- typescript
|
|
304
|
+
- react
|
|
305
|
+
system_prompt: |
|
|
306
|
+
You are a senior full-stack engineer...
|
|
307
|
+
model: # optional per-agent override
|
|
308
|
+
provider: openai
|
|
309
|
+
name: gpt-4o
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Expertise keywords drive automatic routing — when you type a message, the shell scores each agent by keyword match and routes to the best fit. Use `@agent-id` or `@agent-name` to explicitly target an agent.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Exported API reference
|
|
317
|
+
|
|
318
|
+
All exports from `@praesidia/neurogent`:
|
|
319
|
+
|
|
320
|
+
| Export | Kind | Description |
|
|
321
|
+
|--------|------|-------------|
|
|
322
|
+
| `createAgent` | function | Build a `NeuroAgent` from a builder config. |
|
|
323
|
+
| `NeuroAgent` | class | Full A2A agent with Hono server, hooks, memory, MCP. |
|
|
324
|
+
| `Tool` | class | Define a typed tool with Zod schema + execute handler. |
|
|
325
|
+
| `ConversationBufferMemory` | class | Fixed-window conversation history store. |
|
|
326
|
+
| `LocalSemanticMemory` | class | In-memory semantic memory store. |
|
|
327
|
+
| `MCPClient` | class | Fetch tools from a running MCP server. |
|
|
328
|
+
| `PraesidiaHooks` | class | Security ingress/egress/tool-execution hooks. |
|
|
329
|
+
| `parsePolicy` | function | Parse a `praesidia.policy.yaml` string into a typed policy. |
|
|
330
|
+
| `parseAgentConfig` | function | Parse a `neuro.agent.yaml` YAML string into a typed config. |
|
|
331
|
+
| `compileToAgentCard` | function | Compile a `NeuroAgentConfig` into a serialisable `AgentCard`. |
|
|
332
|
+
| `neuroAgentSchema` | Zod schema | Zod schema for `neuro.agent.yaml`. |
|
|
333
|
+
| `createAgentServer` | function | Create a ZeroClaw persistent Hono HTTP server for an agent. |
|
|
334
|
+
| `sendMessage` | async generator | POST to `/webhook` and stream SSE chunks. |
|
|
335
|
+
| `pingAgent` | function | GET `/health` with a 3-second timeout. |
|
|
336
|
+
| `loadRuntime` | function | Read `.neurogent/runtime.json`. |
|
|
337
|
+
| `saveRuntime` | function | Write `.neurogent/runtime.json`. |
|
|
338
|
+
| `clearRuntime` | function | Delete `.neurogent/runtime.json`. |
|
|
339
|
+
| `getAgentUrl` | function | Look up a registered agent URL by ID. |
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
128
343
|
## Examples
|
|
129
344
|
|
|
130
345
|
These files are published with the package:
|
|
@@ -137,17 +352,17 @@ These files are published with the package:
|
|
|
137
352
|
| `examples/marketing-team.yaml` | Marketing-focused agents. |
|
|
138
353
|
| `examples/solo-researcher.yaml` | Single deep-research agent. |
|
|
139
354
|
|
|
140
|
-
Use them as `--config` for `neurogent-shell` or as templates for your own YAML.
|
|
355
|
+
Use them as `--config` for `neurogent-shell` or `neurogent start`, or as templates for your own YAML.
|
|
141
356
|
|
|
142
357
|
---
|
|
143
358
|
|
|
144
359
|
## Documentation and support
|
|
145
360
|
|
|
146
|
-
- **Repository & full guide:** [github.com/praesidia/neurogent](https://github.com/praesidia/neurogent)
|
|
147
|
-
- **Issues:** [github.com/praesidia/neurogent/issues](https://github.com/praesidia/neurogent/issues)
|
|
361
|
+
- **Repository & full guide:** [github.com/praesidia/neurogent](https://github.com/praesidia-ai/neurogent)
|
|
362
|
+
- **Issues:** [github.com/praesidia/neurogent/issues](https://github.com/praesidia-ai/neurogent/issues)
|
|
148
363
|
|
|
149
364
|
---
|
|
150
365
|
|
|
151
366
|
## License
|
|
152
367
|
|
|
153
|
-
MIT. See the [license file](https://github.com/praesidia/neurogent/blob/main/LICENSE) in the repository.
|
|
368
|
+
MIT. See the [license file](https://github.com/praesidia-ai/neurogent/blob/main/LICENSE) in the repository.
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praesidia/neurogent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Run a team of AI experts in your terminal. Build and deploy production-ready A2A agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/praesidia/neurogent.git"
|
|
8
|
+
"url": "https://github.com/praesidia-ai/neurogent.git"
|
|
9
9
|
},
|
|
10
|
-
"homepage": "https://github.com/praesidia/neurogent#readme",
|
|
10
|
+
"homepage": "https://github.com/praesidia-ai/neurogent#readme",
|
|
11
11
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/
|
|
12
|
+
"url": "https://github.com/praesidi-ai/neurogent/issues"
|
|
13
13
|
},
|
|
14
|
-
"keywords": ["ai", "agents", "llm", "terminal", "a2a", "multi-agent", "cli", "anthropic", "openai", "sdk"],
|
|
14
|
+
"keywords": ["ai", "agents", "llm", "terminal", "a2a", "multi-agent", "cli", "anthropic", "openai", "mistral", "sdk"],
|
|
15
15
|
"type": "module",
|
|
16
16
|
"bin": {
|
|
17
17
|
"neurogent": "./dist/cli/index.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@ai-sdk/anthropic": "^1.0.0",
|
|
41
|
+
"@ai-sdk/mistral": "^1.0.0",
|
|
41
42
|
"@ai-sdk/openai": "^1.0.0",
|
|
42
43
|
"@hono/node-server": "^1.12.0",
|
|
43
44
|
"@modelcontextprotocol/sdk": "^1.0.0",
|