The Agent Manager plugin provides a web UI and REST API for managing AI agents inside StratoCyberLab network topologies. It discovers topology containers via Docker labels, reads agent assignments from topology files, and lets users start interactive sessions with OpenCode-enabled agents.
- Container Discovery: Discovers SCL topology containers by Docker labels (
scl.plugin=network-topology). - Agent Display: Shows only agents from topologies that currently have running containers.
- Session Management: Create sessions and send goals to agents running inside containers.
- OpenCode Integration: Health checks and session proxying for OpenCode servers on port
4096. - State Tracking: Reads agent assignments dynamically from each topology's
topology.json.
stratocyberlab/plugins/agent-manager/
├── backend/ # FastAPI/Quart Python backend
│ ├── app.py # Main application, routers, background tasks
│ ├── models.py # Pydantic models
│ └── routers/
│ ├── agents.py # Agent templates, assignments, status
│ ├── containers.py # Container discovery and detail endpoints
│ ├── sessions.py # Session creation and messaging
│ ├── topologies.py # Topology start/stop proxy
│ └── reconciliation.py # Reconciliation status
│ └── services/
│ ├── agent_lifecycle.py # Assignment state helpers
│ ├── docker_client.py # Docker discovery, OpenCode readiness
│ ├── opencode_client.py # OpenCode session API client
│ └── topology_client.py # topology.json loader
├── frontend/ # React + TypeScript + Vite UI
│ └── src/pages/
│ ├── AgentsPage.tsx # Agent goal/session UI
│ ├── HostDiscoveryPage.tsx # Container/agent assignment UI
│ └── TopologyPage.tsx # Topology list
├── tests/ # Test scripts
├── scripts/ # Build and utility scripts
├── Dockerfile.dashboard # Multi-stage build for dashboard image
├── Dockerfile.opencode # OpenCode image build
├── docker-compose.yml # Production compose (port 9005)
├── .gitignore # Python, Node, and runtime data exclusions
└── README.md
cd ./stratocyberlab/plugins/agent-manager
# Set LLM environment variables (required for agent functionality)
export OPENCODE_API_KEY=your-api-key-here
export LLM_URL=https://llm.ai.e-infra.cz/v1
export LLM_MODEL=qwen3-coder
# Start the services
docker compose up -d --buildThe dashboard is available at http://localhost:9005.
cd /home/diego/SCLT/stratocyberlab/plugins/agent-manager/backend
pip install -r requirements.txt
python -m uvicorn backend.app:app --reload --host 0.0.0.0 --port 8080cd /home/diego/SCLT/stratocyberlab/plugins/agent-manager/frontend
npm ci
npm run devEnvironment variables (set in docker-compose.yml):
| Variable | Default | Description |
|---|---|---|
TOPOLOGY_DATA_DIR |
/app/topologies/topologies |
Path to topology data inside the container |
AGENT_STATE_DIR |
/app/state |
Path to agent state volume |
DASHBOARD_PORT |
8080 |
Internal backend port |
OUTPUTS_DIR |
/outputs |
Trident/timeline output directory |
TOPOLOGY_PLUGIN_URL |
http://scl-network-topology:9002 |
Network topology plugin URL |
LOG_LEVEL |
INFO |
Logging level |
For OpenCode agents to function, ensure the following environment variables are set when starting the topology plugin:
export OPENCODE_API_KEY=your-api-key-here
export LLM_URL=https://llm.ai.e-infra.cz/v1
export LLM_MODEL=qwen3-coderImportant: Never hardcode API keys in .env files. Always pass them via the shell environment.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/agents/health |
Service health check |
| GET | /api/agents/templates |
List supported agent templates |
| GET | /api/agents/templates/{type} |
Get one template |
| GET | /api/agents/assignments |
List assignments (optionally filter by topology_id) |
| GET | /api/agents/state |
Get full agent state |
| GET | /api/agents/status/{topology_id}/{host_id} |
Status for one host |
| POST | /api/agents/assign |
Queue an agent assignment |
| DELETE | /api/agents/{topology_id}/{host_id}/{agent_type} |
Remove an agent |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/containers |
List containers (alias, enriched from topology) |
| GET | /api/containers/discover |
Discover with filters |
| GET | /api/containers/{container_id} |
Container details |
| GET | /api/containers/by-host/{topology_id}/{host_id} |
Lookup by host |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/sessions/list |
List sessions |
| GET | /api/sessions/{session_id} |
Get session info |
| GET | /api/sessions/{session_id}/messages |
Get messages |
| POST | /api/sessions |
Create a session with an initial goal |
- The Network Topology plugin creates
topology.jsonfiles underdata/topologies/<id>/. - Each host in the topology may have an
agentsarray, e.g.["coder56"]. - When a topology is started, the network-topology plugin builds containers using the
scl-plugin-network-topology-ubuntu-opencodeimage for hosts with agents. - The Agent Manager discovers running containers, reads their topology file, and displays the configured agents.
- The Agents page filters assignments so only agents from currently-running topologies are shown.
- Creating a session calls the OpenCode HTTP API inside the container on port
4096.
Run the assignment verification test:
cd /home/diego/SCLT/stratocyberlab/plugins/agent-manager
python tests/test_assignments.py- Check that the target topology is running:
curl 'http://localhost:9005/api/containers/discover?state=running' - Verify the topology host has an
agentsarray intopology.json. - Check that
current_agentsis populated:curl 'http://localhost:9005/api/containers?topology_id=<id>'
- Check OpenCode health inside the container:
docker exec <container> curl -s http://localhost:4096/global/health
- Verify
/root/.config/opencode/opencode.jsonhas:"$schema": "https://opencode.ai/config.json""baseURL": "{env:LLM_URL}""apiKey": "{env:OPENCODE_API_KEY}"
- Inspect OpenCode logs:
docker exec <container> tail -50 /root/.local/share/opencode/log/*.log
StratoCyberLab - Educational Cyber Range Platform