LangGraph Integration
Building autonomous, stateful SRE agents with LangGraph and MicroStax Tools.
MicroStax provides first-class support for autonomous agents built with LangGraph and LangChain. While the MCP server is optimized for human-in-the-loop chat, the LangGraph toolset is designed for stateful, looping agents that manage infrastructure without manual intervention.
Why LangGraph?
Autonomous devops requires more than just "chatting" with your infrastructure. It requires:
- State Management: Keeping track of diagnostic results across multiple turns.
- Looping Logic: Re-diagnosing an environment after applying a fix.
- Autonomous Decision Making: Scaling services or rolling back deployments based on health signals.
Getting Started
The MicroStax agent tools ship in the MicroStax repository at src/agents/langgraph and are not yet published to npm. Import them from that directory and install LangChain yourself (npm install @langchain/core).
Initializing Tools
import { getMicroStaxTools } from './src/agents/langgraph';
const tools = getMicroStaxTools({
apiKey: process.env.MICROSTAX_TOKEN,
baseUrl: 'https://api.microstax.ai',
});
Available Tools
| Tool Name | Purpose |
|---|---|
microstax_environment_list | Discover and filter active environments. |
microstax_environment_get | Retrieve detailed runtime status and endpoints. |
microstax_environment_create | Create an environment from a Blueprint. |
microstax_environment_delete | Delete an environment. |
microstax_diagnose | Run AI-driven diagnostics on a specific environment. |
microstax_apply_remediation | Apply one of the suggested fixes from the diagnoser. |
microstax_logs | Fetch targeted logs for specific services. |
Example: Self-Healing SRE Loop
Below is a conceptual LangGraph state machine that uses MicroStax tools to autonomously repair failed environments.
import { StateGraph } from "@langchain/langgraph";
// Define the graph that list, diagnoses, and fixes failures
const workflow = new StateGraph({ ... })
.addNode("monitor", async () => {
// Uses microstax_environment_list
})
.addNode("investigate", async () => {
// Uses microstax_diagnose and microstax_logs
})
.addNode("repair", async () => {
// Uses microstax_apply_remediation
})
.addEdge("monitor", "investigate")
.addEdge("investigate", "repair")
.addEdge("repair", "monitor"); // Close the loop
Next Steps
- Explore the MCP Server for interactive AI workflows.
- Learn about Intelligent Diagnostics and how it powers these tools.