Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:ANative Lab EvoAgentX CoreInfrastructure

From Leeroopedia
Knowledge Sources
Domains Core, Infrastructure
Last Updated 2026-10-21 00:00 GMT

Overview

Concrete core infrastructure classes for configuration, messaging, metadata, parsing, and thread-safe decorators.

Description

EvoAgentX core infrastructure provides foundational classes:

  • Config (`config.py`) — Pydantic BaseModel that loads from YAML files, validates `llm_config` via `MODEL_REGISTRY`, and propagates LLM config to agents. Entry point for declarative workflow configuration.
  • BaseConfig & Parameter (`core/base_config.py`) — `BaseConfig` extends `BaseModule` with save/get_config_params methods. `Parameter` defines named config parameters with type, description, required flag, and optional json_schema validation. All LLMConfig, agent configs, and tool configs inherit from `BaseConfig`.
  • Message & MessageType (`core/message.py`) — `Message` extends `BaseModule` with content, agent (sender), action, prompt, msg_type (REQUEST/RESPONSE/COMMAND/ERROR/INPUT), workflow context, message_id, timestamp, conversation_id. Core data structure flowing through workflows.
  • Metadata (`core/metadata.py`) — Base metadata with `__add__` operator for merging. Handles type-specific merging: numbers add, lists concatenate, sets union, dicts recursively merge.
  • Parser (`core/parser.py`) — Base `Parser` class for parsing LLM text into structured objects. Subclasses (`LLMOutputParser`) implement specific parsing strategies.
  • Decorators (`core/decorators.py`) — `atomic()`, `atomic_method()`, `async_atomic_method()` for thread-safe execution using `threading.Lock` / `asyncio.Lock`.

Usage

  • YAML configuration: Use `Config` to load workflow configurations from YAML files.
  • Parameter definition: Use `Parameter` to define workflow node I/O specifications.
  • Messaging: `Message` is the communication unit between agents and actions.
  • Thread safety: Use `@atomic_method` decorator for thread-safe methods.

Code Reference

Source Location

Signature

class Config(BaseModel):
    llm_config: LLMConfig
    agents: Optional[List[dict]] = None

class BaseConfig(BaseModule):
    def save(self, path: str) -> str
    def get_config_params(self) -> dict

class Parameter(BaseModule):
    name: str
    type: str
    description: str
    required: bool = True
    json_schema: Optional[dict] = None

class Message(BaseModule):
    content: Any
    agent: Optional[str]
    action: Optional[str]
    msg_type: MessageType

class Metadata(BaseModule):
    def __add__(self, other: "Metadata") -> "Metadata"

class Parser(BaseModule):
    @classmethod
    def parse(cls, text: str) -> Any

def atomic_method(func): ...
def async_atomic_method(func): ...

Import

from evoagentx.config import Config
from evoagentx.core.base_config import BaseConfig, Parameter
from evoagentx.core.message import Message, MessageType
from evoagentx.core.metadata import Metadata
from evoagentx.core.parser import Parser
from evoagentx.core.decorators import atomic_method, async_atomic_method

I/O Contract

Inputs

Name Type Required Description
yaml_path str Yes (Config) YAML config file path
content Any Yes (Message) Message content
text str Yes (Parser) Text to parse

Outputs

Name Type Description
Config instance Config Validated workflow configuration
Message instance Message Communication unit for workflows

Usage Examples

Load Config from YAML

from evoagentx.config import Config

config = Config.from_yaml("workflow_config.yaml")
# config.llm_config is validated and ready for use

Create a Message

from evoagentx.core.message import Message, MessageType

msg = Message(
    content="Analysis complete",
    agent="AnalystAgent",
    action="analyze",
    msg_type=MessageType.RESPONSE,
)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment