Open Agent Platform Supervisor
This project leverages the pre-built LangGraph Supervisor agent to orchestrate specialist agents via a RemoteGraph.
Features
- Dynamic Agent Delegation: The supervisor can decide whether to handle a user query itself or delegate it to a configured specialist agent.
- Configurable Agents: Easily define and configure multiple child agents, selecting from the list of existing agents you have deployed and configured in Open Agent Platform (OAP).
- Customizable System Prompt: Tailor the supervisor's behavior and instructions using a configurable system prompt, with a sensible default provided.
Deployments
Local
To run the supervisor locally,
- Clone this repo
gh repo clone langchain-ai/open-agent-supervisor
-
Copy the
.env.examplefile into.env, and set your environment variablesWe default to OpenAI to provide the underlying supervisor agent LLM
cp .env.example .env
- Install the in-memory LangGraph command line package
pip install -U "langgraph-cli[inmem]"
- Run the LangGraph server locally
langgraph dev
For more info, see our LangGraph CLI docs
OAP
Important
Prerequisites: Have at least one supervisor deployed to your instance of LangGraph Platform (LGP) that matches or extends the base implementation provided in this repo
To add a supervisor agent to the platform:
- Navigate to the
Agentstab in the left menu bar - Create and agent and select the graph deployed to your LGP instance described in the prerequisites above
- Give your supervisor a name, description, an optional system prompt if you'd like to modify it and select the agents that it will orchestrate (note - these agents will need to already be deployed in your LGP instance and configured in Open Agent Platform)
How it Works
The supervisor operates based on a system prompt that instructs it on how to manage incoming user messages. It can either:
- Answer the user directly.
- Delegate the query to a specialist agent by invoking a tool in the format
delegate_to_<agent_name>(user_query).
The user sees all messages and and optionally all tool calls, ensuring transparency in the conversation flow.
Authentication
This project uses LangGraph custom auth to authenticate requests to the server. It's configured to use Supabase as the authentication provider, however it can be easily swapped for another service.
Requests must contain an Authorization header with a Bearer token. This token should be a valid JWT token from Supabase.
The auth handler then takes that token and verifies it with Supabase. If the token is valid, it returns the user's identity. If the token is invalid, it raises an exception. This means you must have a Supabase URL & key set in your environment variables to use this auth handler:
SUPABASE_URL=""
SUPABASE_KEY=""
The auth handler is then used as middleware for all requests to the server. It is configured to run on the following events:
threads.createthreads.readthreads.deletethreads.updatethreads.searchassistants.createassistants.readassistants.deleteassistants.updateassistants.searchstore
For creation methods, it auto-injects the user's ID into the metadata. This is then uses in all read/update/delete/search methods to ensure that the user can only access their own threads and assistants.
By using custom authentication, we can call this LangGraph server directly from a frontend application, without having to worry about exposing API keys/secrets, since you only need a JWT token from Supabase to authenticate.
For more info, see our LangGraph custom auth docs.