langgoap.ReflexionTracer#
- class ReflexionTracer(llm=None, history=None, max_reflections=5)[source]#
Tracer that captures failures and generates verbal reflections.
On
on_action_completewith a failure, generates aReflection. Onon_plan_start, logs accumulated reflections for the current planning session.- Parameters:
llm (Any) – Optional LangChain
BaseChatModel. WhenNone, reflections are template-based (no LLM call).history (Any) – Optional
StoreExecutionHistoryfor persisting reflections. WhenNone, reflections are stored in-memory only.max_reflections (int) – Maximum number of reflections to keep (FIFO).
- __init__(llm=None, history=None, max_reflections=5)[source]#
- Parameters:
llm (Any)
history (Any)
max_reflections (int)
- Return type:
None
Methods
__init__([llm, history, max_reflections])aload()Eagerly load persisted reflections from the backing store (async).
aon_action_complete(result)aon_action_retry(action, attempt, exception, ...)aon_action_start(action, state)aon_goal_achieved(final_state)aon_plan_complete(plan, duration_ms)aon_plan_failed(reason, duration_ms)aon_plan_start(goal, state, strategy_name)aon_replan(reason, new_plan[, duration_ms])aon_search_complete(nodes_explored, ...)aon_search_dead_end(reason, detail)aon_search_expand(node_id, state, g, h, f, ...)aon_sensor_complete(sensor_name, updates)aon_strategy_chosen(strategy_name)load()Eagerly load persisted reflections from the backing store (sync).
on_action_complete(result)on_action_retry(action, attempt, exception, ...)on_action_start(action, state)on_goal_achieved(final_state)on_plan_complete(plan, duration_ms)on_plan_failed(reason, duration_ms)on_plan_start(goal, state, strategy_name)on_replan(reason, new_plan[, duration_ms])on_search_complete(nodes_explored, ...)on_search_dead_end(reason, detail)on_search_expand(node_id, state, g, h, f, ...)on_sensor_complete(sensor_name, updates)on_strategy_chosen(strategy_name)Attributes
reflectionsRead-only view of accumulated reflections.