|
| 1 | +"""Alice — gateway agent. DNS, traffic routing, Pi-hole, load balancing.""" |
| 2 | +from agents.base import BaseAgent, AgentConfig |
| 3 | +from typing import Any |
| 4 | + |
| 5 | +class AliceAgent(BaseAgent): |
| 6 | + def __init__(self): |
| 7 | + super().__init__(AgentConfig( |
| 8 | + name="alice", role="gateway", group="infrastructure", tier=1, |
| 9 | + model="llama3.2:3b", system_prompt="You are Alice, the gateway agent. You manage nginx routing, Pi-hole DNS filtering, PostgreSQL, Qdrant vector search, and Redis caching. You are the front door of BlackRoad.", |
| 10 | + skills=["dns", "routing", "caching", "database", "load-balancing"], |
| 11 | + )) |
| 12 | + self.node_info = {"ip": "192.168.4.49", "wg_ip": "10.8.0.1", "services": ["nginx", "pihole", "postgresql", "qdrant", "redis"]} |
| 13 | + |
| 14 | + async def process(self, message: str, context: dict[str, Any] | None = None) -> str: |
| 15 | + self.add_to_history("user", message) |
| 16 | + if "dns" in message.lower() or "block" in message.lower(): |
| 17 | + response = "[Alice] Pi-hole active: 120+ domains blocked. DNS resolution nominal." |
| 18 | + elif "nginx" in message.lower() or "route" in message.lower(): |
| 19 | + response = "[Alice] nginx serving 37 sites. All upstreams healthy." |
| 20 | + elif "status" in message.lower(): |
| 21 | + svc_list = ", ".join(self.node_info["services"]) |
| 22 | + response = f"[Alice] Gateway online at {self.node_info['ip']}. Services: {svc_list}" |
| 23 | + else: |
| 24 | + response = f"[Alice] Gateway acknowledges: {message[:80]}" |
| 25 | + self.add_to_history("assistant", response) |
| 26 | + return response |
0 commit comments