Compact agent logs by default, verbose with POC_AGENT_VERBOSE

Skip full prompt logging and truncate tool results in normal mode.
Logs now show: header, tool calls with one-line results, response
text. Set POC_AGENT_VERBOSE=1 for full prompts and results.

Makes agent logs scannable at a glance instead of walls of text.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-01 10:28:15 -04:00
parent 8714a15e1c
commit f9e0c008d9
3 changed files with 11 additions and 4 deletions

View file

@ -169,7 +169,12 @@ pub async fn call_api_with_tools(
None => thought::ToolOutput::error(format!("Unknown tool: {}", call.function.name)),
};
log(&format!("TOOL RESULT ({} chars):\n{}", output.text.len(), output.text));
if std::env::var("POC_AGENT_VERBOSE").is_ok() {
log(&format!("TOOL RESULT ({} chars):\n{}", output.text.len(), output.text));
} else {
let preview: String = output.text.lines().next().unwrap_or("").chars().take(100).collect();
log(&format!("Result: {}", preview));
}
messages.push(Message::tool_result(&call.id, &output.text));
}