AI Sales Agent CRM Architecture
Architecture case study · AI agent · CRM · Laravel · 2026
An evidence-first AI sales agent for CRM automation and conversation intelligence. The system turns deals, messages, calls and knowledge into reproducible context, keeps model inference separate from facts, and accepts output only after deterministic validation.
Core rule: the LLM proposes semantics. Deterministic code decides whether they are admissible. Invalid output is rejected, not silently repaired into a convenient answer.
The business problem: understand a deal without turning a hypothesis into fact
A manager works across amoCRM deal state, Wazzup conversations, tasks, calls and Yonote knowledge. A simple “send the chat to GPT and write the answer back” integration cannot establish which deal the conversation belongs to, what the model actually saw, why it reached a conclusion or whether an action is safe.
This system is therefore a production-oriented reasoning pipeline around real business data. It preserves provenance, freezes the source state, requires bounded evidence references and checks structured output against contracts before it can influence the workflow.
The evidence-first pipeline
Ingestion and normalization
amoCRM, Wazzup, call transcripts and Yonote become local records with source identity, time and provenance.
source evidenceEntity Resolution
Structured identifiers connect a messenger identity, CRM contact and active deal. Ambiguity remains an explicit result.
resolved · ambiguous · unresolvedImmutable Deal Context
Source watermarks and normalized records form a versioned, immutable Context Package.
snapshot · version · provenanceFact Extraction and Resolver
The model proposes facts, scenario, business goal, prerequisites and ownership through typed output with evidence references.
AI interpretationContracts and validation
Deterministic code verifies types, reference existence, completion validity, blockers and ownership.
accept or rejectClarification or action boundary
A missing critical fact is requested from a manager; external actions remain a separate, explicitly constrained boundary.
human-in-the-loop
Entity Resolution before reasoning
Resolved
Structured identifiers connect the communication to one CRM contact and deal. The basis for the decision is retained.
Ambiguous
Several candidates remain valid. The system does not pick the first convenient record and start reasoning from false certainty.
Unresolved
No supported link exists. This is an observable state, not an error to conceal with a model assumption.
Provenance
Resolution attempts retain their inputs and outcome, while sensitive identifiers are protected at rest.
Immutable context and reproducibility
The model does not reason directly over a continuously changing collection of API responses. Normalized deal state and source watermarks are frozen into a Context Package. New evidence creates a new version; an earlier AI result stays linked to the snapshot that produced it.
The audit trail retains the input package, raw provider response, mechanical normalization and accepted canonical result. A later review can distinguish changed business evidence from a changed interpretation.
The deterministic safety layer
- Nonexistent evidence reference → reject. A conclusion cannot cite an item absent from the frozen input.
- Wrong evidence type → reject. Every reference must match its source type and run-local alias.
- Unsupported completion → reject. Completion must satisfy the contract for the active goal.
- Invalid prerequisite → reject. A post-decision requirement cannot be promoted into a current blocker.
- Invalid ownership → reject. Ownership is derived from accepted prerequisite state rather than fluent prose.
Human-in-the-loop without replacing evidence
When the Resolver finds an unconfirmed critical prerequisite, deterministic eligibility is checked before a scoped question is sent to the manager. The answer becomes immutable human evidence, a new Context Package is built, and reasoning runs over the updated state.
Human assertion has bounded authority: it records what the manager stated but does not prove an unrelated technical event or complete a sales goal automatically. The clarification path is separately gated, rate-limited, deduplicated and audited.
Call and operational intelligence
Call intelligence
Original and normalized transcripts retain hashes, uploader/time provenance and revisions. Invalid imports enter quarantine; release into AI evidence is explicit.
Operational layer
The dashboard reports manager workload, overdue tasks, attention cases, clarification backlog and return-to-work observations without an LLM in the render path.
An operational observation is not a commercial conclusion. An overdue task may need attention, but it does not prove a customer refused or a deal was lost.
Authority model
| Layer | Authority |
|---|---|
| CRM / messenger / transcript records | Source evidence |
| Immutable Context Package | Reproducible evidence view |
| Fact Extraction / Resolver | AI interpretation |
| Contracts / validators | Structural acceptance |
| Manager Clarification | Explicit human assertion |
| Planner / Executor | Separate action boundary |
Current implementation status
| Capability | Status |
|---|---|
| amoCRM, Wazzup and Yonote synchronization | Implemented |
| Entity Resolution, Immutable Deal Context, timeline and provenance | Implemented |
| Fact Extraction and Scenario / Business Goal Resolver | Implemented; Resolver actively hardened |
| Typed evidence boundary and deterministic validation | Implemented; contracts evolve under control |
| Manager Clarification | Implemented with guarded pilot writes |
| Call transcript ingestion and operational dashboard | Implemented |
| General Action Planner | Not active |
| Autonomous customer-facing messaging | Not active |
Technology
Result
The architecture turns fragmented deal data into an inspectable AI reasoning process. The model helps interpret business state but does not gain authority to create CRM facts or perform unrestricted actions.
AI Agent · CRM Automation · Laravel · PostgreSQL · Redis · LLM · Evidence · Human-in-the-loop
