Skip to content

"Vibe-Trading: Your Personal Trading Agent"

Add Pixel Office management starter

Copilot Appd65dca041df3
diff --git a/README.md b/README.md
index a58f6cbb3..733d9c853 100644
--- a/README.md
+++ b/README.md
@@ -358,6 +358,20 @@ vibe-trading --upload trades_export.csv
vibe-trading run -p "Analyze my trading behavior, extract my shadow strategy, and compare it with my actual trades"
```
+### Pixel Office management
+
+If you want a local office-level agent board that delegates research, risk, and execution work to specialist Pixel Agents, use the bundled starter workspace:
+
+```bash
+PYTHONPATH=agent python -m src.pixel_agents.cli init --storage ./pixel-office/office_state.json
+PYTHONPATH=agent python -m src.pixel_agents.cli agent --storage ./pixel-office/office_state.json --id research-analyst --name "Research Analyst" --role research --specialties macro crypto risk
+PYTHONPATH=agent python -m src.pixel_agents.cli task --storage ./pixel-office/office_state.json --id task-001 --title "Research BTC" --description "Assess the BTC thesis and risk profile" --workstream research --priority high
+PYTHONPATH=agent python -m src.pixel_agents.cli assign --storage ./pixel-office/office_state.json --task-id task-001
+PYTHONPATH=agent python -m src.pixel_agents.cli dashboard --storage ./pixel-office/office_state.json
+```
+
+This management layer is intentionally lightweight and can be extended later with a web dashboard, live broker hooks, or direct handoff to a workspace agent.
+
---
## 👥 Shadow Account
diff --git a/agent/src/pixel_agents/__init__.py b/agent/src/pixel_agents/__init__.py
new file mode 100644
index 000000000..87834b0a9
--- /dev/null
+++ b/agent/src/pixel_agents/__init__.py
@@ -0,0 +1,11 @@
+"""Pixel Agents office manager for Vibe-Trading.
+
+This package provides a lightweight task-and-agent management layer for a
+trading office that coordinates several specialist agents. It keeps the system
+self-contained and works as a starter for future expansion into live broker
+automation, portfolio monitoring, and research handoff flows.
+"""
+
+from .office import Agent, OfficeManager, Task
+
+__all__ = ["Agent", "OfficeManager", "Task"]
diff --git a/agent/src/pixel_agents/cli.py b/agent/src/pixel_agents/cli.py
new file mode 100644
index 000000000..e36c5d1be
--- /dev/null
+++ b/agent/src/pixel_agents/cli.py
@@ -0,0 +1,126 @@
+from __future__ import annotations
+
+import argparse
+import json
+from pathlib import Path
+
+from src.pixel_agents.office import DEFAULT_OFFICE_PATH, OfficeManager
+
+
+def _build_parser() -> argparse.ArgumentParser:
+ storage_parent = argparse.ArgumentParser(add_help=False)
+ storage_parent.add_argument("--storage", type=str, default=str(DEFAULT_OFFICE_PATH), help="Path to the JSON office state")
+
+ parser = argparse.ArgumentParser(description="Pixel Agents office manager", parents=[storage_parent])
+ subparsers = parser.add_subparsers(dest="command")
+
+ init_cmd = subparsers.add_parser("init", help="Initialize office state", parents=[storage_parent])
+ init_cmd.set_defaults(action="init")
+
+ add_agent_cmd = subparsers.add_parser("agent", help="Add an agent to the office", parents=[storage_parent])
+ add_agent_cmd.add_argument("--id", required=True)
+ add_agent_cmd.add_argument("--name", required=True)
+ add_agent_cmd.add_argument("--role", required=True)
+ add_agent_cmd.add_argument("--specialties", nargs="*", default=[])
+ add_agent_cmd.add_argument("--office", default="trading-floor")
+ add_agent_cmd.set_defaults(action="agent")
+
+ task_cmd = subparsers.add_parser("task", help="Create a task for the office", parents=[storage_parent])
+ task_cmd.add_argument("--id", required=True)
+ task_cmd.add_argument("--title", required=True)
+ task_cmd.add_argument("--description", required=True)
+ task_cmd.add_argument("--workstream", default="trading")
+ task_cmd.add_argument("--priority", default="normal")
+ task_cmd.add_argument("--owner", default="ops")
+ task_cmd.set_defaults(action="task")
+
+ assign_cmd = subparsers.add_parser("assign", help="Assign a task to an agent", parents=[storage_parent])
+ assign_cmd.add_argument("--task-id", required=True)
+ assign_cmd.add_argument("--agent-id", default=None)
+ assign_cmd.set_defaults(action="assign")
+
+ complete_cmd = subparsers.add_parser("complete", help="Complete a task", parents=[storage_parent])
+ complete_cmd.add_argument("--task-id", required=True)
+ complete_cmd.add_argument("--result", required=True)
+ complete_cmd.set_defaults(action="complete")
+
+ list_cmd = subparsers.add_parser("list", help="List tasks and agents", parents=[storage_parent])
+ list_cmd.set_defaults(action="list")
+
+ dashboard_cmd = subparsers.add_parser("dashboard", help="Show the office dashboard", parents=[storage_parent])
+ dashboard_cmd.set_defaults(action="dashboard")
+
+ return parser
+
+
+def main() -> None:
+ parser = _build_parser()
+ args = parser.parse_args()
+ storage = Path(args.storage)
+ manager = OfficeManager(storage)
+
+ if args.command is None:
+ parser.print_help()
+ return
+
+ if args.action == "init":
+ if storage.exists():
+ print(f"Office state already exists: {storage}")
+ return
+ manager = OfficeManager(storage)
+ manager._save_state()
+ print(f"Initialized Pixel office at {storage}")
+ return
+
+ if args.action == "agent":
+ agent = manager.add_agent(
+ agent_id=args.id,
+ name=args.name,
+ role=args.role,
+ specialties=args.specialties,
+ office=args.office,
+ )
+ print(json.dumps({"agent": agent.to_dict()}, indent=2, ensure_ascii=False))
+ return
+
+ if args.action == "task":
+ task = manager.create_task(
+ task_id=args.id,
+ title=args.title,
+ description=args.description,
+ workstream=args.workstream,
+ priority=args.priority,
+ owner=args.owner,
+ )
+ print(json.dumps({"task": task.to_dict()}, indent=2, ensure_ascii=False))
+ return
+
+ if args.action == "assign":
+ task = manager.assign_task(args.task_id, agent_id=args.agent_id)
+ if task is None:
+ print(f"No eligible agent available for task {args.task_id}")
+ return
+ print(json.dumps({"task": task.to_dict()}, indent=2, ensure_ascii=False))
+ return
+
+ if args.action == "complete":
+ task = manager.complete_task(args.task_id, args.result)
+ if task is None:
+ print(f"Task not found: {args.task_id}")
+ return
+ print(json.dumps({"task": task.to_dict()}, indent=2, ensure_ascii=False))
+ return
+
+ if args.action == "list":
+ print(json.dumps({"agents": manager.list_agents(), "tasks": manager.list_tasks()}, indent=2, ensure_ascii=False))
+ return
+
+ if args.action == "dashboard":
+ print(json.dumps(manager.dashboard(), indent=2, ensure_ascii=False))
+ return
+
+ parser.print_help()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/agent/src/pixel_agents/office.py b/agent/src/pixel_agents/office.py
new file mode 100644
index 000000000..c8e2c6bb1
--- /dev/null
+++ b/agent/src/pixel_agents/office.py
@@ -0,0 +1,225 @@
+from __future__ import annotations
+
+import json
+from dataclasses import asdict, dataclass, field
+from datetime import datetime, timezone
+from pathlib import Path
+from typing import Any, Dict, List, Optional
+
+
+DEFAULT_OFFICE_PATH = Path.home() / ".vibe-trading" / "pixel-office" / "office_state.json"
+
+
+def _utc_now() -> str:
+ return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
+
+
+@dataclass
+class Agent:
+ id: str
+ name: str
+ role: str
+ status: str = "idle"
+ load: int = 0
+ specialities: List[str] = field(default_factory=list)
+ office: str = "trading-floor"
+
+ def to_dict(self) -> Dict[str, Any]:
+ return asdict(self)
+
+
+@dataclass
+class Task:
+ id: str
+ title: str
+ description: str
+ workstream: str = "trading"
+ priority: str = "normal"
+ owner: str = "ops"
+ status: str = "queued"
+ assigned_to: Optional[str] = None
+ created_at: str = field(default_factory=_utc_now)
+ updated_at: str = field(default_factory=_utc_now)
+ result: str = ""
+
+ def to_dict(self) -> Dict[str, Any]:
+ return asdict(self)
+
+
+class OfficeManager:
+ """Simple runtime for delegating work among Pixel Agents.
+
+ The manager stores state in a JSON file so it is easy to inspect, version,
+ and extend later with a web dashboard or a broker automation layer.
+ """
+
+ def __init__(self, storage_path: Optional[str | Path] = None):
+ self.storage_path = Path(storage_path) if storage_path is not None else DEFAULT_OFFICE_PATH
+ self.storage_path.parent.mkdir(parents=True, exist_ok=True)
+ self.state = self._load_state()
+
+ def _load_state(self) -> Dict[str, Any]:
+ if not self.storage_path.exists():
+ return {"office_name": "Pixel Trading Office", "created_at": _utc_now(), "agents": [], "tasks": []}
+
+ try:
+ with self.storage_path.open("r", encoding="utf-8") as handle:
+ payload = json.load(handle)
+ except json.JSONDecodeError:
+ return {"office_name": "Pixel Trading Office", "created_at": _utc_now(), "agents": [], "tasks": []}
+
+ payload.setdefault("agents", [])
+ payload.setdefault("tasks", [])
+ return payload
+
+ def _save_state(self) -> None:
+ self.storage_path.parent.mkdir(parents=True, exist_ok=True)
+ with self.storage_path.open("w", encoding="utf-8") as handle:
+ json.dump(self.state, handle, indent=2, ensure_ascii=False)
+ handle.write("\n")
+
+ def add_agent(
+ self,
+ *,
+ agent_id: str,
+ name: str,
+ role: str,
+ specialties: Optional[List[str]] = None,
+ office: str = "trading-floor",
+ ) -> Agent:
+ agent = Agent(
+ id=agent_id,
+ name=name,
+ role=role,
+ specialities=specialties or [],
+ office=office,
+ )
+ agents = self.state.setdefault("agents", [])
+ for idx, existing in enumerate(agents):
+ if existing.get("id") == agent.id:
+ agents[idx] = agent.to_dict()
+ self._save_state()
+ return agent
+ agents.append(agent.to_dict())
+ self._save_state()
+ return agent
+
+ def create_task(
+ self,
+ *,
+ task_id: str,
+ title: str,
+ description: str,
+ workstream: str = "trading",
+ priority: str = "normal",
+ owner: str = "ops",
+ ) -> Task:
+ task = Task(
+ id=task_id,
+ title=title,
+ description=description,
+ workstream=workstream,
+ priority=priority,
+ owner=owner,
+ )
+ tasks = self.state.setdefault("tasks", [])
+ tasks.append(task.to_dict())
+ self._save_state()
+ return task
+
+ def find_agent(self, agent_id: str) -> Optional[Dict[str, Any]]:
+ for agent in self.state.get("agents", []):
+ if agent.get("id") == agent_id:
+ return agent
+ return None
+
+ def _compatible_agent(self, task: Dict[str, Any]) -> Optional[Dict[str, Any]]:
+ role = task.get("workstream")
+ for agent in self.state.get("agents", []):
+ if agent.get("status") != "idle":
+ continue
+ if role in {"trading", "research"} and agent.get("role") in {"research", "execution"}:
+ return agent
+ if role == "risk" and agent.get("role") == "risk":
+ return agent
+ if role == "execution" and agent.get("role") == "execution":
+ return agent
+ return None
+
+ def assign_task(self, task_id: str, agent_id: Optional[str] = None) -> Optional[Task]:
+ tasks = self.state.get("tasks", [])
+ task_index = next((idx for idx, item in enumerate(tasks) if item.get("id") == task_id), None)
+ if task_index is None:
+ return None
+
+ task = tasks[task_index]
+ agent = None
+ if agent_id:
+ agent = self.find_agent(agent_id)
+ else:
+ agent = self._compatible_agent(task)
+
+ if agent is None:
+ return None
+
+ task["assigned_to"] = agent["id"]
+ task["status"] = "assigned"
+ task["updated_at"] = _utc_now()
+
+ for existing in self.state["agents"]:
+ if existing.get("id") == agent["id"]:
+ existing["status"] = "busy"
+ existing["load"] = int(existing.get("load", 0)) + 1
+ break
+
+ self._save_state()
+ return Task(**task)
+
+ def complete_task(self, task_id: str, result: str) -> Optional[Task]:
+ tasks = self.state.get("tasks", [])
+ task_index = next((idx for idx, item in enumerate(tasks) if item.get("id") == task_id), None)
+ if task_index is None:
+ return None
+
+ task = tasks[task_index]
+ task["status"] = "completed"
+ task["result"] = result
+ task["updated_at"] = _utc_now()
+ assigned_to = task.get("assigned_to")
+
+ if assigned_to:
+ for agent in self.state["agents"]:
+ if agent.get("id") == assigned_to:
+ agent["status"] = "idle"
+ break
+
+ self._save_state()
+ return Task(**task)
+
+ def list_tasks(self) -> List[Dict[str, Any]]:
+ return list(self.state.get("tasks", []))
+
+ def list_agents(self) -> List[Dict[str, Any]]:
+ return list(self.state.get("agents", []))
+
+ def dashboard(self) -> Dict[str, Any]:
+ tasks = self.list_tasks()
+ agents = self.list_agents()
+ completed = sum(1 for task in tasks if task.get("status") == "completed")
+ pending = sum(1 for task in tasks if task.get("status") in {"queued", "assigned"})
+ return {
+ "office_name": self.state.get("office_name", "Pixel Trading Office"),
+ "agent_count": len(agents),
+ "task_count": len(tasks),
+ "busy_agents": sum(1 for agent in agents if agent.get("status") == "busy"),
+ "idle_agents": sum(1 for agent in agents if agent.get("status") == "idle"),
+ "completed": completed,
+ "pending": pending,
+ "agents": agents,
+ "tasks": tasks,
+ }
+
+
+if __name__ == "__main__":
+ manager = OfficeManager()
+ print(json.dumps(manager.dashboard(), indent=2, ensure_ascii=False))
diff --git a/pixel-office/README.md b/pixel-office/README.md
new file mode 100644
index 000000000..43385d00f
--- /dev/null
+++ b/pixel-office/README.md
@@ -0,0 +1,19 @@
+# Pixel Office
+
+This workspace is the management place for the Pixel Agent office.
+
+It keeps three tracks:
+
+- Trading research and signal generation
+- Risk and execution oversight
+- Office operations and delegation routing
+
+Use the included Python manager to create agents, assign work, and monitor the office state.
+
+Quick start:
+
+```bash
+PYTHONPATH=agent python -m src.pixel_agents.cli --help
+PYTHONPATH=agent python -m src.pixel_agents.cli init --storage ./pixel-office/office_state.json
+PYTHONPATH=agent python -m src.pixel_agents.cli dashboard --storage ./pixel-office/office_state.json
+```
diff --git a/pixel-office/office_state.json b/pixel-office/office_state.json
new file mode 100644
index 000000000..3143ae7f7
--- /dev/null
+++ b/pixel-office/office_state.json
@@ -0,0 +1,34 @@
+{
+ "office_name": "Pixel Trading Office",
+ "created_at": "2026-09-22T13:42:00Z",
+ "agents": [
+ {
+ "id": "research-analyst",
+ "name": "Research Analyst",
+ "role": "research",
+ "status": "idle",
+ "load": 0,
+ "specialities": ["macro", "equity", "crypto", "news"],
+ "office": "trading-floor"
+ },
+ {
+ "id": "risk-guard",
+ "name": "Risk Guard",
+ "role": "risk",
+ "status": "idle",
+ "load": 0,
+ "specialities": ["risk", "drawdown", "execution"],
+ "office": "trade-ops"
+ },
+ {
+ "id": "execution-agent",
+ "name": "Execution Agent",
+ "role": "execution",
+ "status": "idle",
+ "load": 0,
+ "specialities": ["broker", "orders", "routing"],
+ "office": "live-trading"
+ }
+ ],
+ "tasks": []
+}