Build Context For Task • AI Agent SDK
build_context_for_task: Merges relevant short-term, long-term, entity, user memories
build_context_for_task
Method
</div>
Merges relevant short-term, long-term, entity, user memories into a single text block with deduplication and clean formatting.
Signature
def build_context_for_task(task_descr: str, user_id: Optional[str], additional: str, max_items: int, include_in_output: Optional[bool]) -> strParameters
ParamField
strNo description available.
ParamField
Optional[str]No description available.
ParamField
strNo description available.
ParamField
intNo description available.
ParamField
Optional[bool]If None, memory content is included (the primary purpose of this method is to feed retrieved memory into the prompt). If True, memory content is always included. If False, memory content is never included (only logged for debugging).
Returns
ResponseField
strThe result of the operation.
Uses
c.isspacecontent.rfindformat_contentnormalize_contentseen_contents.addlogger.debugsearch_short_termsearch_long_termsearch_entitysearch_user_memory
Used By
Source
View on GitHubpraisonaiagents/memory/memory.py at line 1969