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

Install the MicroStax agent tools in your LangChain project:

npm install @langchain/core @fabbrik/microstax-agents

Initializing Tools

import { getMicroStaxTools } from '@fabbrik/microstax-agents';

const tools = getMicroStaxTools({
  apiKey: process.env.MICROSTAX_TOKEN,
  baseUrl: 'https://api.microstax.ai'
});

Available Tools

Tool NamePurpose
microstax_environment_listDiscover and filter active environments.
microstax_environment_getRetrieve detailed runtime status and endpoints.
microstax_diagnoseRun AI-driven diagnostics on a specific environment.
microstax_apply_remediationApply one of the suggested fixes from the diagnoser.
microstax_logsFetch 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

LangGraph Integration | MicroStax Documentation