fix: Pass api key for auth

This commit is contained in:
bracesproul
2025-05-12 17:16:01 -07:00
parent 34a482e024
commit 5662fc8ad9
4 changed files with 31 additions and 6 deletions
+4 -1
View File
@@ -1,4 +1,7 @@
OPENAI_API_KEY=""
SUPABASE_URL=""
SUPABASE_KEY=""
SUPABASE_KEY=""
# Required for calling remote graphs
LANGSMITH_API_KEY=""
+14
View File
@@ -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"
+11 -4
View File
@@ -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
View File
@@ -9,4 +9,5 @@ langchain-community
scikit-learn
openai
ipython
supabase
supabase
ruff