Skip to main content

Overview

LangGraph is a framework for building stateful, multi-actor applications with LLMs. Connect your Pylar MCP tools to LangGraph to give your agents access to your data through governed views.

Prerequisites

  • ✅ Python environment with LangGraph installed
  • ✅ Pylar project with published MCP tools
  • ✅ MCP HTTP Stream URL and Bearer Token from Pylar

Installation

Install the MCP Python client:

Step 1: Get Your Pylar Credentials

  1. In Pylar, navigate to your project
  2. Click “Publish” in the right sidebar
  3. Copy both:
    • MCP HTTP Stream URL: https://mcp.publish.pylar.ai/mcp
    • Authorization Bearer Token: Your unique token

Step 2: Connect to Pylar in LangGraph

Create an MCP client connection:

Step 3: Integrate with LangGraph Agent

Add Pylar tools to your LangGraph agent:

Step 4: Use in Your Workflow

Your LangGraph agent can now use Pylar tools:

Benefits

  • Stateful Workflows: Build complex agent workflows with data access
  • Type Safety: Use typed tools in your Python code
  • Centralized Control: Update views in Pylar, agents get updates
  • Full Visibility: Monitor agent usage through Pylar Evals
  • No SQL in Code: Keep SQL in Pylar, not in your agent code

Best Practices

Error Handling

Caching

Cache tool results when appropriate:

Type Validation

Validate tool arguments:

Troubleshooting

Issue: Connection errors

Solutions:
  • Verify Bearer Token is correct
  • Check network connectivity
  • Ensure MCP URL is correct
  • Test connection with curl first

Issue: Tool not found

Solutions:
  • Verify tool name matches exactly
  • Check tools are published in Pylar
  • List available tools first

Next Steps