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:
parent
8714a15e1c
commit
f9e0c008d9
3 changed files with 11 additions and 4 deletions
|
|
@ -169,7 +169,12 @@ pub async fn call_api_with_tools(
|
|||
None => thought::ToolOutput::error(format!("Unknown tool: {}", call.function.name)),
|
||||
};
|
||||
|
||||
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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,9 +336,11 @@ fn run_one_agent_inner(
|
|||
.map(|s| s.phase.clone()).collect();
|
||||
let step_phases_for_bail = step_phases.clone();
|
||||
|
||||
if std::env::var("POC_AGENT_VERBOSE").is_ok() {
|
||||
for (i, s) in agent_batch.steps.iter().enumerate() {
|
||||
log(&format!("=== PROMPT {}/{} ({}) ===\n\n{}", i + 1, n_steps, s.phase, s.prompt));
|
||||
}
|
||||
}
|
||||
log("\n=== CALLING LLM ===");
|
||||
|
||||
// Bail check: if the agent defines a bail script, run it between steps.
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ impl State {
|
|||
let dream_hours = hours_since_last_dream();
|
||||
let mut msg = format!(
|
||||
"This is your autonomous time (Kent AFK {elapsed_min}m). \
|
||||
Think wonderful thoughts and follow what interests you <3");
|
||||
Keep doing what you're doing, or find something new to do");
|
||||
if dream_hours >= DREAM_INTERVAL_HOURS {
|
||||
msg.push_str(&format!(
|
||||
" You haven't dreamed in {dream_hours} hours — \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue