OpsPilot is an autonomous Linux operations agent that understands natural language and safely automates remote server administration. Built with LangGraph and the ReAct reasoning framework, it plans multi-step tasks, executes commands over SSH, searches the web for relevant documentation, evaluates command risk using AI, and requires human approval before performing potentially dangerous operations.
OpsPilot combines autonomous reasoning with human oversight to provide secure, reliable, and intelligent terminal automation.
- Autonomous task planning using the ReAct reasoning pattern
- Multi-step workflow orchestration with LangGraph
- Secure remote Linux command execution over SSH
- AI-powered command risk classification
- Human-in-the-loop approval for sensitive operations
- Integrated web search for documentation and troubleshooting
- Sequential tool execution with structured tool responses
- Context-aware conversations with output truncation
- Circuit breaker to prevent infinite reasoning loops
- Built using Node.js and OpenAI-compatible APIs (Groq)
- Node.js
- LangGraph
- OpenAI SDK
- Groq
- SSH2
- Tavily Search API
- JavaScript (ES Modules)
.
├── tools/
│ ├── commandRiskClassifier.tool.js
│ ├── search.tool.js
│ └── ssh.tool.js
├── agent.js
├── constants.js
├── index.js
├── llm.js
├── utils.js
├── Architecture.md
└── package.json
- User provides a task in natural language.
- The agent reasons about the task using LangGraph.
- If external information is required, it performs a web search.
- If terminal execution is required, the command is evaluated by the AI risk classifier.
- Commands requiring approval are presented to the user.
- Approved commands are executed on the remote Linux server over SSH.
- Command outputs are truncated and returned to the agent for further reasoning.
- The process continues until the task is completed or the circuit breaker limit is reached.
OpsPilot is designed with security as a primary objective.
- AI-based command risk assessment
- Human approval before executing unsafe commands
- Sequential command execution
- Remote execution only through authenticated SSH
- Circuit breaker to prevent infinite execution loops
- Structured tool responses for reliable reasoning
Clone the repository.
git clone https://github.com/your-username/opspilot.git
cd opspilotInstall dependencies.
npm installCreate a .env file.
GROQ_API_KEY=
TAVILY_API_KEY=
SSH_HOST=
SSH_PORT=22
SSH_USERNAME=
SSH_KEY_PATH=
AGENT_LLM_MODEL_NAME=
CLASSIFIER_LLM_MODEL_NAME=Start the agent.
npm run devExample:
You: Check disk usage on the server.
You: Find why nginx is failing to start.
You: Update package lists.
You: Restart the nginx service.
- Sliding window memory using LangChain message trimming
- Multi-server operation agent
- Persistent conversation memory
- Session history
- Plugin-based tool architecture
Prathamesh Arun Gurav