Skip to content

[Feature]: Improve logging infrastructure and add LLM prompt logging #53

Description

@deepakn97

Feature Summary

Improve the PAS logging infrastructure to be more useful for debugging and development. This includes:

  1. Adding LLM prompt logging to capture actual context sent to agents
  2. Reducing noise in debug-level logs
  3. Adding more informative log messages at appropriate levels

Motivation and Use Case

Current problems:

  • Debug logs are very noisy and don't relay useful information for debugging agent behavior
  • No way to inspect actual LLM prompts during scenario execution - existing logs (agent.log, pas.log) show activity but not prompt content
  • Hard to trace what context an agent sees when making decisions
  • Difficult to verify fixes like duplicate dynamic log filtering (Issue [Bug]: Duplicate dynamic logs in agent history polluting LLM context #33)

Use cases:

  • Debugging agent decision-making by inspecting actual prompts
  • Verifying context management (e.g., dynamic log filtering) is working correctly
  • Reducing log noise to focus on meaningful events
  • Research analysis of agent context and behavior

Proposed Solution

1. LLM Prompt Logging

Integration point: Override append_to_world_logs() in StateAwareEnvironmentWrapper (pas/environment.py).

The log_callback passed to agents is set to env.append_to_world_logs in scenario_runner.py. When the base agent's step() function creates an LLMInputLog, we can intercept it and write prompt content to a dedicated prompts log file.

Key files:

  • pas/environment.py:StateAwareEnvironmentWrapper - add override method
  • pas/scenario_runner.py:202,214 - where log_callback is set

2. Log Level Improvements

  • Review current DEBUG statements and promote informative ones to INFO
  • Demote noisy DEBUG statements to TRACE level (or remove)
  • Add structured logging for key events (agent turns, proposals, tool calls)

3. Log Format Improvements

  • Consider structured logging format for easier parsing
  • Add agent ID and turn number context to log messages
  • Separate prompt logs into dedicated file

Alternatives Considered

  1. Keep current logging as-is - Not viable as current logs are hard to use for debugging
  2. External logging service - Overkill for a research framework

Component

Core

Priority

Medium - Nice to have

Additional Context

This feature was identified while manually testing Issue #33 (duplicate dynamic logs fix). Without prompt logging, we cannot verify the fix is working in production runs. The noisy debug logs also made it difficult to find relevant information.

Metadata

Metadata

Assignees

Labels

agentsAll files in `pas/agents/`coreAll Python source files in the root `pas` directoryenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions