Skip to content

Commit 59410d7

Browse files
authored
Add tool_schemas to agent inputs (#191)
1 parent a746d37 commit 59410d7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

dreadnode/agent/agent.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,10 @@ async def _stream_traced(
646646
"user_input": user_input,
647647
"messages": messages,
648648
"instructions": self.instructions,
649-
"tools": [t.name for t in self.all_tools],
650649
"hooks": [get_callable_name(hook, short=True) for hook in self.hooks],
651650
"stop_conditions": [s.name for s in self.stop_conditions],
651+
"tools": [t.name for t in self.all_tools],
652+
"tool_schemas": [t.api_definition for t in self.all_tools],
652653
}
653654
)
654655
trace_params.update(
@@ -669,13 +670,17 @@ async def _stream_traced(
669670
yield event
670671
finally:
671672
if last_event is not None:
672-
log_outputs(messages=last_event.messages, token_usage=last_event.total_usage)
673+
# TODO(nick): Don't love having to inject here, but it's the most accurate in
674+
# in terms of ensuring we don't miss the system component of messages
675+
final_messages = inject_system_content(last_event.messages, self.get_prompt())
676+
log_outputs(messages=final_messages, token_usage=last_event.total_usage)
673677

674678
if isinstance(last_event, AgentEnd):
675679
log_outputs(
676680
to="both",
677681
steps_taken=min(0, last_event.result.steps - 1),
678682
reason=last_event.stop_reason,
683+
failed=last_event.result.failed,
679684
)
680685
if last_event.result.error:
681686
log_output("error", last_event.result.error, to="both")

0 commit comments

Comments
 (0)