Skip to content

Commit b10d9f3

Browse files
pghazanfariParham Ghazanfari
authored andcommitted
fix: Moved tool_spec retrieval to after the before model invocation callback (strands-agents#786)
Co-authored-by: Parham Ghazanfari <parhamghazanfari@gmail.com>
1 parent 8ca77ee commit b10d9f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/strands/event_loop/event_loop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ async def event_loop_cycle(agent: "Agent", invocation_state: dict[str, Any]) ->
132132
model_id=model_id,
133133
)
134134
with trace_api.use_span(model_invoke_span):
135-
tool_specs = agent.tool_registry.get_all_tool_specs()
136-
137135
agent.hooks.invoke_callbacks(
138136
BeforeModelInvocationEvent(
139137
agent=agent,
140138
)
141139
)
142140

141+
tool_specs = agent.tool_registry.get_all_tool_specs()
142+
143143
try:
144144
async for event in stream_messages(agent.model, agent.system_prompt, agent.messages, tool_specs):
145145
if not isinstance(event, ModelStopReason):

0 commit comments

Comments
 (0)