- Add RoutingWorkflow: generic state machine executor for WorkflowSpec - Add LLM Router: natural language → WorkflowSpec generation - Add RetrieveMemoryActivity: query poimen-memory for context - Add activities: AnalyzeCode, SecurityScan, GenerateReport, Notify, etc. - Add agent-prompts/router: LLM prompt documentation - Extend starter with --route flag for routing workflows - Remove orchestrator job (trigger via API/message instead) - Clean up: move docs to Desktop, add .gitignore for *.md
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# Agent Prompts
|
||||
|
||||
LLM agent prompts for Poimen RoutingWorkflow.
|
||||
|
||||
## Agents
|
||||
|
||||
| Agent | Model | Purpose | Prompt File |
|
||||
|-------|-------|---------|-------------|
|
||||
| **Router** | `reasoning` | Natural language → WorkflowSpec | [router/AGENTS.md](router/AGENTS.md) |
|
||||
|
||||
---
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
User Request: "Scan repo X for security issues"
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ RetrieveMemoryActivity │
|
||||
│ Query poimen-memory for relevant skills/lessons│
|
||||
└─────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ Router Agent (LLM) │
|
||||
│ Input: message + memory context + activities │
|
||||
│ Output: WorkflowSpec JSON │
|
||||
└─────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ RoutingWorkflow │
|
||||
│ Executes WorkflowSpec as state machine │
|
||||
│ Clone → Scan → Report → Notify │
|
||||
└─────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Memory Integration
|
||||
|
||||
Router receives context from `RetrieveMemoryActivity`:
|
||||
|
||||
```
|
||||
1. User: "scan repo for security"
|
||||
2. RetrieveMemoryActivity queries poimen-memory
|
||||
3. Returns: skills, lessons, references
|
||||
4. Injected into Router prompt
|
||||
5. Router generates smarter WorkflowSpec
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## LLM Endpoint
|
||||
|
||||
Default: `https://api.riotpiao.com/v1/chat/completions`
|
||||
|
||||
Override: `LOCAL_LLM_BASE_URL=http://localhost:11434`
|
||||
@@ -0,0 +1,91 @@
|
||||
# Router Agent
|
||||
|
||||
**Purpose**: Intelligent workflow router that analyzes user requests and generates workflow specs.
|
||||
|
||||
**Model**: `reasoning` (via api.riotpiao.com)
|
||||
|
||||
**When Used**: User submits natural language request → Router generates WorkflowSpec/CronWorkflowSpec
|
||||
|
||||
---
|
||||
|
||||
## System Prompt
|
||||
|
||||
```
|
||||
You are an intelligent workflow router. Your job is to:
|
||||
1. Understand what the user wants to accomplish
|
||||
2. Select the appropriate activities from the available list
|
||||
3. Order them correctly based on dependencies
|
||||
4. Extract any parameters mentioned (URLs, branches, etc)
|
||||
5. Detect if user wants scheduled/recurring execution
|
||||
6. Use any relevant knowledge from memory to inform your decisions
|
||||
|
||||
Rules:
|
||||
- Always include CloneRepoActivity first if any analysis activity is needed
|
||||
- Order activities respecting dependencies
|
||||
- If user mentions "daily", "every hour", "weekly", etc → set isCron=true and cronSchedule
|
||||
- Common cron patterns: "0 2 * * *" (2 AM daily), "0 * * * *" (hourly), "0 0 * * 0" (weekly Sunday)
|
||||
- Extract repo URLs, branch names, severity levels from the message
|
||||
- workflowName should be short and descriptive (kebab-case)
|
||||
- If memory context includes relevant skills or lessons, incorporate that knowledge
|
||||
- Skills from memory may suggest specific activity parameters or ordering
|
||||
|
||||
Output ONLY valid JSON.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## User Prompt Template
|
||||
|
||||
```
|
||||
User request: {{.Message}}
|
||||
{{if .Context}}
|
||||
Provided context: {{.Context}}
|
||||
{{end}}
|
||||
{{if .MemoryContext}}
|
||||
Relevant skills from memory:
|
||||
{{range .MemoryContext.Skills}}- {{.Name}}: {{.Description}} (reason: {{.Why}})
|
||||
{{end}}
|
||||
Relevant knowledge from memory:
|
||||
{{range .MemoryContext.Lessons}}- [{{.Level}}] {{.Text}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
Available activities:
|
||||
{{range .Activities}}- {{.Name}}: {{.Description}} (category: {{.Category}}, timeout: {{.Timeout}}, flaky: {{.IsFlaky}})
|
||||
{{end}}
|
||||
Analyze the request and output JSON with:
|
||||
- activities: ordered list of activity names to execute
|
||||
- parameters: extracted parameters from request (repo URL, branch, etc)
|
||||
- isCron: true if user wants scheduled/recurring execution
|
||||
- cronSchedule: cron expression if scheduled (e.g., "0 2 * * *" for 2 AM daily)
|
||||
- cronTimezone: timezone (default "UTC")
|
||||
- workflowName: short descriptive name
|
||||
- errorHandling: "retry" (default), "fail-fast", or "continue"
|
||||
|
||||
Output ONLY valid JSON, no explanation.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Expected Output Format
|
||||
|
||||
```json
|
||||
{
|
||||
"activities": ["CloneRepoActivity", "SecurityScanActivity", "GenerateReportActivity"],
|
||||
"parameters": {
|
||||
"repo": "https://github.com/example/repo",
|
||||
"branch": "main",
|
||||
"severity": "high"
|
||||
},
|
||||
"isCron": false,
|
||||
"cronSchedule": "",
|
||||
"cronTimezone": "UTC",
|
||||
"workflowName": "security-scan-example",
|
||||
"errorHandling": "retry"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Source File
|
||||
|
||||
`internal/routing/llm_router.go`
|
||||
Reference in New Issue
Block a user