Skip to main content
CRMPipelineAction is the Pydantic model serialized as JSON and sent in the body of every POST /step request. It defines the complete action space available to the agent — from inspecting raw data and applying column-level transformations, to merging DataFrames, executing SQL, and finally submitting the cleaned pipeline for grading. Every field is declared on the model; fields irrelevant to the current action_type must be omitted or set to null — the server strips None values automatically when using model_dump_json(exclude_none=True).

Base Class

CRMPipelineAction extends openenv.core.env_server.Action, which itself extends Pydantic’s BaseModel. If the openenv package is not installed, the server falls back to a plain BaseModel stub, so the serialization contract is identical in both environments.

Type Definition

The following TypeScript-style interface gives you the full field surface at a glance:

Fields

PipelineActionType
required
The type of operation to perform. This is the only required field and acts as the discriminator that determines which other fields the server expects. Must be one of the eight PipelineActionType enum values. See the Enums reference for the complete list.
string
The primary DataFrame name to operate on. Must exactly match one of the strings in available_sources returned by the latest observation. Used by VIEW_SOURCE, PROFILE_SOURCE, STANDARDIZE_COLUMN, HANDLE_MISSING, DEDUPLICATE, and as the first join partner in MERGE_SOURCES.
string
The secondary DataFrame name for MERGE_SOURCES. Must also exist in available_sources. The two sources are merged on join_key using an outer join, and the result is written to output_table.
string
The column name within source to apply a column-level operation to. Required for STANDARDIZE_COLUMN and HANDLE_MISSING. Must match an actual column in the target DataFrame — the server raises a ValueError (surfaced as "Error: ..." in last_action_feedback) if the column does not exist.
StandardizationStrategy
The transformation strategy for STANDARDIZE_COLUMN. Required when action_type is STANDARDIZE_COLUMN. Ignored for all other action types. See StandardizationStrategy for value semantics.
MissingStrategy
The null-handling strategy for HANDLE_MISSING. Required when action_type is HANDLE_MISSING. See MissingStrategy for value semantics.
DeduplicationStrategy
The deduplication heuristic for DEDUPLICATE. Required when action_type is DEDUPLICATE. See DeduplicationStrategy for matching logic.
string
The literal replacement string used when missing_strategy is FILL_VALUE. Ignored for all other missing strategies. Provide an empty string "" to fill nulls with blanks rather than a visible placeholder — this is the correct approach for the phone and signup_date columns in Task 1 when values are unrecoverable.
string
The column name to join on for MERGE_SOURCES. The column must exist in both source and source2. The server normalizes the key values (.lower().strip()) before merging to handle case and whitespace inconsistencies between sources.
If join_key is absent from either DataFrame, the merge fails immediately and last_action_feedback returns "Merge failed: key '<key>' missing from one of the sources." with a -0.05 reward penalty.
ConflictRule
The conflict resolution strategy for overlapping non-key columns during MERGE_SOURCES. Optional — defaults to COALESCE if omitted. See ConflictRule.
For Task 3, the observation’s conflict_rules field tells you the per-column resolution policy (e.g., "email": "prefer_salesforce"). Map those strings to the corresponding ConflictRule values when building separate per-column merge actions.
string
The name of the DataFrame to submit as the pipeline’s final output for SUBMIT_PIPELINE. Must exist in available_sources. The server captures self._sources[final_source] and passes it to the grader, which compares it against the hidden ground-truth snapshot.
Submission is blocked if step_count < 3. Attempting early submission returns a -0.15 reward penalty and done=false. You must perform at least three cleaning actions (e.g., PROFILE_SOURCE + STANDARDIZE_COLUMN + HANDLE_MISSING) first.
string
The raw SQL SELECT query string for EXECUTE_SQL. The server loads every DataFrame in available_sources into an in-memory SQLite database using the source name as the table name, executes your query, and writes the result to output_table.
Only SELECT queries are permitted. DROP, DELETE, UPDATE, INSERT, ALTER, CREATE, and TRUNCATE are blocked and return a -0.1 reward penalty. Queries that do not begin with SELECT are rejected outright.
string
The name under which the result DataFrame is registered in available_sources after EXECUTE_SQL or MERGE_SOURCES. Once written, you can reference output_table in subsequent actions as a normal source name. If omitted for EXECUTE_SQL, the result is saved as "sql_output".

Required Fields Per Action Type

The following table summarizes exactly which fields are required and which are optional for each action_type. Sending extra fields is harmless — they are silently ignored.
fallback_value is only meaningful when missing_strategy is FILL_VALUE. For FILL_MEAN and FILL_MODE it is ignored. For DROP_ROW it is also ignored.

Usage Examples


JSON Serialization

When sending actions to POST /step, use model_dump_json(exclude_none=True) to strip all None fields and produce a minimal, clean payload. This matches the server’s expected format and avoids validation noise from null fields irrelevant to the current action_type.
The serialized payload for the example above:
Because all five enum types inherit from str, their values are already plain strings in the JSON output — no extra conversion is required.
The CRMDataPipelineEnvClient._step_payload() method in client.py calls model_dump_json(exclude_none=True) automatically, so if you use the provided client you never need to serialize manually.