Skip to content

Commit 61fff97

Browse files
icebob-aiclaude
andcommitted
Translate PRD files to English for public repo
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7569ff7 commit 61fff97

2 files changed

Lines changed: 166 additions & 166 deletions

File tree

PRD-phase2.md

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
# PRD: @moleculer/agents — Phase 2 (OrchestratorMixin)
22

3-
## 1. Áttekintés
4-
- **Cél:** Multi-agent koordináció hozzáadása — egy orchestrator service felfedezheti és delegálhat feladatokat más agent service-eknek
5-
- **Scope:** OrchestratorMixin, direct + LLM-router strategy, integrációs tesztek, README frissítés, orchestrator example
6-
- **Előfeltétel:** Phase 1 kész — AgentMixin, MemoryMixin, LLMService, adapters mind működnek
3+
## 1. Overview
4+
- **Goal:** Add multi-agent coordination — an orchestrator service can discover and delegate tasks to other agent services
5+
- **Scope:** OrchestratorMixin, direct + LLM-router strategy, integration tests, README update, orchestrator example
6+
- **Prerequisite:** Phase 1 complete — AgentMixin, MemoryMixin, LLMService, adapters all working
77

8-
## 2. Meglévő rendszer
8+
## 2. Existing system
99

10-
A Phase 1-ben elkészült komponensek (NEM kell módosítani, csak használni):
11-
- `AgentMixin` — ReAct loop, tool schema extraction, run/chat action-ök (`src/agent.mixin.ts`)
12-
- `MemoryMixin` — conversation history cacher-ben (`src/memory.mixin.ts`)
10+
Components completed in Phase 1 (do NOT modify, only use):
11+
- `AgentMixin` — ReAct loop, tool schema extraction, run/chat actions (`src/agent.mixin.ts`)
12+
- `MemoryMixin` — conversation history in cacher (`src/memory.mixin.ts`)
1313
- `LLMService` — adapter wrapper service (`src/llm.service.ts`)
1414
- Adapters: OpenAI, Anthropic, Fake + registry (`src/adapters/`)
1515
- Types: `LLMResponse`, `ToolCall`, `AgentSettings`, `ToolSchema` (`src/types.ts`)
1616
- Schema converter: fastest-validator → JSON Schema (`src/schema-converter.ts`)
1717

18-
A meglévő `AgentSettings` interface-ben már van `strategy` mező: `"direct" | "llm-router"`.
18+
The existing `AgentSettings` interface already has a `strategy` field: `"direct" | "llm-router"`.
1919

20-
## 3. Új fájlok
20+
## 3. New files
2121

2222
```
2323
src/
2424
orchestrator.mixin.ts # OrchestratorMixin factory function
25-
types.ts # Bővíteni: DiscoveredAgent interface
25+
types.ts # Extend: DiscoveredAgent interface
2626
test/
2727
unit/
2828
orchestrator.mixin.spec.ts
2929
integration/
30-
orchestrator.test.ts # Multi-agent E2E teszt
30+
orchestrator.test.ts # Multi-agent E2E test
3131
examples/
32-
orchestrator.ts # Futtatható orchestrator példa
32+
orchestrator.ts # Runnable orchestrator example
3333
```
3434

35-
## 4. OrchestratorMixin specifikáció
35+
## 4. OrchestratorMixin specification
3636

3737
### Factory function
3838

@@ -43,59 +43,59 @@ export default function OrchestratorMixin(mixinOpts?: OrchestratorMixinOptions)
4343
**Options:**
4444
```typescript
4545
interface OrchestratorMixinOptions {
46-
// Nincs szükség opciókra egyelőre, de a factory pattern megmarad
46+
// No options needed for now, but the factory pattern is preserved
4747
}
4848
```
4949

50-
### Új típus (`types.ts`-be)
50+
### New type (add to `types.ts`)
5151

