INNER CODE UNIT · Python

load_agent_file

omnirexflora-labs/omnicoreagent · src/omnicoreagent/serve/cli.py:40

def load_agent_file(path: str) -> LoadedAgentFile:
    module = _load_module(path)
    if hasattr(module, "agent"):
        agent = module.agent
    elif hasattr(module, "create_agent"):
        agent = module.create_agent()
    else:
        raise click.ClickException(
            "Agent file must define an 'agent' variable or 'create_agent()' function"
        )
    routers = list(getattr(module, "routers", None) or [])
    if getattr(module, "router", None) is not None:
        routers.insert(0, module.router)
    public_paths = [str(path) for path in (getattr(module, "public_paths", None) or [])]
    return LoadedAgentFile(agent=agent, routers=routers, public_paths=public_paths)


def _load_agent_from_file(path: str):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…