The Challenge
Strategic planning is inherently multi-perspective. A growth initiative that looks compelling to a sales strategist might expose blind spots visible only to a risk assessor. Surfacing those tensions requires bringing diverse expert viewpoints into the same room — which traditionally means expensive consultant engagements, lengthy workshops, and weeks of synthesis.
Adfluence Hub needed to accelerate this process for their clients. The goal: structured strategic simulations that capture the tension between multiple expert perspectives, in minutes rather than months.
The Solution
The Agentic Ideation Sandbox is a full-stack collaborative workspace where teams assemble AI agents — each with a defined role, specialisation, and personality — and set them running on a strategic objective. The agents conduct multi-turn conversations through Gemini, challenging each other's proposals, surfacing risks, and building on creative ideas.
The entire simulation runs asynchronously via Celery, with real-time progress streamed to all connected clients through a Redis Pub/Sub → WebSocket relay. Multiple team members can watch a simulation unfold simultaneously, comment, and compare results across scenarios.
How It Works
A team defines the workspace objective, domain, and success criteria. This context seeds every agent's reasoning.
Team members configure agents — assigning roles (market analyst, risk assessor, creative strategist), specialisations, and personality traits that shape how each agent reasons and responds.
The FastAPI backend enqueues a run_simulation_task to Celery. The HTTP response returns immediately — the simulation runs entirely in the background.
The Celery worker loads the workspace and agents from PostgreSQL, generates persona-specific prompts, and runs a multi-turn Gemini conversation between agents. Each turn is shaped by the agent's personality and the previous exchange.
As each agent responds, the worker publishes to a Redis channel (workspace:{id}:notifications). A background listener in FastAPI picks up these events and relays them to connected WebSocket clients — zero polling, zero tight coupling.
Simulation results are persisted to PostgreSQL. Each agent's contributions are scored and logged in a PerformanceRecord table, creating an auditable record of which perspectives drove the outcome.
Technical Highlights
Redis Pub/Sub Decoupling
Celery workers and WebSocket clients never communicate directly. Workers publish events to a Redis channel; FastAPI's async listener relays them to the correct workspace subscribers. Adding more workers or more clients requires no architectural change.
JSON Repair for LLM Outputs
LLMs occasionally produce malformed JSON — a missing bracket, a trailing comma. Rather than crashing the simulation, the json-repair library recovers the structure gracefully, keeping the multi-turn conversation intact.
Async Session Management
Each Celery task creates its own SQLAlchemy async session, isolated from the request-handling sessions in FastAPI. This prevents session conflicts when multiple simulations run concurrently across workers.
Performance Audit Trail
Every agent's contribution is scored and stored in a PerformanceRecord table linked to the simulation. Teams can compare which agent configurations led to higher-quality strategic outputs over time.
The Stack
Outcomes
- Strategic simulations that previously required multi-day consultant workshops now run in minutes, with configurable depth and agent count.
- Teams can run multiple competing scenarios in parallel, comparing strategic outputs across different agent compositions.
- The persistent performance audit trail enables longitudinal analysis — tracking which strategic approaches held up over time versus which collapsed under scrutiny.
- The decoupled architecture (Celery + Redis + WebSockets) scales to concurrent simulations without client-side changes.