5252
```typescript
5353
export interface DiscoveredAgent {
5454
name: string;
5555
description: string;
56-
actions: string[]; // Action nevek amik tool-ként elérhetőek
56+
actions: string[]; // Action names available as tools
5757
}
5858
```
5959

6060
### Methods
6161

6262
#### `discoverAgents(): DiscoveredAgent[]`
6363

64-
Lekérdezi a Moleculer service registry-ből az összes agent service-t:
64+
Queries the Moleculer service registry for all agent services:
6565

66-
1. `this.broker.registry.getServiceList({ withActions: true })` hívás (Moleculer 0.15 API)
67-
2. Szűrés: csak azok a service-ek amelyeknek van `settings.agent` objektuma ÉS van `settings.agent.description`
68-
3. Kiszűri önmagát (`this.name`-mel egyező service-ek)
69-
4. Minden talált service-ből `DiscoveredAgent` objektumot épít:
70-
- `name`: service neve
66+
1. Call `this.broker.registry.getServiceList({ withActions: true })` (Moleculer 0.15 API)
67+
2. Filter: only services that have a `settings.agent` object AND `settings.agent.description`
68+
3. Exclude self (services matching `this.name`)
69+
4. Build `DiscoveredAgent` object from each found service:
70+
- `name`: service name
7171
- `description`: `settings.agent.description`
72-
- `actions`: az adott service action-jei közül azok neve amelyeknek van `description` mezőjük (hasonlóan ahogy az AgentMixin szűr) — DE a `run` és `chat` meta-action-öket kiszűri
73-
5. Visszaadja a tömböt
72+
- `actions`: action names from that service which have a `description` field (similar to how AgentMixin filters) — BUT filter out the `run` and `chat` meta-actions
73+
5. Return the array
7474

75-
**FONTOS:** A Moleculer 0.15-ben a `getServiceList` a remote node-ok settings-eit is visszaadja, tehát ez elosztott környezetben is működik. Nézd meg a Moleculer 0.15 forráskódját a pontos API-ért (a broker.registry vagy broker object-en kell keresni a megfelelő metódust, pl. `this.broker.registry.getServiceList` vagy `this.broker.getLocalNodeInfo`). Ha a Moleculer 0.15 API nem egyértelmű, használd a `this.broker.call("$node.services", { withActions: true })` belső action-t ami szintén visszaadja az összes service infót.
75+
**IMPORTANT:** In Moleculer 0.15, `getServiceList` returns settings from remote nodes as well, so this works in distributed environments. Check the Moleculer 0.15 source for the exact API (look for the appropriate method on broker.registry or broker object, e.g. `this.broker.registry.getServiceList` or `this.broker.getLocalNodeInfo`). If the Moleculer 0.15 API is unclear, use `this.broker.call("$node.services", { withActions: true })` internal action which also returns all service info.
7676

7777
#### `delegateTo(agentName: string, task: string, sessionId?: string): Promise<string>`
7878

79-
Egyszerű wrapper:
79+
Simple wrapper:
8080
```typescript
8181
return this.broker.call(`${agentName}.run`, { task, sessionId });
8282
```
8383

8484
### Settings
8585

86-
Az OrchestratorMixin a meglévő `settings.agent` scope alá nem ad új mezőket — a `strategy` mező már létezik az `AgentSettings` interface-ben.
86+
OrchestratorMixin does not add new fields under the existing `settings.agent` scope — the `strategy` field already exists in the `AgentSettings` interface.
8787

88-
### Hogyan működik az orchestrator
88+
### How the orchestrator works
8989

90-
Az OrchestratorMixin-t az AgentMixin-nel és opcionálisan a MemoryMixin-nel EGYÜTT kell használni:
90+
OrchestratorMixin must be used TOGETHER with AgentMixin and optionally MemoryMixin:
9191

9292
```typescript
9393
mixins: [MemoryMixin(), OrchestratorMixin(), AgentMixin()]
9494
```
9595

