How langchain-ai/oap-agent-supervisor works
Project type and purpose
• This is a backend “supervisor” microservice built on top of LangGraph.
• It exposes a LangGraph server that authenticates incoming requests, accepts user messages, and either answers them itself via an LLM or delegates them to specialized child agents (deployed elsewhere on the Open Agent Platform).
File structure
• Top‐level files:
• .env.example, pyproject.toml, Makefile → environment, packaging, and build/config scripts
• langgraph.json → graph definition used by LangGraph CLI
• Package oap_supervisor/:
• agent.py → main GraphConfigPydantic class and supervisor logic
• security/auth.py → custom authentication handler using Supabase
README for additional insights
• Describes dynamic delegation patterns, system prompt configuration, and Supabase‐based JWT authentication.
• Explains that the service sits on LangGraph server and uses RemoteGraph to call child agents.
Main components
a. Client (or OAP front‐end / CLI)
b. LangGraph Server hosting the Supervisor Graph
c. Authentication middleware (Supabase JWT verification)
d. Supervisor Agent logic (inside agent.py)
e. LLM Provider (default: OpenAI)
f. RemoteGraph invocation to Child Agents
g. Child Specialist Agents (hosted on OAP / LGP)
h. Configuration layer (langgraph.json, GraphConfigPydantic)
Relationships and data flow
1. Client → HTTP/WebSocket → LangGraph Server
2. LangGraph Server → Auth middleware → Supabase (verify JWT)
3. Auth middleware → LangGraph Server → Supervisor Graph
4. Supervisor Graph →
• Either call OpenAI LLM directly for response
• Or call RemoteGraph tool → remote child‐agent graph → child agent LLM → return result
5. Supervisor Graph returns final response back through LangGraph Server → Client
Architectural patterns and design principles
• Microservice style: single‐purpose supervisor service
• Plugin/delegation pattern: uses LangGraph “tools” to invoke specialist agents
• Configuration‐as‐code: all agent wiring lives in GraphConfigPydantic plus langgraph.json
• Secure by default: JWT‐based auth middleware, environment‐driven secrets
Technologies, frameworks, and libraries
• Python + LangChain LangGraph Supervisor
• Pydantic for config
• Supabase for auth
• OpenAI (or pluggable LLMs)
• LangGraph CLI & server (dev via uv run langgraph dev)
Don’t overthink—capture every moving part
• Both in‐process operations (direct LLM calls) and out‐of‐process delegations (RemoteGraph to OAP)