|
| 1 | +# Python Intelligence (v30 Architecture) |
| 2 | + |
| 3 | +This directory (`core/v30_architecture/python_intelligence/`) contains the foundational components for the modern, modular multi-agent system. |
| 4 | + |
| 5 | +## Key Components |
| 6 | + |
| 7 | +### `BaseAgent` (`agents/base_agent.py`) |
| 8 | +The `BaseAgent` class serves as the core foundation for all AI agents in the v30 architecture. |
| 9 | +- All new agents must inherit from `BaseAgent`. |
| 10 | +- Each agent must define a `name` and a `role`. |
| 11 | +- Agents communicate primarily via the asynchronous `emit` method, which standardizes telemetry and inter-agent communication. |
| 12 | +- The `execute(**kwargs)` method should be implemented by subclasses to support thread safety and async compatibility. |
| 13 | + |
| 14 | +### `NeuralMesh` (`bridge/neural_mesh.py`) |
| 15 | +The `NeuralMesh` is a high-speed websocket-based event bus that facilitates communication across the swarm. |
| 16 | +- It acts as the backbone for inter-agent packet routing. |
| 17 | +- Designed to handle real-time broadcasts and directed telemetry without traditional synchronous blocking. |
| 18 | + |
| 19 | +### `emit_packet` Workflow |
| 20 | +Agents push data into the `NeuralMesh` using the `emit_packet` function. |
| 21 | +- **Workflow**: `Agent.emit() -> emit_packet(NeuralPacket) -> NeuralMesh.broadcast() -> Listening Clients/Dashboards` |
| 22 | +- A `NeuralPacket` includes the `source_agent`, `packet_type`, and a robust `payload` dictionary. |
| 23 | +- This ensures all thoughts, actions, and decisions are perfectly logged and observable by UI dashboards. |
| 24 | + |
| 25 | +## Example Usage |
| 26 | + |
| 27 | +```python |
| 28 | +from core.v30_architecture.python_intelligence.agents.base_agent import BaseAgent |
| 29 | + |
| 30 | +class AnalysisAgent(BaseAgent): |
| 31 | + def __init__(self): |
| 32 | + super().__init__(name="Analyzer-1", role="Market Analyst") |
| 33 | + |
| 34 | + async def execute(self, **kwargs): |
| 35 | + # Perform analysis... |
| 36 | + result = {"status": "complete", "finding": "bullish"} |
| 37 | + |
| 38 | + # Emit findings to the mesh |
| 39 | + await self.emit(packet_type="ANALYSIS_COMPLETE", payload=result) |
| 40 | +``` |
0 commit comments