feat(FN-3321): add agent self-improvement service and heartbeat evaluation
This merge delivers agent self-improvement (FN-3321) — adding evaluation identity tools, wiring evaluation into the heartbeat loop, implementing a self-improvement service, and providing test coverage. It also expands the dashboard guide view with regression tests, adds org chart full-view mode with Fusion-Task-Id: FN-3321
This commit is contained in:
@@ -223,6 +223,9 @@ The `runtimeConfig` field on agents supports the following options:
|
||||
| `heartbeatTimeoutMs` | `number` | — | Time without heartbeat before agent is considered unresponsive (ms) |
|
||||
| `maxConcurrentRuns` | `number` | `1` | Max concurrent heartbeat runs for this agent |
|
||||
| `messageResponseMode` | `"immediate" \| "on-heartbeat"` | `"immediate"` | Whether agent wakes immediately on message (immediate) or processes during heartbeat (on-heartbeat). See [Heartbeat Run Mailbox Checking](#heartbeat-run-mailbox-checking) |
|
||||
| `selfImproveEnabled` | `boolean` | `true` | Enable periodic self-improvement reflection prompts during heartbeat runs |
|
||||
| `selfImproveIntervalMs` | `number` | `14400000` (4h) | Minimum delay between self-improvement cycles (minimum enforced: 3600000 ms) |
|
||||
| `lastSelfImproveAt` | `string` (ISO timestamp) | — | Last recorded self-improvement checkpoint timestamp |
|
||||
| `modelProvider` | `string` | — | AI provider override for heartbeat session |
|
||||
| `modelId` | `string` | — | AI model ID override for heartbeat session |
|
||||
| `budgetConfig` | `AgentBudgetConfig` | — | Token budget governance settings |
|
||||
@@ -242,6 +245,17 @@ Guardrails:
|
||||
|
||||
Operators can disable this per agent in **Agent Detail → Settings → Heartbeat Settings → Auto-Claim Relevant Tasks**.
|
||||
|
||||
### Self-improvement cycle
|
||||
|
||||
When `selfImproveEnabled !== false`, heartbeat runs periodically enter a self-improvement phase once `selfImproveIntervalMs` has elapsed since `lastSelfImproveAt` (or first run with available ratings). During that phase the agent is prompted to:
|
||||
|
||||
1. Call `fn_read_evaluations` to inspect ratings/reflections
|
||||
2. Identify recurring quality issues and trends
|
||||
3. Call `fn_update_identity` to adjust its own `soul`, `instructionsText`, or `memory`
|
||||
4. Record concise improvement decisions
|
||||
|
||||
After a successful run, the monitor records `lastSelfImproveAt` in `runtimeConfig`.
|
||||
|
||||
## Agent Instructions (Dashboard)
|
||||
|
||||
The Agent Detail view includes a dedicated **Instructions** tab for editing agent custom instructions. This replaces the previous embedded instructions editor in the Settings tab, providing a more discoverable and user-friendly experience.
|
||||
|
||||
@@ -741,7 +741,21 @@ To clear all overrides, set `promptOverrides` to `null`:
|
||||
|
||||
### 4) Agent runtime configuration (example agent config)
|
||||
|
||||
Runtime selection is configured at the agent level via `runtimeConfig`. These examples show agents configured to use Paperclip, Hermes, and OpenClaw runtime hints:
|
||||
Runtime selection is configured at the agent level via `runtimeConfig`. These examples show agents configured to use Paperclip, Hermes, and OpenClaw runtime hints.
|
||||
|
||||
Common heartbeat/runtime keys on `runtimeConfig` include:
|
||||
|
||||
| Field | Type | Description |
|
||||
|---|---|---|
|
||||
| `heartbeatIntervalMs` | `number` | Per-agent heartbeat interval |
|
||||
| `heartbeatTimeoutMs` | `number` | Per-agent heartbeat timeout |
|
||||
| `maxConcurrentRuns` | `number` | Per-agent concurrent heartbeat limit |
|
||||
| `messageResponseMode` | `"immediate" \| "on-heartbeat"` | Wake on message immediately or process during periodic heartbeat |
|
||||
| `selfImproveEnabled` | `boolean` | Enables periodic self-improvement prompts |
|
||||
| `selfImproveIntervalMs` | `number` | Delay between self-improvement cycles (default 4h, minimum 1h) |
|
||||
| `lastSelfImproveAt` | `string` | Last self-improvement checkpoint timestamp (managed by heartbeat monitor) |
|
||||
|
||||
These examples show agents configured to use Paperclip, Hermes, and OpenClaw runtime hints:
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user