Skip to content
This repository was archived by the owner on Mar 12, 2026. It is now read-only.

Commit dbd32ae

Browse files
committed
fix: cache query to avoid LangGraph sandbox issues
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
1 parent 40d8f25 commit dbd32ae

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

apps/agent/src/query.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
from pathlib import Path
33
import csv
44

5+
# Read data at module load time to avoid file I/O issues in
6+
# LangGraph Cloud's sandboxed tool execution environment.
7+
_csv_path = Path(__file__).parent / "db.csv"
8+
with open(_csv_path) as _f:
9+
_cached_data = list(csv.DictReader(_f))
10+
511
@tool
612
def query_data(query: str):
713
"""
814
Query the database, takes natural language. Always call before showing a chart or graph.
915
"""
10-
csv_path = Path(__file__).parent / "db.csv"
11-
with open(csv_path) as f:
12-
reader = csv.DictReader(f)
13-
return list(reader)
16+
return _cached_data

0 commit comments

Comments
 (0)