🎹
Movement 3 of 4 Chapter 20 of 42 Ready to Read

Contextual Chat - Dialoguing with AI Team

Our system was a powerful and autonomous engine, but its interface was still rudimentary. Users could see goals and deliverables, but interaction was limited. To fully realize our vision of a "digital colleagues team", we needed to give users a way to dialogue with the system naturally.

We didn't want a simple chatbot. We wanted a true Conversational Project Manager, an interface capable of understanding user requests in the project context and translating them into concrete actions.

# The Architectural Decision: A Dedicated Conversational Agent

The question was: where should we place this conversational capability? We had several options:

Option C was the clear winner. By treating conversation as a specialized skill requiring its own agent, we maintained consistency with our architectural philosophy while gaining several key benefits:

💡 Why a Dedicated Conversational Agent?

1. Specialization: Conversation requires unique skills (context management, intent recognition, natural language understanding)
2. State Management: Unlike stateless task agents, conversations need persistent memory and context
3. Tool Orchestration: The conversational agent acts as a conductor, deciding which specialized tools to use based on user intent
4. Consistent Architecture: Follows our "agent for every specialized capability" pattern

Instead of adding scattered chat logic in our endpoints, we followed our specialization pattern and created a new fixed agent: the SimpleConversationalAgent.

Reference code: backend/agents/conversational.py (hypothetical)

This agent is unique for two reasons:

  1. It's Stateful: Unlike other agents that are mostly stateless (receive a task, execute it and finish), the conversational agent maintains a history of the current conversation, thanks to the SDK's Session primitive.
  2. It's a Tool Orchestrator: Its main purpose is not to generate content, but to understand the user's intent and orchestrate the execution of appropriate tools to satisfy it.

Conversation Flow:

System Architecture

graph TD A[User Sends Message:
Add €1000 to budget] B{Conversational Endpoint} C[Load Workspace and
Conversation Context] D{ConversationalAgent
analyzes intent} E{AI decides to use the
modify_configuration tool} F[SDK formats tool call with parameters:
amount: 1000, operation: increase] G{Executor executes the tool} H[Action Result] I{ConversationalAgent
formulates response} J[Response to User:
OK, I've increased the budget.
The new total is €4000.] A --> B B --> C C --> D D --> E E --> F F --> G G --> H H --> I I --> J D -.->|Intent: modify_budget| E G -.->|Tool updates DB| H

# UI Architecture: Fixed vs Dynamic Chats

To make the conversational interface truly effective, we implemented a dual-chat architecture that reflects the different types of interactions users need with the system:

🔧 Fixed Chats (System Management)

These are persistent, specialized chats for specific system aspects:

  • Team Management: Add members, update skills, manage roles
  • Configuration: Modify budget, timeline, priorities, settings
  • Knowledge Base: Search documentation, best practices, lessons learned
  • Tools & Integrations: Manage available tools, check capabilities

Each fixed chat maintains long-term context and specialized knowledge about its domain.

🎯 Dynamic Chats (Goal Management)

These are created on-demand for specific goals or projects:

  • Goal-Oriented: Each chat focuses on achieving a specific objective
  • Lifecycle-Bound: The chat exists for the duration of the goal
  • Context-Rich: Maintains deep context about progress, obstacles, and decisions
  • Outcome-Focused: Designed to drive toward deliverable completion

This architecture allows users to seamlessly switch between managing the system (fixed chats) and driving project outcomes (dynamic chats), each with appropriate context and capabilities.

# Power User Feature: Slash Commands

To accelerate expert user workflows, we implemented a slash command system that provides rapid access to common tools and information. Users can type / to see available commands:

Available Slash Commands
Command Description Use Case
/show_project_status 📊 View Project Status Get comprehensive project overview and metrics
/show_team_status 👥 View Team Status See current team composition and activities
/show_goal_progress 🎯 View Goal Progress Check progress on specific objectives
/show_deliverables 📦 View Deliverables See completed deliverables and assets
/approve_all_feedback ✅ Approve All Feedback Bulk approve pending feedback requests
/add_team_member ➕ Add Team Member Add new member with specific role and skills
/create_goal 🎯 Create Goal Define new project objectives
/fix_workspace_issues 🔧 Fix Workspace Issues Restart failed tasks and resolve issues

These commands transform natural language requests into precise tool calls, dramatically reducing the cognitive load for frequent operations.

