mirror of
https://github.com/langchain-ai/oap-agent-supervisor.git
synced 2026-07-01 20:04:03 -04:00
fix: Pass api key for auth
This commit is contained in:
+4
-1
@@ -1,4 +1,7 @@
|
||||
OPENAI_API_KEY=""
|
||||
|
||||
SUPABASE_URL=""
|
||||
SUPABASE_KEY=""
|
||||
SUPABASE_KEY=""
|
||||
|
||||
# Required for calling remote graphs
|
||||
LANGSMITH_API_KEY=""
|
||||
@@ -0,0 +1,14 @@
|
||||
.PHONY: format lint help
|
||||
|
||||
format:
|
||||
ruff format .
|
||||
ruff check --fix .
|
||||
|
||||
lint:
|
||||
ruff check .
|
||||
ruff format --diff
|
||||
|
||||
help:
|
||||
@echo "Available commands:"
|
||||
@echo " make format - Format code with ruff"
|
||||
@echo " make lint - Check code with ruff"
|
||||
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
from langgraph.pregel.remote import RemoteGraph
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langgraph_supervisor import create_supervisor
|
||||
@@ -51,16 +52,23 @@ def make_child_graphs(cfg: GraphConfigPydantic):
|
||||
Instantiate a list of RemoteGraph nodes based on the configuration.
|
||||
"""
|
||||
import re
|
||||
|
||||
|
||||
def sanitize_name(name):
|
||||
# Replace spaces with underscores
|
||||
sanitized = name.replace(" ", "_")
|
||||
# Remove any other disallowed characters (<, >, |, \, /)
|
||||
sanitized = re.sub(r'[<|\\/>]', '', sanitized)
|
||||
sanitized = re.sub(r"[<|\\/>]", "", sanitized)
|
||||
return sanitized
|
||||
|
||||
return [
|
||||
RemoteGraph(a.agent_id, url=a.deployment_url, name=sanitize_name(a.name)) for a in cfg.agents
|
||||
RemoteGraph(
|
||||
a.agent_id,
|
||||
url=a.deployment_url,
|
||||
name=sanitize_name(a.name),
|
||||
api_key=os.environ.get("LANGSMITH_API_KEY"),
|
||||
headers={"x-auth-scheme": "langsmith"},
|
||||
)
|
||||
for a in cfg.agents
|
||||
]
|
||||
|
||||
|
||||
@@ -75,7 +83,6 @@ def make_prompt(cfg: GraphConfigPydantic):
|
||||
|
||||
|
||||
def graph(config: RunnableConfig):
|
||||
|
||||
cfg = GraphConfigPydantic(**config.get("configurable", {}))
|
||||
child_graphs = make_child_graphs(cfg)
|
||||
|
||||
|
||||
+2
-1
@@ -9,4 +9,5 @@ langchain-community
|
||||
scikit-learn
|
||||
openai
|
||||
ipython
|
||||
supabase
|
||||
supabase
|
||||
ruff
|
||||
Reference in New Issue
Block a user