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 CustomizeAgent

From Leeroopedia
Knowledge Sources
Domains Agents, NLP
Last Updated 2026-10-21 00:00 GMT

Overview

Concrete tool for declarative creation of LLM-powered agents with defined inputs, outputs, prompt templates, parse modes, and optional tool-calling capabilities.

Description

The CustomizeAgent class is the primary user-facing agent in EvoAgentX. It extends Agent and provides a declarative API for creating specialized LLM agents without writing custom action classes. Upon construction, it dynamically generates a CustomizeAction with pydantic-based ActionInput / ActionOutput models from the provided input/output specifications. It supports five parse modes (`str`, `json`, `xml`, `title`, `custom`), tool-calling loops via `Toolkit` instances, and serialization via `save_module` / `from_dict`.

Usage

  • Single-agent tasks: Create a one-step agent for summarization, classification, or extraction with structured I/O.
  • HITL interception: Used as the base for `HITLInterceptorAgent` to intercept target agents.
  • Multi-agent debate: Serve as debater and judge agents in `MultiAgentDebateActionGraph`.
  • Workflow nodes: Instantiated per task node by `AgentManager.add_agents_from_workflow`.
  • Serialization: Save agent configs to JSON via `save_module` and reload via `from_dict` or `from_file`.

Code Reference

Source Location

  • Repository: EvoAgentX
  • File: evoagentx/agents/customize_agent.py (L36-755)

Signature

class CustomizeAgent(Agent):
    def __init__(
        self,
        name: str,
        description: str,
        prompt: Optional[str] = None,
        prompt_template: Optional[PromptTemplate] = None,
        llm_config: Optional[LLMConfig] = None,
        inputs: Optional[List[Union[dict, Parameter]]] = None,
        outputs: Optional[List[Union[dict, Parameter]]] = None,
        system_prompt: Optional[str] = None,
        output_parser: Optional[Type[ActionOutput]] = None,
        parse_mode: Optional[str] = "title",
        parse_func: Optional[Callable] = None,
        title_format: Optional[str] = None,
        tools: Optional[List[Union[Toolkit, Tool]]] = None,
        custom_output_format: Optional[str] = None,
        max_steps: int = 20,
        max_tool_call_concurrency: int = 5,
        **kwargs
    )

    def __call__(self, inputs: dict = None, return_msg_type: MessageType = MessageType.UNKNOWN, **kwargs) -> Message
    def save_module(self, path: str, ignore: List[str] = [], **kwargs) -> str
    def get_config(self) -> dict
    @classmethod
    def from_dict(cls, data: Dict[str, Any], llm_config: Optional[LLMConfig] = None, tools: Optional[List[Union[Toolkit, Tool]]] = None, **kwargs) -> 'CustomizeAgent'

Import

from evoagentx.agents.customize_agent import CustomizeAgent

I/O Contract

Inputs

Name Type Required Description
name str Yes Agent name (must be unique within AgentManager)
description str Yes Agent purpose description
prompt str One of prompt/prompt_template Raw prompt with `{input_name}` placeholders
prompt_template PromptTemplate One of prompt/prompt_template Structured prompt template (used over `prompt` if both given)
llm_config LLMConfig No LLM configuration for generation
inputs Parameter] No Input parameter specs: `{"name", "type", "description", "required", "json_schema"}`
outputs Parameter] No Output parameter specs (same shape as inputs)
parse_mode str No One of: "str", "json", "xml", "title", "custom" (default: "title")
parse_func Callable Required for "custom" Custom parser accepting `content: str`, returning `dict`
tools Tool] No Tools for the tool-calling loop
max_steps int No Max tool-calling iterations (default: 20)
max_tool_call_concurrency int No Max parallel tool calls (default: 5)

Outputs

Name Type Description
__call__ returns Message Message whose `.content` is parsed ActionOutput (structured data per parse_mode)
save_module returns str Path to saved JSON config file

Usage Examples

Basic Agent with Title Parsing

from evoagentx.agents.customize_agent import CustomizeAgent
from evoagentx.models.model_configs import OpenAILLMConfig

agent = CustomizeAgent(
    name="Translator",
    description="Translates English text to French",
    prompt="Translate the following English text to French:\n{text}",
    llm_config=OpenAILLMConfig(model="gpt-4o-mini", openai_key="sk-..."),
    inputs=[{"name": "text", "type": "str", "description": "English text"}],
    outputs=[{"name": "translation", "type": "str", "description": "French translation"}],
    parse_mode="title",
)

result = agent(inputs={"text": "Hello, how are you?"})
print(result.content.get_structured_data()["translation"])

Agent with JSON Output and Tools

from evoagentx.agents.customize_agent import CustomizeAgent
from evoagentx.tools.file_tool import FileToolkit
from evoagentx.models.model_configs import OpenAILLMConfig

agent = CustomizeAgent(
    name="DataAnalyst",
    description="Analyzes data files and produces structured reports",
    prompt="Analyze the data in {file_path} and provide a summary.",
    llm_config=OpenAILLMConfig(model="gpt-4o-mini", openai_key="sk-..."),
    inputs=[{"name": "file_path", "type": "str", "description": "Path to data file"}],
    outputs=[
        {"name": "summary", "type": "str", "description": "Data summary"},
        {"name": "key_findings", "type": "array", "description": "List of key findings"},
    ],
    parse_mode="json",
    tools=[FileToolkit()],
    max_steps=10,
)

result = agent(inputs={"file_path": "data.csv"})
data = result.content.get_structured_data()
print(data["summary"])
print(data["key_findings"])

Save and Reload Agent

# Save agent config
agent.save_module("agents/translator.json")

# Reload from file
from evoagentx.agents.customize_agent import CustomizeAgent
from evoagentx.models.model_configs import OpenAILLMConfig

llm_config = OpenAILLMConfig(model="gpt-4o-mini", openai_key="sk-...")
agent = CustomizeAgent.from_file(path="agents/translator.json", llm_config=llm_config)

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

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