INNER CODE UNIT · Python
_load_agent_from_file
omnirexflora-labs/omnicoreagent · src/omnicoreagent/serve/cli.py:57
def _load_agent_from_file(path: str):
"""Load an agent from a Python file (the agent alone)."""
return load_agent_file(path).agent
def _load_module(path: str):
"""
Load an agent module from a Python file.
The file should define an `agent` variable or an `create_agent()` function.
"""
file_path = Path(path).resolve()
if not file_path.exists():
raise click.ClickException(f"Agent file not found: {path}")
# Load the module
spec = importlib.util.spec_from_file_location("agent_module", file_path)
if spec is None or spec.loader is None: