langgoap.ActionResult#

class ActionResult(action_name, success, state_before=<factory>, state_after=<factory>, error=None, cost=None)[source]#

Result of executing a single GOAP action.

Parameters:
  • action_name (str)

  • success (bool)

  • state_before (dict[str, Any])

  • state_after (dict[str, Any])

  • error (str | None)

  • cost (float | None)

action_name#

Name of the action that was executed.

Type:

str

success#

Whether the action completed successfully.

Type:

bool

state_before#

World state before execution.

Type:

dict[str, Any]

state_after#

World state after execution.

Type:

dict[str, Any]

error#

Error message if the action failed.

Type:

str | None

cost#

The action’s cost evaluated on the full pre-state at execution time (None for failures and for records written before 0.2.0). Recorded by the executor so realised-cost accounting does not depend on the stored snapshots, which GoapGraph(history_state="delta") compacts (issue #74).

Type:

float | None

__init__(action_name, success, state_before=<factory>, state_after=<factory>, error=None, cost=None)#
Parameters:
  • action_name (str)

  • success (bool)

  • state_before (dict[str, Any])

  • state_after (dict[str, Any])

  • error (str | None)

  • cost (float | None)

Return type:

None

Methods

__init__(action_name, success[, ...])

from_dict(data)

Reconstruct from the dict produced by to_dict().

to_dict()

Serialise to the JSON-native form stored in execution_history.

Attributes