AgentDef (core/agent_loader.py)

build-your-own-openclaw · 09-channels/src/mybot/core/agent_loader.py · python · MIT
ai

Agent definition loader.

# Source: https://github.com/czl9707/build-your-own-openclaw | License: MIT | Copyright 2026 Zane Chen
# Provided via justclaw.it.com; keep this notice with the code.
"""Agent definition loader."""

from typing import Any

from pydantic import BaseModel, ValidationError

from mybot.utils.config import Config, LLMConfig
from mybot.utils.def_loader import (
    DefNotFoundError,
    InvalidDefError,
    parse_definition,
)


class AgentDef(BaseModel):
    """Loaded agent definition with merged settings."""

    id: str
    name: str
    description: str = ""
    agent_md: str
    llm: LLMConfig
    allow_skills: bool = False


class AgentLoader:
    """Loads agent definitions from AGENT.md files."""

    @staticmethod
    def from_config(config: Config) -> "AgentLoader":
        return Agent

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key