96-
Az orchestrator service-nek lehetnek **saját action-jei** (amik tool-ként jelennek meg az LLM számára), és ezek az action-ok hívhatják a `this.delegateTo()` metódust más agent-ekhez delegáláshoz.
96+
The orchestrator service can have **its own actions** (which appear as tools for the LLM), and these actions can call `this.delegateTo()` to delegate to other agents.
9797

98-
**Direct strategy példa:**
98+
**Direct strategy example:**
9999
```typescript
100100
actions: {
101101
planTrip: {
@@ -115,63 +115,63 @@ actions: {
115115
}
116116
```
117117

118-
**LLM-router strategy:** Az orchestrator `created()` hook-jában ha `settings.agent.strategy === "llm-router"`, automatikusan generál egy extra tool-t (`_routeToAgent`) az LLM számára. Ez a tool:
119-
- Paraméterek: `{ agentName: "string", task: "string" }`
120-
- Description: tartalmazza az elérhető agent-ek listáját (discovery-ből)
121-
- Handler: meghívja `this.delegateTo(agentName, task)`
122-
- Az AgentMixin ReAct loop-ja automatikusan meghívja ha az LLM úgy dönt
118+
**LLM-router strategy:** In the orchestrator's `created()` hook, if `settings.agent.strategy === "llm-router"`, it automatically generates an extra tool (`_routeToAgent`) for the LLM. This tool:
119+
- Parameters: `{ agentName: "string", task: "string" }`
120+
- Description: contains the list of available agents (from discovery)
121+
- Handler: calls `this.delegateTo(agentName, task)`
122+
- The AgentMixin ReAct loop automatically invokes it if the LLM decides to
123123

124-
A `_routeToAgent` tool description-jébe bele kell írni a felfedezett agent-ek listáját és leírását, hogy az LLM tudja melyikhez delegáljon. A discovery a `started()` hook-ban történik (amikor a többi service már regisztrált), és `$services.changed` event-re frissül.
124+
The `_routeToAgent` tool description must include the discovered agents list and descriptions so the LLM knows which agent to delegate to. Discovery happens in the `started()` hook (when other services are already registered), and refreshes on `$services.changed` event.
125125

126-
## 5. Tesztelési terv
126+
## 5. Testing plan
127127

128-
### Unit tesztek (`test/unit/orchestrator.mixin.spec.ts`)
128+
### Unit tests (`test/unit/orchestrator.mixin.spec.ts`)
129129

130130
Vitest, FakeAdapter, ServiceBroker `{ logger: false }`.
131131

132-
- **discoverAgents**: Hozz létre broker-t 3 service-szel (2 agent + 1 nem-agent), ellenőrizd hogy a `discoverAgents()` csak az agent service-eket adja vissza, és kiszűri önmagát
133-
- **delegateTo**: Mock agent service, ellenőrizd hogy `broker.call("agent-name.run", { task })` hívódik meg
134-
- **LLM-router _routeToAgent tool**: Ellenőrizd hogy `strategy: "llm-router"` esetén a toolSchemas tartalmaz egy `_routeToAgent` tool-t
135-
- **Direct strategy**: Ellenőrizd hogy `strategy: "direct"` esetén NEM generálódik `_routeToAgent` tool
132+
- **discoverAgents**: Create a broker with 3 services (2 agents + 1 non-agent), verify that `discoverAgents()` returns only the agent services and excludes self
133+
- **delegateTo**: Mock agent service, verify that `broker.call("agent-name.run", { task })` is called
134+
- **LLM-router _routeToAgent tool**: Verify that with `strategy: "llm-router"`, toolSchemas contains a `_routeToAgent` tool
135+
- **Direct strategy**: Verify that with `strategy: "direct"`, NO `_routeToAgent` tool is generated
136136

137-
### Integrációs teszt (`test/integration/orchestrator.test.ts`)
137+
### Integration test (`test/integration/orchestrator.test.ts`)
138138

