Building Production Coding Agents with Pi Framework for Sales Process Automation
tavon · Tech · 2026 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.5 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: Coding-agent-based sales process automation
Tavon needed to automate request-for-proposal handling for a parts-selling client without building one brittle monolithic workflow. Incoming emails needed to be routed to customer-specific agents, enriched with CRM/ERP data, kept in case sessions, and turned into editable draft responses while preserving security and human review.
Constraints:
- The field of coding-agent architecture is rapidly evolving, with few authoritative patterns.
- Customer-specific discounts, access, quirks, and response behavior vary enough that one generic agent would be hard to maintain.
- Agents need access to CRM and ERP data but should use interfaces that are easy for coding agents and safe for production systems.
- RFP/email cases span multiple interactions, so the system must reuse prior session context.
- Customer-facing emails carry business risk, so drafts should remain human-editable before sending.
- Coding agents with shell access require sandboxing and security controls that are still maturing.
Architecture
The system uses Pi/OpenClaw-style coding agents for a sales automation workflow. An inbox monitor detects incoming RFP-related emails. A gateway routes each email to the right customer-specific agent. Each agent combines a general agent harness/configuration with a customer-specific Markdown configuration containing quirks such as discounts or access. Case sessions are created or reused so follow-up emails retain context. Agents call CLI tools that expose CRM and ERP operations inside a sandbox, gather customer/product information, and generate a draft email. The human user stays in the familiar inbox, reviews or edits the draft, while an admin dashboard exposes sessions, tool calls, and traces.
Diagram confidence: reconstructed (reconstructed from prose).
flowchart LR email-inbox-monitor["Email inbox monitor"] --> gateway-router["Gateway router"] gateway-router --> openclaw-orchestration-layer["OpenClaw orchestration layer"] openclaw-orchestration-layer --> pi-agent-runtime["Pi agent runtime"] openclaw-orchestration-layer --> customer-specific-agent["Customer-specific agent"] pi-agent-runtime --> customer-specific-agent agent-harness-config["Agent harness config"] --> customer-specific-agent customer-config["Customer config"] --> customer-specific-agent customer-specific-agent --> session-store["Session store"] customer-specific-agent --> crm-cli-tools["CRM CLI tools"] customer-specific-agent --> erp-cli-tools["ERP CLI tools"] crm-cli-tools --> sandbox["Sandbox"] erp-cli-tools --> sandbox customer-specific-agent --> email-draft-interface["Email draft interface"] email-draft-interface --> human-sales-user["Human sales user"] session-store --> admin-dashboard["Admin dashboard"] event-stream["Event stream"] --> admin-dashboard pi-agent-runtime --> event-stream
Components
| Component | Role | Interacts with |
|---|---|---|
Email inbox monitor |
Watches the sales inbox for incoming RFP or sales-process emails. | Gateway router, Email draft interface |
Gateway router |
Classifies relevant emails and routes each case to the appropriate customer-specific agent. | Email inbox monitor, Customer-specific agent, OpenClaw orchestration layer |
OpenClaw orchestration layer |
Provides multi-channel routing, provider orchestration, sub-agent support, gateway support, and embedded Pi sessions. | Gateway router, Pi agent runtime, Customer-specific agent |
Pi agent runtime |
Core agent loop, session support, event system, coding-agent runtime, LLM abstraction, and terminal/UI extension mechanics. | OpenClaw orchestration layer, Customer-specific agent, Session store, Event stream |
Customer-specific agent |
Per-customer agent configured with general harness instructions and customer-specific rules for RFP handling. | Gateway router, Agent harness config, Customer config, Session store, CRM CLI tools, ERP CLI tools, Email draft interface |
Agent harness config |
General role, harness, and instructions describing how the agent should use systems and react to inputs/outputs. | Customer-specific agent |
Customer config |
Customer-specific Markdown/configuration for discounts, access, quirks, requirements, and communication preferences. | Customer-specific agent |
Session store |
Creates and reuses sessions per case so prior email context and agent actions are retained. | Pi agent runtime, Customer-specific agent, Admin dashboard |
CRM CLI tools |
Small command-line tools that expose contact and customer data to coding agents. | Customer-specific agent, Sandbox |
ERP CLI tools |
Small command-line tools that expose product, inventory, pricing, and order-system data. | Customer-specific agent, Sandbox |
Sandbox |
Execution boundary for coding-agent tools and sensitive data access. | CRM CLI tools, ERP CLI tools, Customer-specific agent |
Email draft interface |
Keeps humans in their inbox by placing generated draft responses where they can review, edit, and send. | Email inbox monitor, Customer-specific agent, Human sales user |
Human sales user |
Reviews, edits, and approves draft emails while staying in the email workflow. | Email draft interface, Admin dashboard |
Admin dashboard |
Shows cases, sessions, tool calls, results, and generated draft traces for monitoring and troubleshooting. | Session store, Event stream, Human sales user |
Event stream |
Streams agent events, tool-call status, and results for UI updates and observability. | Pi agent runtime, Admin dashboard |
Data flow
An email arrives in the monitored inbox. The gateway classifies whether the email matters and routes it to a customer-specific agent. The system associates the email with an existing case/session or creates a new session. The agent reads its general harness and customer-specific configuration, then loops through CLI tool calls to CRM and ERP systems to gather contact, pricing, inventory, or case details. Tool events and results stream back through Pi/OpenClaw session mechanics. The final output is a draft email placed in the user's email workflow, with underlying session traces available for debugging.
6 supporting quotes
Why this architecture
The architecture follows the principle of making systems easy for coding agents. Rather than complex bespoke integrations, CRM and ERP access are exposed as focused CLI tools that agents can compose. Customer-specific agents isolate variation by customer, while sessions preserve continuity across sales cases. OpenClaw adds production coordination around Pi's minimal agent/session/runtime mechanics. Human draft review reduces customer-facing risk while still automating data gathering and response drafting.
5 supporting quotes
Models used: LLM agent · Pi agent core · Pi coding agent · unified LLM abstraction
Scale
- The company describes itself as a small European company building agents for organizations.“we're creating a small company uh Seven AI. We're building agents for organizations. Small out of Europe”transcript, stated
- The implementation was built for a client sales process involving requests for proposals for parts.“And this is one of the applications we've been building for a client and basically the use case is a sales process.”transcript, stated“They get requests for proposals of of an ordering another another system, right? parts. parts being sold by that company.”transcript, stated
- The system runs multiple threads and multiple agents in a multi-channel environment rather than a single coding-agent session.“a multi-channel uh environment where uh we have um you know, multiple threads going on, multiple agents going on.”transcript, stated
- The inbox contains many emails, most ignored, with relevant emails associated to cases and agent sessions.“it's one of one of many emails. Most of them are ignored, but this one is like the the the LM call said, "Okay, I'm I'm interested in this."”transcript, stated
Alternatives considered (roads not taken)
A single general sales/RFP agent
Rejected because: Customer-specific quirks, access, discounts, and instructions are better isolated in one agent/configuration per customer.
Direct complex integrations for backend systems
Rejected because: The team chose small CLI tools because coding agents are good at composing command-line utilities.
Automatically send sales emails
Rejected because: The system generates drafts for humans to review and edit in their existing inbox rather than sending directly.
Rely on Pi alone as a single-session coding-agent environment
Rejected because: Production use needed OpenClaw's multi-channel routing, provider orchestration, sub-agent, gateway, and plugin support layered around Pi.
Patterns
tool-use-orchestration (coding-agent-tools)
The system exposes CRM and ERP functions as CLI tools so coding agents can call and compose them inside their loop.
multi-agent-orchestration (routing)
A gateway routes emails to multiple customer-specific agents, with OpenClaw adding routing, provider orchestration, sub-agent, and gateway support around Pi.
agent-memory (state)
Each case is associated with a reusable Pi/OpenClaw session so later emails preserve prior discussion and tool-call context.
human-in-the-loop-gate (approval)
The agent produces draft emails for the user to edit and approve rather than sending customer-facing responses automatically.
observability-tracing (operations)
Session events, tool-call streams, admin dashboard views, and case association make the agent's actions inspectable.
privacy-preserving-processing (security)
The team exposes data through CLIs inside its own sandbox and explicitly calls out security/sandboxing as an evolving requirement.
Tradeoffs
Expose business systems through CLI tools
Chose Small command-line tools for CRM/ERP access over Complex bespoke interfaces that are harder for coding agents to use.
Rationale: The speaker argues coding agents are good at CLIs and that Unix-style small tools compose well for agent workflows.
Keep users in email
Chose Generated drafts in the existing inbox over A new primary sales-agent UI for day-to-day users.
Rationale: Users can stay in the email environment they already use, while the dashboard remains mostly for administration and tracing.
Layer OpenClaw on Pi
Chose OpenClaw production plugins around Pi core mechanics over Using only a single Pi coding-agent session.
Rationale: The sales system needed multiple channels, threads, providers, subagents, and gateway routing beyond Pi's minimal core.
Use draft generation instead of full automation
Chose Human-editable responses over Autonomous outgoing sales emails.
Rationale: The source does not claim the system is safe enough for autonomous customer communication, so human review contains business risk.
Gotchas (what bit them)
Coding-agent patterns are still unstable.
Root cause: The speaker says the field lacks authoritative resources and that the same talk would likely change within weeks.
Resolution: Use minimal frameworks like Pi for tinkering and keep architecture flexible as patterns emerge.
Shell-access agents need deliberate security and sandboxing.
Root cause: Coding agents can execute tools and access business data, making open-shell policy and sandbox boundaries central to deployment risk.
Resolution: Run CRM/ERP CLIs inside a sandbox and continue evaluating open-shell security approaches.
One customer-facing sales agent would mix too many customer-specific rules.
Root cause: Customers differ by discounts, access, quirks, and how systems should be used or responses handled.
Resolution: Use one agent per customer with a general harness plus customer-specific configuration.
Without sessions, follow-up emails lose sales-case context.
Root cause: RFP cases involve back-and-forth communication and prior tool results.
Resolution: Associate each case with an agent session and reuse it for later messages.
Evaluation
The source demonstrates behavior through a running dashboard/email demo, session association, visible tool-call traces, and draft outputs, but does not describe a formal eval suite or quantitative accuracy metrics.
Metrics: Whether an incoming email is classified as relevant. · Whether the email is associated with the correct case/session. · Tool-call traces and returned results visible in the admin dashboard. · Whether the final draft email is usable and human-editable. · Sandbox/security posture for CLI tools.
4 supporting quotes
Outcomes
- Tavon built a client-facing sales automation system that monitors email, routes RFPs, creates/reuses sessions, queries CRM/ERP tools, and generates draft emails.
- The case demonstrates a per-customer agent pattern for managing customer-specific business rules.
- The implementation uses coding-agent-friendly CLI tools, sandboxing, and admin trace visibility.
- The source positions coding agents as a future core building block while acknowledging that patterns and security practices are still emerging.
The source describes a working client application but does not provide counts for RFP volume, customers, accuracy, or time saved.