From 1986f367f08dc732011ba1df01416ce6bd9becc1 Mon Sep 17 00:00:00 2001 From: monoxgas Date: Sun, 28 Sep 2025 03:22:30 -0600 Subject: [PATCH] Add tool_schemas to agent inputs --- dreadnode/agent/agent.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dreadnode/agent/agent.py b/dreadnode/agent/agent.py index 256f529c..7a1e0359 100644 --- a/dreadnode/agent/agent.py +++ b/dreadnode/agent/agent.py @@ -646,9 +646,10 @@ async def _stream_traced( "user_input": user_input, "messages": messages, "instructions": self.instructions, - "tools": [t.name for t in self.all_tools], "hooks": [get_callable_name(hook, short=True) for hook in self.hooks], "stop_conditions": [s.name for s in self.stop_conditions], + "tools": [t.name for t in self.all_tools], + "tool_schemas": [t.api_definition for t in self.all_tools], } ) trace_params.update( @@ -669,13 +670,17 @@ async def _stream_traced( yield event finally: if last_event is not None: - log_outputs(messages=last_event.messages, token_usage=last_event.total_usage) + # TODO(nick): Don't love having to inject here, but it's the most accurate in + # in terms of ensuring we don't miss the system component of messages + final_messages = inject_system_content(last_event.messages, self.get_prompt()) + log_outputs(messages=final_messages, token_usage=last_event.total_usage) if isinstance(last_event, AgentEnd): log_outputs( to="both", steps_taken=min(0, last_event.result.steps - 1), reason=last_event.stop_reason, + failed=last_event.result.failed, ) if last_event.result.error: log_output("error", last_event.result.error, to="both")