Update Design Document and Refactor Execution Phases

- Revised the design document to improve clarity in the deduplication timing table format.
- Updated the `Resources` struct to include a new `Inspiration` phase and adjusted the descriptions for existing phases.
- Enhanced the `ExecutionPhase` constants to reflect the new phase structure, adding a `PhaseLearning`.
- Improved the documentation for the private knowledge base categories and the Activity Monitor API features for better readability.
- Introduced new types for alert rules and actions in the monitoring configuration, expanding the alerting capabilities.
This commit is contained in:
Max 2026-01-10 20:07:47 +08:00
parent b7ca0ab5b8
commit 117e16b827

View file

@ -364,7 +364,7 @@ Suggestion meanings:
**Deduplication Timing:** **Deduplication Timing:**
| Phase | Dedup Type | Description | | Phase | Dedup Type | Description |
| ----------- | ----------------- | ------------------------------------------------ | | ---------------- | --------------- | ------------------------------------------------------------------- |
| After Phase 1 | Goal dedup | Compare generated goals with historical goals | | After Phase 1 | Goal dedup | Compare generated goals with historical goals |
| After Phase 2 | Task dedup | Compare decomposed tasks with historical tasks | | After Phase 2 | Task dedup | Compare decomposed tasks with historical tasks |
| Before execution | Execution dedup | Prevent same trigger from duplicate submission (memory-level, fast) | | Before execution | Execution dedup | Prevent same trigger from duplicate submission (memory-level, fast) |
@ -1058,11 +1058,12 @@ type SharedKB struct {
// Resources available resources // Resources available resources
type Resources struct { type Resources struct {
// Phase assistants (built-in or custom) // Phase assistants (built-in or custom)
GoalGenerator string `json:"goal_generator"` // Goal generation assistant Inspiration string `json:"inspiration"` // Inspiration Agent (Phase 0)
TaskPlanner string `json:"task_planner"` // Task planning assistant GoalGenerator string `json:"goal_generator"` // Goal generation assistant (Phase 1)
Validator string `json:"validator"` // Result validation assistant TaskPlanner string `json:"task_planner"` // Task planning assistant (Phase 2)
Delivery string `json:"delivery"` // Delivery assistant Validator string `json:"validator"` // Result validation assistant (Phase 3)
Learning string `json:"learning"` // Learning assistant (summarize experience, write to KB) Delivery string `json:"delivery"` // Delivery assistant (Phase 4)
Learning string `json:"learning"` // Learning assistant (Phase 5)
// Execution resources // Execution resources
Assistants []string `json:"assistants"` // Callable assistant list Assistants []string `json:"assistants"` // Callable assistant list
@ -1112,10 +1113,12 @@ const (
type ExecutionPhase string type ExecutionPhase string
const ( const (
PhaseGoalGeneration ExecutionPhase = "goal_generation" PhaseInspiration ExecutionPhase = "inspiration" // Phase 0
PhaseTaskDecomposition ExecutionPhase = "task_decomposition" PhaseGoalGeneration ExecutionPhase = "goal_generation" // Phase 1
PhaseTaskExecution ExecutionPhase = "task_execution" PhaseTaskDecomposition ExecutionPhase = "task_decomposition" // Phase 2
PhaseDelivery ExecutionPhase = "delivery" PhaseTaskExecution ExecutionPhase = "task_execution" // Phase 3
PhaseDelivery ExecutionPhase = "delivery" // Phase 4
PhaseLearning ExecutionPhase = "learning" // Phase 5
) )
// Goal // Goal
@ -1217,7 +1220,7 @@ func createAgentPrivateKB(teamID, agentID string) (string, error) {
The private knowledge base stores the following types of knowledge: The private knowledge base stores the following types of knowledge:
| Category | Description | Examples | | Category | Description | Examples |
| ----------- | ------------------------ | ------------------------------------------- | | ----------- | ------------------------- | ------------------------------------------------------------- |
| `execution` | Execution records/results | Task execution process, success/failure cases | | `execution` | Execution records/results | Task execution process, success/failure cases |
| `feedback` | Feedback and evaluation | Validation results, user feedback, error analysis | | `feedback` | Feedback and evaluation | Validation results, user feedback, error analysis |
| `insight` | Insights and summaries | Pattern recognition, optimization suggestions, best practices | | `insight` | Insights and summaries | Pattern recognition, optimization suggestions, best practices |
@ -1856,7 +1859,7 @@ func executeTaskWithChildExecution(ctx *job.ExecutionContext, parent *job.Execut
Via Job API (`yao/openapi/job`), the Activity Monitor provides: Via Job API (`yao/openapi/job`), the Activity Monitor provides:
| Feature | API | Description | | Feature | API | Description |
| ------------------- | ------------------------------------------------ | -------------------- | | ------------------ | ------------------------------------------------ | -------------------------- |
| Agent task list | `GET /api/jobs?category_id=autonomous_agent` | View all Agent Jobs | | Agent task list | `GET /api/jobs?category_id=autonomous_agent` | View all Agent Jobs |
| Execution history | `GET /api/jobs/:job_id/executions` | View execution history | | Execution history | `GET /api/jobs/:job_id/executions` | View execution history |
| Real-time progress | `GET /api/jobs/:job_id/executions/:id` | View current progress | | Real-time progress | `GET /api/jobs/:job_id/executions/:id` | View current progress |
@ -1903,6 +1906,9 @@ type AgentConfig struct {
// Identity settings // Identity settings
Identity *Identity `json:"identity"` Identity *Identity `json:"identity"`
// Concurrency quota
Concurrency *ConcurrencyConfig `json:"concurrency"`
// Private knowledge base // Private knowledge base
PrivateKB *PrivateKB `json:"private_kb"` PrivateKB *PrivateKB `json:"private_kb"`
@ -1930,4 +1936,20 @@ type MonitoringConfig struct {
Enabled bool `json:"enabled"` Enabled bool `json:"enabled"`
Alerts []AlertRule `json:"alerts,omitempty"` Alerts []AlertRule `json:"alerts,omitempty"`
} }
// AlertRule alert rule definition
type AlertRule struct {
Name string `json:"name"` // Rule name
Condition string `json:"condition"` // Trigger condition: "execution_failed" | "timeout" | "error_rate_high"
Threshold float64 `json:"threshold"` // Threshold value (e.g., error rate > 0.1)
Window string `json:"window"` // Time window (e.g., "1h", "24h")
Actions []AlertAction `json:"actions"` // Actions to take when triggered
Cooldown string `json:"cooldown"` // Cooldown period between alerts
}
// AlertAction alert action
type AlertAction struct {
Type string `json:"type"` // "email" | "webhook" | "notification"
Config map[string]interface{} `json:"config"` // Action-specific configuration
}
``` ```