langgoap.format_goap_result

langgoap.format_goap_result#

format_goap_result(result)[source]#

Format a GoapState result dict as a compact human-readable report.

This text is what a calling agent receives as a tool result, so it must stay small regardless of world-state size (issue #57): history entries render as one line each (never their state snapshots), failed steps show their error, and world-state values are clipped to _VALUE_CLIP characters with at most _KEY_CAP keys.

Parameters:

result (dict[str, Any]) – The dict returned by GoapGraph.invoke / ainvoke (or invoke_nl / ainvoke_nl), or the JSON-native state of a compiled graph.

Returns:

A multi-line string summarising the outcome, executed actions, and final world state.

Return type:

str