# Standard Artifacts: Beyond Conversation

While conversation is powerful, some interactions are better handled through structured interfaces. We developed a set of standard artifacts that users can access through conversation or directly through the UI:

🎭 Team Management Artifacts

  • Agent Skill Radar Charts: Visual representation of individual agent capabilities using our AgentSkillRadarChart component
  • Team Composition Matrix: Skills coverage analysis across the entire team
  • Workload Distribution: Real-time view of task assignments and agent utilization
  • Performance Metrics: Success rates, completion times, quality scores per agent

🎯 Project Orchestration Artifacts

  • Goal Hierarchy Visualizer: Interactive tree view of objectives and sub-goals
  • Task Dependencies Graph: Network visualization of task relationships and blockers
  • Progress Heatmaps: Time-based view of project velocity and bottlenecks
  • Deliverable Pipeline: Status and readiness of project outputs

🛠️ Tools & Integrations Artifacts

  • Tool Registry Dashboard: Available tools, usage patterns, success rates
  • Integration Health Monitor: Status of external services and APIs
  • Capability Matrix: Which agents can use which tools effectively
  • Usage Analytics: Tool performance and optimization opportunities

✅ Quality Assurance Artifacts

  • Feedback Request Queue: Pending human reviews and approvals
  • Quality Metrics Dashboard: Completion rates, revision cycles, user satisfaction
  • Enhancement Tracking: Improvement suggestions and their implementation status
  • Risk Assessment Matrix: Identified issues and mitigation strategies

Each artifact is designed to be both standalone (accessible via direct URL) and conversationally integrated (can be requested through chat).

# The Heart of the System: The Agnostic Service Layer

One of the biggest challenges was how to allow the conversational agent to perform actions (like modifying the budget) without tightly coupling it to database logic.

The solution was to create an agnostic Service Layer.

Reference code: backend/services/workspace_service.py (hypothetical)

We created an interface (WorkspaceServiceInterface) that defines high-level business actions (e.g., update_budget, add_agent_to_team). Then, we created a concrete implementation of this interface for Supabase (SupabaseWorkspaceService).

The conversational agent knows nothing about Supabase. It simply calls workspace_service.update_budget(...). This respects Pillar #14 (Modular Tool/Service-Layer) and would allow us in the future to change databases by modifying only one class, without touching the agent logic.

# "War Story": The Forgetful Chat

Our early chat versions were frustrating. The user asked: "What's the project status?", the AI responded. Then the user asked: "And what are the risks?", and the AI responded: "Which project?". The conversation had no memory.

Disaster Logbook (July 29):

USER: "Show me the team members."
AI: "Sure, the team consists of Marco, Elena and Sara."
USER: "OK, add a QA Specialist."
AI: "Which team do you want to add them to?"

The Lesson Learned: Context is Everything.

A conversation without context is not a conversation, it's a series of isolated exchanges. The solution was to implement a robust Context Management Pipeline.

  1. Initial Context Loading: When the user opens a chat, we load a "base context" with key workspace information.
  2. Continuous Enrichment: With each message, the context is updated not only with message history, but also with the results of executed actions.
  3. Summarization for Long Contexts: To avoid exceeding model token limits, we implemented logic that, for very long conversations, "summarizes" older messages, keeping only salient information.

This transformed our chat from a simple command interface to a true intelligent and contextual dialogue.

📝 Chapter Key Takeaways:

Treat Chat as an Agent, Not an Endpoint: A robust conversational interface requires a dedicated agent that handles state, intent, and tool orchestration.

Decouple Actions from Business Logic: Use a Service Layer to prevent your conversational agents from being tightly coupled to your database implementation.

Context is King of Conversation: Invest time in creating a solid context management pipeline. It's the difference between a frustrating chatbot and an intelligent assistant.

Design for Long and Short-Term Memory: Use the SDK's Session for short-term memory (current conversation) and your WorkspaceMemory for long-term knowledge.

Chapter Conclusion

With an intelligent conversational interface, we finally had an intuitive way for users to interact with our system's power. But it wasn't enough. To truly gain user trust, we needed to take one more step: we had to open the "black box" and show them how the AI reached its conclusions. It was time to implement Deep Reasoning.

🌙 Theme
🔖 Bookmark
📚 My Bookmarks
🌐
🔤 Font Size
Bookmark saved!

📚 My Bookmarks

📚 Continue Reading