Implementation:666ghj BettaFish forum reader get latest
| Knowledge Sources | |
|---|---|
| Domains | Multi_Agent_Systems, Inter_Agent_Communication |
| Last Updated | 2026-10-08 00:00 GMT |
Overview
Concrete utility module that provides functions for agents to read the latest HOST moderator speech from the shared forum log file.
Description
The forum_reader module provides two functions for agents to access forum moderator guidance:
- `get_latest_host_speech()`: Returns the most recent HOST speech from `forum.log`
- `get_all_host_speeches()`: Returns all HOST speeches from the log
These functions parse the forum log file, extract lines tagged with `[HOST]`, and return the speech content. They are called by `FirstSummaryNode` and `ReflectionSummaryNode` before generating summaries, allowing agents to incorporate moderator guidance into their research.
Usage
Import this module when agents need to read the latest forum moderator guidance. It is called automatically by the summary nodes.
Code Reference
Source Location
- Repository: BettaFish
- File: `utils/forum_reader.py:L11-90`
Signature
def get_latest_host_speech(log_dir: str = "logs") -> Optional[str]:
"""
Get the most recent HOST speech from forum.log.
Args:
log_dir: Directory containing forum.log (default: "logs")
Returns:
Latest HOST speech content, or None if not found
"""
def get_all_host_speeches(log_dir: str = "logs") -> List[str]:
"""
Get all HOST speeches from forum.log.
Returns:
List of HOST speech strings, ordered chronologically
"""
def format_host_speech_for_prompt(speech: str) -> str:
"""Format HOST speech for inclusion in LLM prompt."""
Import
from utils.forum_reader import get_latest_host_speech, get_all_host_speeches
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| log_dir | str | No | Directory containing forum.log (default: "logs") |
Outputs
| Name | Type | Description |
|---|---|---|
| speech | Optional[str] | Latest HOST speech content or None |
Usage Examples
Read Latest Host Speech
from utils.forum_reader import get_latest_host_speech
# Called by FirstSummaryNode before generating summary
host_speech = get_latest_host_speech()
if host_speech:
print(f"HOST guidance: {host_speech[:100]}...")
# Incorporate into LLM prompt for summary generation
else:
print("No HOST speech available yet")