Skip to content

Commit cffecf1

Browse files
committed
fix: resolve 3 starter crash root causes — Docker home dir, path depth, import rewriting
1. EACCES on /home/app: Dockerfile templates now create home dir for non-root user before USER app (langgraph-ts, claude-sdk-ts, mastra) 2. IndexError Path.parents[4]: search_flights.py schema fallback now guards against shallow Docker paths (agno, claude-sdk-py, ms-agent-py) 3. Wrong import path: rewritePythonImports() now converts from agents.X to relative imports in starter agent dirs (langroid, crewai)
1 parent 699f931 commit cffecf1

37 files changed

Lines changed: 174 additions & 93 deletions

File tree

showcase/scripts/generate-starters.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,14 @@ function rewritePythonImports(filePath: string, _agentDir: string): void {
328328
"$1from .$2 import ",
329329
);
330330

331+
// Rewrite "from agents.X import ..." to "from .X import ..."
332+
// When the demo "agents/" dir is renamed to "agent/" in starters,
333+
// intra-package absolute imports break. Convert to relative imports.
334+
content = content.replace(
335+
/^(\s*)from agents\.([\w.]+) import /gm,
336+
"$1from .$2 import ",
337+
);
338+
331339
fs.writeFileSync(filePath, content);
332340
}
333341

showcase/shared/python/tools/search_flights.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@
3636

3737
# Fallback: use the schema from the examples directory if present
3838
if _flight_schema is None:
39-
_fallback = Path(__file__).resolve().parents[4] / (
40-
"examples/integrations/langgraph-python/apps/agent/src/a2ui/schemas/flight_schema.json"
41-
)
42-
if _fallback.exists():
43-
with open(_fallback) as _f:
44-
_flight_schema = json.load(_f)
45-
_logger.info("Loaded flight schema from examples fallback: %s", _fallback)
39+
try:
40+
_fallback = Path(__file__).resolve().parents[4] / (
41+
"examples/integrations/langgraph-python/apps/agent/src/a2ui/schemas/flight_schema.json"
42+
)
43+
if _fallback.exists():
44+
with open(_fallback) as _f:
45+
_flight_schema = json.load(_f)
46+
_logger.info("Loaded flight schema from examples fallback: %s", _fallback)
47+
except IndexError:
48+
# In Docker the file path is too shallow for parents[4]; skip this fallback.
49+
pass
4650

4751
# Last resort: inline minimal schema
4852
if _flight_schema is None:

showcase/starters/ag2/Dockerfile

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

showcase/starters/ag2/agent/tools/search_flights.py

Lines changed: 11 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

showcase/starters/agno/Dockerfile

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

showcase/starters/agno/agent/tools/search_flights.py

Lines changed: 11 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

showcase/starters/claude-sdk-python/Dockerfile

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

showcase/starters/claude-sdk-python/agent/tools/search_flights.py

Lines changed: 11 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

showcase/starters/claude-sdk-typescript/Dockerfile

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

showcase/starters/crewai-crews/Dockerfile

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)