Skip to content

API Reference parrot.tools.working_memory.models

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.tools.working_memory.models

View source

Enums and Pydantic input models for WorkingMemoryToolkit DSL.

Class AggFunc

Aggregation function options for AGGREGATE, PIVOT, WINDOW, and SUMMARIZE operations.

Class ComputeAndStoreInput

Input for executing a declarative operation and storing the result.

Fields:

Field Type Default Description
spec OperationSpecInput The operation specification (DSL)
description str '' Description of this computation
turn_id Optional[str] None Conversation turn identifier

Class DropStoredInput

Input for removing a stored DataFrame.

Fields:

Field Type Default Description
key str Key of the entry to remove

Class EnabledGetResultInput

Input for wm_get_result when task memory is ENABLED (FEAT-538).

A separate model, deliberately. The spec requires the disabled path's schema to stay byte-identical, so the raw-read ceiling and tabular paging cannot be added to :class:GetResultInput — the enabled schema is chosen at tool-generation time instead. That is what resolves the conflict between "cap raw reads" and "disabled behaviour unchanged".

The opt-in cap is an intentional behaviour change, documented as such.

Fields:

Field Type Default Description
key str Key of the entry to retrieve
max_length int 500 Max chars in text/content preview
include_raw bool False If True, include the raw data object in the response
max_rehydrate_bytes Optional[int] None Byte ceiling for the raw payload. The configured value is a HARD ceiling: a caller may lower it but never raise it. 0 means never rehydrate.
offset int 0 Row offset for a tabular page
limit Optional[int] None Row count for a tabular page. Defaults to the configured page size.

Class EntryType

Discriminator for catalog entry types.

Used by GenericEntry to describe the kind of data stored. DATAFRAME is reserved for backward-compatible CatalogEntry summaries.

Class FilterSpec

A single filter condition.

Fields:

Field Type Default Description
column str Column name to filter on
op str Filter operator: ==, !=, >, >=, <, <=, in, not_in, contains, startswith, is_null, not_null, between
value Any None Value to compare against

Class GetResultInput

Input for retrieving a stored generic result.

Fields:

Field Type Default Description
key str Key of the entry to retrieve
max_length int 500 Max chars in text/content preview
include_raw bool False If True, include the raw data object in the response

Class GetStoredInput

Input for retrieving a summary of a stored DataFrame.

Fields:

Field Type Default Description
key str Key of the entry to retrieve
max_rows Optional[int] None Max rows in preview
max_cols Optional[int] None Max columns in preview

Class ImportFromToolInput

Input for importing a DataFrame from another tool's namespace.

Fields:

Field Type Default Description
tool_name str Name of the source tool (e.g., PythonPandasTool)
variable_name str Variable name in the tool's locals
store_as str Key to store under in working memory
description str '' Description of the imported data
turn_id Optional[str] None Conversation turn identifier

Class JoinHow

Join type options for JOIN and MERGE operations.

Class JoinOnSpec

Join key specification.

Fields:

Field Type Default Description
left str Column name in left DataFrame
right str Column name in right DataFrame

Class ListStoredInput

Input for listing all stored entries.

Fields:

Field Type Default Description
turn_id Optional[str] None Filter by conversation turn

Class ListToolDataFramesInput

Input for listing DataFrames available in other tools.

Fields:

Field Type Default Description
tool_name Optional[str] None Filter by tool name

Class MergeStoredInput

Input for merging multiple stored DataFrames.

Fields:

Field Type Default Description
keys list[str] Keys of DataFrames to merge
store_as str Key for the merged result
merge_on Optional[str] None Common column for join
merge_how str 'outer' Merge type: inner, left, right, outer
turn_id Optional[str] None Conversation turn identifier

Class OperationSpecInput

Declarative operation specification — the DSL contract.

The agent sends this as JSON; Pydantic validates it before execution. No free-form code allowed.

Fields:

Field Type Default Description
op OperationType The operation to perform
source str Key of the source DataFrame in working memory
store_as str Key to store the result under
filters list[FilterSpec] Filter conditions to apply
group_by list[str] Columns to group by
agg_rules dict[str, AggFunc] Aggregation rules: {column: agg_function}
right_source Optional[str] None Key of right DataFrame for joins
join_on Optional[JoinOnSpec] None Join key mapping
join_how JoinHow JoinHow.INNER Join type
columns list[str] Columns to operate on
method str 'pearson' Correlation method: pearson, spearman, kendall
pivot_index Optional[str] None Pivot table index column
pivot_columns Optional[str] None Pivot table columns
pivot_values Optional[str] None Pivot table values column
pivot_aggfunc AggFunc AggFunc.MEAN Pivot aggregation function
rank_column Optional[str] None Column to rank or apply window on
rank_ascending bool True Rank in ascending order
window_size Optional[int] None Rolling window size
window_func Optional[AggFunc] None Window aggregation function
sort_by list[str] Columns to sort by
sort_ascending bool True Sort ascending
select_columns list[str] Columns to select
rename_map dict[str, str] Column rename mapping
fillna_value Any None Value to fill NAs with
fillna_method Optional[str] None Fill method: ffill or bfill

Class OperationType

Allowed deterministic operations the agent can request.

Class RecallInteractionInput

Input for recalling a Q&A interaction from AnswerMemory.

Fields:

Field Type Default Description
turn_id Optional[str] None Exact conversation turn identifier to recall
query Optional[str] None Substring to search across stored questions (case-insensitive). Returns the most recent match. Use when turn_id is unknown.
import_as Optional[str] None If provided, import the recalled interaction into working memory under this key as a GenericEntry (entry_type=json)

Class SaveInteractionInput

Input for saving a Q&A interaction to AnswerMemory.

Fields:

Field Type Default Description
turn_id str Conversation turn identifier
question str The user question
answer str The assistant answer

Class SearchStoredInput

Input for searching stored entries by key/description substring or type.

Fields:

Field Type Default Description
query str Case-insensitive substring to match against entry key or description
entry_type Optional[EntryType] None Filter results to a specific entry type (e.g. text, json, dataframe)

Class StoreInput

Input for storing a DataFrame directly.

Fields:

Field Type Default Description
key str Unique name for this entry in working memory
description str '' Human-readable description
turn_id Optional[str] None Conversation turn identifier

Class StoreResultInput

Input for storing a generic (non-DataFrame) result into working memory.

Fields:

Field Type Default Description
key str Unique name for this entry in working memory
data Any The value to store: text, number, dict/JSON, list, message, or bytes. Required.
data_type str 'auto' Type hint: text, json, message, binary, or auto (auto-detect from the data)
description str '' Human-readable description
metadata Optional[dict] None Optional arbitrary metadata dict to attach to this entry
turn_id Optional[str] None Conversation turn identifier

Class SummarizeStoredInput

Input for merging + aggregating stored DataFrames.

Fields:

Field Type Default Description
keys list[str] Keys of DataFrames to merge and summarize
store_as str Key for the summarized result
agg_rules dict[str, str] Aggregation rules: {"column": "agg_func"} where agg_func is sum|mean|median|min|max|count|std|var|first|last|nunique
group_by Optional[list[str]] None Group by columns
merge_on Optional[str] None Common column for merge step
turn_id Optional[str] None Conversation turn identifier

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally