Optimizing AI Agent Flows for Effective Sales Estimation
Introduction What began as a simple AI assistant integrated into Slack is now being developed into a comprehensive sales copilot, particularly focusing on complex tasks like sal...
Introduction
What began as a simple AI assistant integrated into Slack is now being developed into a comprehensive sales copilot, particularly focusing on complex tasks like sales estimation. Though it might seem straightforward, sales estimation requires harmonizing scattered data sources (such as Slack, Google Drive, and call transcripts) and aligning them with internal methodologies. It's not merely about automation—it's about making informed judgments, understanding context, and supporting decisions.
To extend the capabilities of Omega, an internal AI platform, into this domain, an exploration of optimal agent flow architecture was necessary. Multiple orchestration models were evaluated to strike a balance between trade-offs, eventually leading to the adoption of a hybrid approach now being implemented.
Key Insights:
- Tech Stack and Agent Configuration: An overview of the chosen technologies and agent setups.
- Hybrid Flow Benefits: Why a hybrid flow was selected and its ideal application scenarios.
- Architectural Evaluation: Insights gained from assessing various architectural options.
Background: From Omega to Estimation
Omega is an internal AI agent platform designed to support real-world workflows, going beyond simple prompt responses. Instead of using generic tools, a modular, multi-agent system was created to integrate seamlessly with existing team tools. This approach allows each capability to be precisely tailored to the everyday realities of sales tasks.
Omega operates as a network of specialized agents collaborating on tasks such as call summarization, document retrieval, and proposal generation. With role-based orchestration and strong contextual awareness, Omega functions more like a colleague than a tool.
Existing off-the-shelf assistants fell short in meeting the needs for orchestration logic, real-time context handling, or integration flexibility. A customizable solution was needed to extend, debug, and adapt without disrupting team workflows. The focus is now on integrating Omega into the estimation process.
The Need for a Smarter Sales Estimation Flow
Despite appearing as a simple spreadsheet task, sales estimation is a multifaceted, cross-functional activity involving product, design, engineering, and sales. It had become a bottleneck due to its reliance on manual efforts and inconsistent results.
The Problem: Manual Effort and Scalability Issues
Currently, sales estimation heavily depends on manual coordination. Sales representatives gather inputs from call transcripts, Slack threads, and disparate documents, piecing everything together themselves. This process is time-consuming, varies between deals, and complicates maintaining a comprehensive view.
As the sales pipeline expands, this approach becomes increasingly difficult to scale. Expert time is limited, assumptions can be overlooked, and results often hinge on who manages the process. Therefore, an agent-based estimation flow is being developed to introduce structure, clarity, and collaboration into a cohesive system.
Desired Outcomes: Fast, Modular, Accurate Estimation
A new method is needed—one that breaks down estimation into logical steps, assigns tasks to specialized agents, and involves humans only when necessary. The goal isn't to automate the entire process end-to-end but to make estimation smarter, more structured, and easier to manage as the sales pipeline grows.
The design aims to:
- Implement modular and reusable logic.
- Facilitate agent collaboration with clearly defined roles.
- Produce context-aware outputs.
- Include built-in checkpoints for quality assurance and alignment.
Business Context: High Stakes, Cross-Functional Workflow
Sales estimation isn't just a backend process; it directly influences proposals, scopes, staffing, and client expectations. A weak estimate poses risks, such as missed deadlines, budget overruns, or misaligned deliverables. Designing the right agent flow is vital for building trust, ensuring repeatability, and equipping the sales team with a system that supports informed decision-making.
Technical Challenges: Developing a Multi-Agent Sales Flow
Building a sales estimation flow requires more than defining agent roles; it demands collaboration, tool integration, and human involvement. This isn't a simple prompt-response setup. Proper estimation necessitates reasoning over fragmented data, coordinating multiple agents with specialized roles, and supporting flexible, asynchronous conversations in Slack.
AI-First Approach: Tools and Integration
The chosen tech stack reflects the problem's nature:
- Slack: The primary workspace where estimation activities occur.
- Autogen: Facilitates multi-agent orchestration, allowing the definition of agent roles and workflows with real logic.
- Google Drive: Contains all project reference materials, necessitating custom tools for document interaction.
- LangFuse: Monitors performance, logs, and prompts—essential for safe iteration in a live environment.
Embracing an AI-native approach, agents collaborate, share memory, and operate within natural team workflows.
Flow Constraints: Human-In-the-Loop, Shared Memory, Asynchronous Interactions
The flow was designed around several non-negotiables:
- Human-in-the-loop: Ensures agents know when to pause, escalate, or request input, rather than just outputting numbers.
- Shared memory: Provides consistent context across agents, especially in Slack threads and tool outputs.
- Asynchronous interactions: The system must handle pauses, timeouts, and resumed conversations without breaking logic.
Key Components: SelectorPrompt, GraphFlow, Custom Google Drive Tools
Three core components facilitate the flow:
- SelectorPrompt: A prompt-based switchboard that selects the appropriate agent for each subtask based on input context.
- GraphFlow: A flexible orchestration structure mapping agent interactions over time, including fallback paths, approvals, and phase transitions.
- Custom Drive Tools: Functions allowing agents to extract feature lists, read scope documents, and generate outputs in Drive-friendly formats.
These tools create a flow that's modular, trackable, and adaptable without hardcoding every scenario.
Considered Options
With the foundational elements in place, the next step was deciding how agents should collaborate to estimate sales projects effectively. Estimation is a multi-step, collaborative, and context-heavy process requiring a system that can break down complex prompts, highlight missing assumptions, validate scopes, and leave room for human judgment.
Four architectural models were explored, each with different trade-offs in structure, speed, flexibility, and complexity. Evaluation criteria included:
- User experience (UX): Ensures a smooth and understandable flow in Slack.
- Latency: Delivers insights promptly for real-time conversations.
- Reusability: Enables agents to be reused across other sales tasks.
- Maintainability: Considers ease of scaling, debugging, and evolving the system.
Options Explored
-
Orchestrated Agent Pipeline: A fixed, step-by-step sequence where each agent handles a stage before passing it on.
- Pros: Clear structure, easy debugging, reusable components.
- Cons: Limited flexibility, higher latency, complex state sharing, requires many specialized agents.
-
Event-Driven Multi-Agent System: Agents respond to specific events, working in parallel with Slack threads as the event bus.
- Pros: Highly scalable, real-time UX, resilient to failures.
- Cons: Complex event handling, risk of race conditions, challenging debugging, robust error handling needed.
-
Hybrid Orchestrator with Dynamic Agent Teams: A flexible orchestrator dynamically assigns agents for each workflow phase.
- Pros: Leverages existing infrastructure, modular agents, flexible team composition.
- Cons: Requires prompt engineering, careful phase transitions, less transparent flow logic, limited phase parallelization.
-
Swarm Agents with Handoff: Agents operate autonomously, handing off tasks based on expertise with shared context.
- Pros: Flexible, deep project understanding, tailors to project-specific needs.
- Cons: Harder action sequence prediction, increased processing time, challenging tracing logic.
From Theory to Practice: Visualizing the Flow
Initially, the mapped estimation process appeared straightforward, with agents having defined roles and a linear sequence. However, deeper exploration, testing, and trade-offs resulted in a more adaptive flow.
Behind the Scenes: Real Conversations That Shaped the Flow
The final design emerged from real discussions, both technical and practical. Decisions from prompt routing to context management involved trade-offs.
Rethinking Triggers: From Keywords to Intent Detection
Initially, simple keyword triggers were considered for activating agents. However, this proved too fragile for real sales conversations. Client input is nuanced, and important modules might not be explicitly mentioned. Thus, LLM-based intent detection was adopted, enabling smarter context- and tone-based decisions, crucial in Slack's casual environment.
Smart Execution: When to Skip and When to Act
Determining how much each agent should "know" was another challenge. Conditional logic and lightweight caching were introduced. Agents now check for existing data before deciding to process, saving time and avoiding redundancy. "Exit conditions" were also defined, allowing agents to pause the flow, request more input, or defer to a human.
Real-Time Context Sync: Integrating Slack and Drive
With operations in Slack but heavy reliance on Google Drive files, a sync mechanism was built to connect the two. Files uploaded in Slack become instantly available to agents through Drive, with webhook triggers handling real-time updates. This setup reduced lag and made agent responses more responsive.
Shared Memory: Coordinating Multi-Agent Interactions
Context is more than documents; it's about continuity. A shared memory model was implemented, allowing agents to access prior messages, actions, and state. This enabled collaboration without repeating work or losing track of progress. It also set the stage for advanced orchestration patterns like selective re-execution and progressive refinement.
Testing Before Building: Using Promptfoo
To avoid debugging in production, Promptfoo was utilized for prompt evaluations and flow simulations, facilitating rapid iteration on agent behavior before going live. Complex sequences were mocked to explore edge cases and validate early handoffs. This test-first approach reduced rework and increased system reliability.
Choosing the AI Agent Flow and Its Significance
After exploring several architecture options, no single model was chosen. Instead, a combination of Option 3 (Hybrid Orchestrator) and Option 4 (Swarm Agents with Handoff) was adapted to suit different phases of the estimation workflow.
Why a Single Flow Wasn't Chosen
Each approach had strengths and trade-offs. Pipelines were clean but rigid, event-driven flows were elegant but challenging to trace, and swarm-based handoffs offered flexibility but risked unpredictability. Ultimately, no single structure matched the nuances of estimation work. Some phases require structure; others need adaptability, leading to a hybrid model that adjusts based on context.
Where the Hybrid Approach Excels
A SelectorPrompt-style orchestrator is used to dynamically assemble agent teams based on the task. This provides structure without enforcing a rigid sequence. For example, early phases like breaking down project scope involve a coordinated team: a module architect agent, a critic agent, and domain experts, with interactions supervised by the orchestrator. Later, in exploratory tasks like refining assumptions, agents can hand off freely based on confidence, input needs, or triggers, resembling the swarm model. Agents can return control to sales reps for review or flag gaps for human clarification.
Emerging Benefits
Even in early implementation, this hybrid approach has proven valuable, offering:
- Clarity in critical phases like cost scoping.
- Flexibility for exploration, where rigid paths limit insight.
- Improved user experience, blending real-time feedback with async execution.
- Reduced maintenance costs, thanks to modular components and shared state.
Lessons Learned
Designing agent-based flows involves balancing automation and control, flexibility and traceability, speed and reliability. Key insights include:
Architecture and Prompt Design: A Dual Focus
Effective multi-agent orchestration requires both solid system design and language crafting. Great prompts can't salvage poor flow logic, and well-designed architecture fails with unclear language. Successful outcomes emerged from treating prompt crafting and agent routing as a unified design process.
UX Considerations: Weighing the Costs
Each interaction or insight added by agents involves costs in latency, maintenance, and cognitive load. Better UX often means more agents, steps, or tools, adding complexity. A critical filter was asking: Is this genuinely helpful, or just clever? This helped maintain a lean, human-first system.
Context Management: A Constant Challenge
Maintaining stable, accessible context across agents was difficult. Even with shared memory and caching, handoffs risked losing nuance or duplicating effort. Comprehensive logging of inputs, states, and transitions was essential for debugging and prompt refinement. Tools like Langfuse provided visibility into agent conversations, reducing system opacity.
Future Directions: Toward Autonomy
Work on Omega's estimation flow continues, exploring technical paths, testing key components, and aligning on a hybrid architecture. The goal is a semi-autonomous system that supports estimation proactively, delivering consistent estimates and stronger sales framework alignment.
Upcoming Features: Self-Triggered Agents and Real-Time Insights
A key roadmap feature involves enabling agents to act proactively. Instead of waiting for a prompt, agents could be triggered by real events like a file drop in Slack or a new deal in HubSpot. This would allow estimation flows to start earlier with better timing and less manual coordination. Additionally, a system for real-time estimation summaries is being designed, evolving with context changes to avoid regenerating documents from scratch with each update.
Toward Proactive Workflows
With foundational elements like shared memory and intent detection in place, more autonomous agent behaviors are being developed. Eventually, Omega could surface insights independently, such as:
- Recommending module breakdowns upon new transcript logs.
- Highlighting missing assumptions in real-time.
- Suggesting reusable components based on past deals.
This progression moves Omega from a reactive assistant to a true workflow partner.
Long-Term Vision: An Autonomous Sales Assistant
The ultimate vision is a scalable AI product capable of autonomously handling bounded, high-value sales tasks, including:
- Initiating and completing estimation flows without prompts.
- Navigating ambiguity by asking the right questions.
- Seamlessly integrating AI into daily team tools.
While not yet realized, each design decision, agent interaction, and prototype test brings this vision closer.