Skip to main content
Components that implement the ReACT (Reason + Act) agentic pattern. Provides ReactInitiator, which primes the model with a goal and a tool list, and ReactThought, which signals a thinking step. Also exports the MELLEA_FINALIZER_TOOL sentinel string used to signal loop termination. These components are consumed by mellea.stdlib.frameworks.react, which orchestrates the reasoning-acting cycle until the model invokes final_answer or the step budget is exhausted.

Classes

CLASS ReactInitiator

ReactInitiator is used at the start of the ReACT loop to prime the model. Args:
  • goal: The objective of the react loop.
  • tools: Tools available to the agent. None is treated as an empty list.
Attributes:
  • goal: The objective of the react loop wrapped as a content block.
  • tools: The tools made available to the react agent.
Methods:

FUNC parts

parts(self) -> list[Component | CBlock]
Return the constituent parts of this component. Returns:
  • list[Component | CBlock]: A list containing the goal content block.

FUNC format_for_llm

format_for_llm(self) -> TemplateRepresentation
Formats the Component into a TemplateRepresentation or string. Returns: a TemplateRepresentation whose tools always includes a finalizer tool.

CLASS ReactThought

ReactThought signals that a thinking step should be done.
Methods:

FUNC parts

parts(self) -> list[Component | CBlock]
Return the constituent parts of this component. ReactThought has no sub-components; it solely triggers a thinking step. Returns:
  • list[Component | CBlock]: Always an empty list.

FUNC format_for_llm

format_for_llm(self) -> TemplateRepresentation
Formats the Component into a TemplateRepresentation or string. Returns: a TemplateRepresentation whose tools always includes a finalizer tool.