Core Components and Structured I/O
Use this sub-skill when a task needs AdalFlow's service-free building blocks:
Component,DataComponent,Sequential, nested component/parameter registration, state dictionaries, and lifecycle methods.DataClass,required_field, JSON/YAML/schema/signature helpers, and nested dataclass serialization.DataClassParser, string parsers, output parser selection, and JinjaPromptrendering.- Small deterministic task-pipeline prototypes that do not call a live provider.
Do not use this sub-skill for live model calls, provider clients, or Generator internals; route those to model-client-and-generator-workflows. Route tool/agent/streaming work to agents-tools-and-streaming, and trainer/optimizer work to evaluation-and-optimization.
Load order
- Read core API reference for verified signatures, lifecycle rules, object relationships, and routing boundaries.
- Read structured I/O and parsers for copyable DataClass, parser, prompt, and mini-pipeline recipes.
- If behavior is surprising, read troubleshooting before changing code.
- For a deterministic environment check, run structured IO smoke or core component smoke. These scripts do not use provider credentials, network, datasets, or model calls.
Operating rules
- Always call
super().__init__()before assigning childComponentorParameterattributes in a customComponent. - Implement
callfor synchronous inference. Implementacallonly when the component genuinely has async work. Implementforwardorbicallonly for training-mode behavior. - In
train()mode,Component.__call__expects aParameteroutput; ineval()mode, it rejectsParameteroutputs.DataComponentis intentionally non-trainable and dispatches directly tocall. - Decorate every
DataClasssubclass with@dataclass; usefield(metadata={"desc": ...})ormetadata={"description": ...}to make prompt schemas useful. - Prefer
default_factoryfor mutable fields, and userequired_field()when a required field must appear after optional fields. - For structured model outputs, generate prompt instructions with
DataClassParser.get_output_format_str()and parse service-free strings with the same parser before connecting aGeneratorelsewhere.


