jeevesagent.architecture.react
==============================

.. py:module:: jeevesagent.architecture.react

.. autoapi-nested-parse::

   ReAct: the canonical observe-think-act loop.

   Each turn:

   1. Check budget; emit warning / exceeded.
   2. Call the model with current messages + available tools.
   3. Stream tokens, accumulate text + tool calls + usage.
   4. If no tool calls, the model is done; break.
   5. Otherwise, dispatch all tool calls in parallel through hooks
      → permissions → tool host. Append results to messages.
   6. Loop.

   This is the v0.1.x default behaviour, lifted verbatim out of
   ``Agent._loop`` and behind the :class:`Architecture` protocol.
   Behaviour is identical; the refactor only changes the shape.



Classes
-------

.. autoapisummary::

   jeevesagent.architecture.react.ReAct


Module Contents
---------------

.. py:class:: ReAct(*, max_turns: int | None = None)

   Observe-think-act in a tight loop.

   The default architecture for every :class:`Agent`. Other
   architectures wrap or replace this strategy; see ``Subagent.md``.

   ``max_turns`` overrides ``Dependencies.max_turns`` for this
   architecture only — useful when wrapping ReAct inside another
   architecture that sets its own per-leaf cap (Reflexion,
   Plan-and-Execute, etc.). ``None`` means "use whatever the Agent
   was configured with".


   .. py:method:: declared_workers() -> dict[str, jeevesagent.agent.api.Agent]


   .. py:method:: run(session: jeevesagent.architecture.base.AgentSession, deps: jeevesagent.architecture.base.Dependencies, prompt: str) -> collections.abc.AsyncIterator[jeevesagent.core.types.Event]
      :async:



   .. py:attribute:: name
      :value: 'react'



