This commit is contained in:
Timothy Jaeryang Baek
2026-06-29 13:03:14 -05:00
parent 7ea7680f56
commit 517cd8d102
45 changed files with 1293 additions and 969 deletions
+3 -9
View File
@@ -217,9 +217,7 @@ async def load_tool_module_by_id(tool_id, content=None):
# Install required packages found within the frontmatter.
# Runs `pip install` via subprocess, which can take a long time;
# offload to a thread so it doesn't block the event loop.
await asyncio.to_thread(
install_frontmatter_requirements, frontmatter.get('requirements', '')
)
await asyncio.to_thread(install_frontmatter_requirements, frontmatter.get('requirements', ''))
module_name = f'tool_{tool_id}'
module = types.ModuleType(module_name)
@@ -264,9 +262,7 @@ async def load_function_module_by_id(function_id: str, content: str | None = Non
else:
frontmatter = extract_frontmatter(content)
# `pip install` via subprocess can block for a long time; offload it.
await asyncio.to_thread(
install_frontmatter_requirements, frontmatter.get('requirements', '')
)
await asyncio.to_thread(install_frontmatter_requirements, frontmatter.get('requirements', ''))
module_name = f'function_{function_id}'
module = types.ModuleType(module_name)
@@ -468,8 +464,6 @@ async def install_tool_and_function_dependencies():
all_dependencies += f'{dependencies}, '
# `pip install` via subprocess can block for a long time; offload it.
await asyncio.to_thread(
install_frontmatter_requirements, all_dependencies.strip(', ')
)
await asyncio.to_thread(install_frontmatter_requirements, all_dependencies.strip(', '))
except Exception as e:
log.error(f'Error installing requirements: {e}')