-
Notifications
You must be signed in to change notification settings - Fork 2
Add shell command detection and execution to agent loop #16
Copy link
Copy link
Closed
Labels
featureNew functionalityNew functionality
Description
Description
Extend the agent loop to detect fenced bash code blocks in LLM output, execute them, and feed results back to the LLM for a final response.
Parent: #3
Branch
feat/m2/shell-execution
Files
crates/zeph-core/src/context.rs— context builder (system + skills + history + message)crates/zeph-core/src/agent.rs— shell detection, execution, re-query loopcrates/zeph-core/Cargo.toml— add zeph-skills dependency
Detection Logic
- LLM returns response text
- Scan for
```bash\n...\n```blocks - If found: execute via
tokio::process::Command - Capture stdout + stderr
- Send back to LLM: "Command output:\n{stdout}\n\nFormat a response for the user."
- Return final response to user
Acceptance Criteria
- Context includes system prompt + skill instructions
- Bash code blocks detected in LLM output
- Commands executed with 30s timeout
- Output fed back to LLM for final answer
- Non-bash code blocks ignored (not executed)
- Command failure (non-zero exit) included in output
Depends On
#13 (Skill registry), #14 (Prompt formatter), #15 (Bundled skills), #11 (CLI agent loop)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionalityNew functionality