aw.preparing
Preparation agent for transforming data to meet target requirements.
Implements ReAct pattern with functional validation (try-the-purpose approach).
- class aw.preparing.PreparationAgent(config: StepConfig = None, target: str = 'generic', target_validator: Callable = None)[source]
Agent that prepares data to meet target requirements.
Uses ReAct loop with functional validation: 1. Thought: Analyze current data state vs. requirements 2. Action: Generate transformation code 3. Observe: Execute code and capture result 4. Validate: Try to use data for its purpose (e.g., visualization) 5. Repeat or finish
Example
>>> agent = PreparationAgent(target='cosmo-ready') >>> context = Context({'loading': {'df': df}}) >>> prepared_df, metadata = agent.execute(df, context)
- aw.preparing.create_preparation_agent(target: str = 'generic', validator: Callable = None, llm: str = None, max_retries: int = 3) PreparationAgent[source]
Factory function to create a preparation agent.
- Parameters:
target – Target format/purpose
validator – Custom validator function
llm – LLM model name or callable
max_retries – Maximum retry attempts
- Returns:
Configured PreparationAgent
Example
>>> agent = create_preparation_agent( ... target='cosmo-ready', ... validator=cosmo_validator, ... max_retries=5 ... )