139-
Teljes multi-agent E2E:
139+
Full multi-agent E2E:
140140

141-
1. Broker létrehozás `{ logger: false, cacher: "Memory" }`
142-
2. LLM service FakeAdapter-rel
143-
3. 2 sub-agent service (weather-agent, calculator-agent) — AgentMixin-nel, saját tool action-ökkel
141+
1. Broker creation `{ logger: false, cacher: "Memory" }`
142+
2. LLM service with FakeAdapter
143+
3. 2 sub-agent services (weather-agent, calculator-agent) — with AgentMixin, with their own tool actions
144144
4. 1 orchestrator service — AgentMixin + OrchestratorMixin, direct strategy
145-
5. Teszt: `broker.call("orchestrator.run", { task: "..." })`az orchestrator action-je meghívja `delegateTo`-ta sub-agent válaszol → orchestrator visszaadja az eredményt
146-
6. Teszt: `discoverAgents()` helyes listát ad
145+
5. Test: `broker.call("orchestrator.run", { task: "..." })` → orchestrator action calls `delegateTo` → sub-agent responds → orchestrator returns result
146+
6. Test: `discoverAgents()` returns correct list
147147

148-
### Futtatható example (`examples/orchestrator.ts`)
148+
### Runnable example (`examples/orchestrator.ts`)
149149

150-
Regisztráld az example runner-be (`examples/index.ts`-be `orchestrator` kulcs alatt).
150+
Register in the example runner (`examples/index.ts` under `orchestrator` key).
151151

152-
A példa:
153-
- 1 LLM service (auto adapter detection a `create-adapter` helper-rel)
154-
- 2 sub-agent (weather + calculator)
155-
- 1 orchestrator (direct strategy) — `planTrip` action ami delegál a sub-agent-ekhez
156-
- Hívás: `orchestrator.run({ task: "Plan a trip to Paris for 3 days" })`
152+
The example:
153+
- 1 LLM service (auto adapter detection via `create-adapter` helper)
154+
- 2 sub-agents (weather + calculator)
155+
- 1 orchestrator (direct strategy) — `planTrip` action that delegates to sub-agents
156+
- Call: `orchestrator.run({ task: "Plan a trip to Paris for 3 days" })`
157157

158-
## 6. README frissítés
158+
## 6. README update
159159

160-
A meglévő README-be adj hozzá egy "Multi-Agent Orchestration" szekciót a "Conversation Memory" szekció után, ami bemutatja:
161-
- OrchestratorMixin használatát
162-
- `discoverAgents()` és `delegateTo()` metódusokat
163-
- Direct strategy példát
164-
- LLM-router strategy példát (röviden)
160+
Add a "Multi-Agent Orchestration" section to the existing README after the "Conversation Memory" section, covering:
161+
- OrchestratorMixin usage
162+
- `discoverAgents()` and `delegateTo()` methods
163+
- Direct strategy example
164+
- LLM-router strategy example (brief)
165165

166-
## 7. Index.ts frissítés
166+
## 7. Index.ts update
167167

168-
Az `src/index.ts`-ből exportáld az `OrchestratorMixin`-t és a `DiscoveredAgent` típust is:
168+
Export `OrchestratorMixin` and the `DiscoveredAgent` type from `src/index.ts`:
169169

170170
```typescript
171171
export { default as OrchestratorMixin } from "./orchestrator.mixin.ts";
172172
export type { ..., DiscoveredAgent } from "./types.ts";
173173
```
174174

175-
## 8. Coding konvenciók
175+
## 8. Coding conventions
176176

177-
Ugyanazok mint Phase 1-benlásd a CLAUDE.md-t! TypeScript, ES modules, tabs, double quotes, Vitest, file headers, etc.
177+
Same as Phase 1 — see CLAUDE.md! TypeScript, ES modules, tabs, double quotes, Vitest, file headers, etc.

0 commit comments

Comments
 (0)