feat(agents): add patrol system prompt for autonomous patrol agent#2023
feat(agents): add patrol system prompt for autonomous patrol agent#2023zhangyinxina-ui wants to merge 1 commit into
Conversation
Adds PATROL_SYSTEM_PROMPT constant for the autonomous patrol LLM agent running on Unitree Go2. The prompt defines the agent identity (Daneel), patrol workflow (prepare, plan route, execute, monitor, report), all available patrol/navigation/mapping skills, safety instructions, and anomaly handling guidelines. Includes 31 unit tests verifying prompt content coverage: all 21 skill names, key sections (safety, workflow, anomaly handling), workflow steps, obstacle handling, battery monitoring, and SLAM references.
Greptile SummaryThis PR adds
Confidence Score: 3/5Safe to merge as a string constant, but two logical gaps in the prompt mean the patrol agent will not behave correctly in all advertised scenarios. The "create new map" preparation step instructs the agent to call dimos/agents/skills/patrol_system_prompt.py — the preparation workflow and safety rules sections need revision before this prompt is deployed to a live robot. Important Files Changed
Sequence DiagramsequenceDiagram
participant Op as Operator
participant Agent as Daneel (LLM Agent)
participant Skills as Robot Skills
participant HW as Go2 Hardware
Op->>Agent: Start patrol command
Agent->>Skills: check_localization_quality
Skills-->>Agent: localization quality OK
Agent->>Skills: list_available_maps / load_saved_map
Skills-->>Agent: map loaded
Agent->>Skills: create_patrol_route + add_patrol_waypoint(x,y)
Agent->>Skills: start_patrol
loop Each waypoint
Skills->>HW: navigate to waypoint
HW-->>Skills: arrived
Agent->>Skills: observe (photo)
Agent->>Skills: speak (status update)
Agent->>Skills: check_localization_quality
alt Localization lost
Agent->>Skills: stop_patrol
Agent->>Skills: speak (notify operator)
end
alt Obstacle detected
Agent->>Skills: stop_navigation
Agent->>Skills: relative_move (avoid)
end
alt "Battery < 30%"
Agent->>Skills: speak (low battery warning)
end
alt "Battery < 20%"
Agent->>Skills: stop_patrol
Agent->>Skills: navigate_with_text (return to charger)
end
end
Agent->>Skills: speak (patrol summary)
Agent->>Skills: save_current_map
Agent-->>Op: Patrol complete, report anomalies
Reviews (1): Last reviewed commit: "feat(agents): add patrol system prompt f..." | Re-trigger Greptile |
| - 使用 `check_localization_quality` 检查 SLAM 定位质量,确保定位可靠。 | ||
| - 使用 `check_map_coverage` 查看当前地图覆盖范围。 | ||
| - 如有已保存地图,使用 `load_saved_map` 加载。使用 `list_available_maps` 查看可用地图。 | ||
| - 如需新建地图,先使用 `save_current_map` 保存当前地图。 |
There was a problem hiding this comment.
New-map workflow has no executable skill
The preparation step says "如需新建地图,先使用 save_current_map 保存当前地图" (If you need a new map, first use save_current_map to save the current map), but save_current_map only persists the current SLAM map — it doesn't start a new mapping session. None of the skills listed under PatrolExecutor, PatrolMapManager, or LidarSlamModule can actually initiate a fresh map build (there is no start_mapping, reset_map, or equivalent). An agent that encounters an unmapped environment will follow this instruction and preserve the old map, then have no path forward for actually building a new one.
| - 人类安全永远是最高优先级。尊重个人空间,保持安全距离。 | ||
| - 绝不执行可能伤害人类、损坏财产或损坏机器人的操作。 | ||
| - 如果检测到障碍物,立即减速或停止。使用 `stop_navigation` 或 `stop_patrol` 紧急停止。 | ||
| - 始终监控电池电量。电量低于 20% 时,停止巡检并返回充电位置。 |
There was a problem hiding this comment.
Battery warning threshold absent from safety rules
The "安全第一" section only calls out the 20% stop threshold. The detailed "电量不足" anomaly section introduces a separate 30% warning threshold, but this higher-level rule doesn't appear in the safety constraints the agent is most likely to anchor on first. In practice the agent may skip the 30% verbal warning (and the chance for an operator to redirect it) and only act at 20%.
| - 始终监控电池电量。电量低于 20% 时,停止巡检并返回充电位置。 | |
| - 始终监控电池电量。电量低于 30% 时,使用 `speak` 发出低电量警告;电量低于 20% 时,停止巡检并返回充电位置。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39e96d7749
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # 可用技能列表 | ||
|
|
||
| ## 巡检控制技能(PatrolExecutor) | ||
| - `create_patrol_route` — 创建新的巡检路线 |
There was a problem hiding this comment.
Remove unimplemented tools from patrol prompt
The prompt instructs the agent to call create_patrol_route (and the other patrol/map methods in this section), but there are no corresponding @skill implementations in the current codebase (existing movement/navigation skills are in NavigationSkillContainer and UnitreeSkillContainer, e.g. navigate_with_text, stop_navigation, relative_move, wait). If this prompt is used by a patrol agent, those tool calls will fail at runtime and the patrol workflow cannot execute as written, so the prompt needs to be aligned with actually registered tool names or backed by new skills.
Useful? React with 👍 / 👎.
Adds PATROL_SYSTEM_PROMPT constant for the autonomous patrol LLM agent running on Unitree Go2. Includes prompt definition and 31 unit tests.