Principle:666ghj BettaFish File Based Inter Agent Communication
| Knowledge Sources | |
|---|---|
| Domains | Multi_Agent_Systems, Inter_Agent_Communication, Distributed_Systems |
| Last Updated | 2026-10-08 00:00 GMT |
Overview
Communication pattern where autonomous agents exchange information by writing to and reading from shared log files, enabling loose coupling without message queues or network protocols.
Description
File-Based Inter-Agent Communication uses the filesystem as a message bus: agents write structured log entries to their respective log files, and a monitor process tails these files to detect new messages and coordinate responses. This approach trades latency and scalability for simplicity: no message queue infrastructure, no network configuration, and natural human readability of the communication log.
In the BettaFish system, three research agents write their progress to `insight.log`, `media.log`, and `query.log`. The ForumEngine's LogMonitor tails these files, detects when agents produce summaries (their "speeches"), and triggers an LLM moderator to generate guidance that is written to `forum.log`. Agents read this guidance before their next summarization step, creating a debate-like dynamic.
Usage
Use this principle when building multi-agent systems where simplicity and debuggability matter more than throughput. It is ideal for systems with a small number of agents (3-10) running on a single machine where the communication log itself is valuable for analysis.
Theoretical Basis
The communication follows a publish-subscribe over files pattern:
Where:
- = agent i's log file (write-only for agent, read-only for monitor)
- = shared forum log (write-only for monitor, read-only for agents)
- The monitor acts as a message broker
Pseudo-code Logic:
# Abstract pattern (NOT real implementation)
# Agent side
log.write(format(speech))
# Monitor side
for line in tail(agent_logs):
if is_speech(line):
buffer.append(line)
if len(buffer) >= threshold:
guidance = host.generate(buffer)
forum_log.write(guidance)
# Agent reads guidance
guidance = forum_reader.get_latest()
Practical Guide
Advantages:
- No infrastructure dependencies (no Redis, RabbitMQ, etc.)
- Communication log is human-readable and debuggable
- Natural persistence (log files survive crashes)
- Simple implementation
Limitations:
- Single-machine only (no distributed agents)
- Polling latency (typically 1-second intervals)
- No backpressure mechanism
- Fragile to log format changes
Related Pages
Implemented By
- Implementation:666ghj_BettaFish_LogMonitor_start_monitoring
- Implementation:666ghj_BettaFish_ForumHost_generate_host_speech
- Implementation:666ghj_BettaFish_forum_reader_get_latest
- Implementation:666ghj_BettaFish_ReflectionSummaryNode_run