@@ -848,10 +848,10 @@ def _setup_library(self):
848848 def get_subgraph (self , self_critic = False , test_time_scale_round = 0 ) -> "StateGraph" :
849849 """Return this agent's workflow as an uncompiled StateGraph.
850850
851- Loads all built-in resources, applies AgentSpec filters, generates the
852- system prompt, and wires up the graph topology — but does NOT compile.
853- The returned graph can be embedded in a parent LangGraph workflow for
854- multi-agent composition .
851+ Generates the system prompt from the current ResourceManager state and
852+ wires up the graph topology — but does NOT compile. Safe to call multiple
853+ times; each call returns a fresh graph reflecting current resource state.
854+ Resources must already be loaded (``configure()`` handles this) .
855855
856856 Args:
857857 self_critic: Whether to enable self-critic mode.
@@ -863,23 +863,7 @@ def get_subgraph(self, self_critic=False, test_time_scale_round=0) -> "StateGrap
863863 # Store self_critic for later use
864864 self .self_critic = self_critic
865865
866- # Load all built-in resources into resource manager
867- self .resource_manager .load_builtin_tools () # Load tools from tool_description
868- self ._setup_data_lake () # Load data lake items from env_desc
869- self ._setup_library () # Load libraries from env_desc
870-
871- # Auto-load skills from configured directory
872- if self .skills_directory :
873- self .load_skills (self .skills_directory )
874-
875- # Apply AgentSpec resource filters (must happen after resources are loaded)
876- if self .spec is not None :
877- if self .spec .tool_names is not None :
878- self .resource_manager .select_tools_by_names (self .spec .tool_names )
879- if self .spec .skill_names is not None :
880- self .resource_manager .select_skills_by_names (self .spec .skill_names )
881-
882- # Generate the system prompt (will be built automatically from ResourceManager)
866+ # Generate the system prompt from current ResourceManager state
883867 self .system_prompt = self ._generate_system_prompt (
884868 self_critic = self_critic ,
885869 is_retrieval = False ,
@@ -960,15 +944,32 @@ def _execute_self_critic(state: AgentState) -> AgentState:
960944 return workflow
961945
962946 def configure (self , self_critic = False , test_time_scale_round = 0 ):
963- """Configure the agent: build and compile the LangGraph workflow.
947+ """Load resources and compile the LangGraph workflow.
964948
965- Delegates graph construction to ``get_subgraph()``, then compiles with
966- the configured checkpointer. Called once during ``__init__``.
949+ Loads all built-in resources, applies AgentSpec filters, then delegates
950+ graph construction to ``get_subgraph()`` and compiles the result.
951+ Called once during ``__init__``.
967952
968953 Args:
969954 self_critic: Whether to enable self-critic mode.
970955 test_time_scale_round: Number of rounds for test time scaling.
971956 """
957+ # Load all built-in resources into resource manager
958+ self .resource_manager .load_builtin_tools ()
959+ self ._setup_data_lake ()
960+ self ._setup_library ()
961+
962+ # Auto-load skills from configured directory
963+ if self .skills_directory :
964+ self .load_skills (self .skills_directory )
965+
966+ # Apply AgentSpec resource filters (must happen after resources are loaded)
967+ if self .spec is not None :
968+ if self .spec .tool_names is not None :
969+ self .resource_manager .select_tools_by_names (self .spec .tool_names )
970+ if self .spec .skill_names is not None :
971+ self .resource_manager .select_skills_by_names (self .spec .skill_names )
972+
972973 workflow = self .get_subgraph (self_critic , test_time_scale_round )
973974 self .checkpointer = self ._create_checkpointer ()
974975 self .app = workflow .compile (checkpointer = self .checkpointer )
0 commit comments