Implementation:ANative Lab EvoAgentX OptimizationDecorators
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Optimization, Decorators |
| Last Updated | 2026-10-21 00:00 GMT |
Overview
Concrete decorators for registering optimization entry points and tunable parameters declaratively.
Description
The `evoagentx/optimizers/engine/decorators.py` module provides:
- EntryPoint — A class decorator registering the main program function for optimization. Marks a class as an optimization target.
- OptimizeParam — A parameter decorator that registers function parameters as tunable optimization fields with optional `on_execute` callbacks. Supports automatic deduplication and selective parameter registration. Enables declarative optimization — users decorate functions with `@OptimizeParam` to expose tunable parameters to optimizers without manual registry setup.
Usage
- Declarative optimization: Use `@OptimizeParam` to expose function parameters as tunable fields.
- Entry point registration: Use `@EntryPoint` to mark a class as the main optimization target.
Code Reference
Source Location
- Repository: EvoAgentX
- File: evoagentx/optimizers/engine/decorators.py
- Lines: 1-98
Signature
class EntryPoint:
# Class decorator registering the main program function
...
class OptimizeParam:
# Parameter decorator for tunable optimization fields
def __init__(self, default=None, on_execute: Callable = None, ...)
def __call__(self, func):
# Registers parameter in the optimization registry
...
Import
from evoagentx.optimizers.engine.decorators import EntryPoint, OptimizeParam
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| default | Any | No | Default value for the parameter |
| on_execute | Callable | No │ Callback when parameter is executed |
Outputs
| Name | Type | Description |
|---|---|---|
| decorated function | Callable | Function with registered optimization parameters |
Usage Examples
Register Optimizable Parameters
from evoagentx.optimizers.engine.decorators import EntryPoint, OptimizeParam
@EntryPoint
class MyWorkflow:
@OptimizeParam(default="You are a helpful assistant")
def prompt(self, prompt: str) -> str:
return prompt
@OptimizeParam(default=0.7)
def temperature(self, temperature: float) -> float:
return temperature
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment