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.

5 layersseparate evidence, inference, validation, human input and actions
3 outcomesresolved, ambiguous or unresolved entity matching
No guessingwhen a conversation cannot be tied to one deal
Read-firstreasoning remains separate from external writes

Core rule: the LLM proposes semantics. Deterministic code decides whether they are admissible. Invalid output is rejected, not silently repaired into a convenient answer.

Evidence-first AI Sales Agent architecture: sources, immutable context, AI resolver, validation and controlled actions
From CRM evidence to controlled output: every AI result is attributable to an exact version of its source state.

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

  1. Ingestion and normalization

    amoCRM, Wazzup, call transcripts and Yonote become local records with source identity, time and provenance.

    source evidence
  2. Entity Resolution

    Structured identifiers connect a messenger identity, CRM contact and active deal. Ambiguity remains an explicit result.

    resolved · ambiguous · unresolved
  3. Immutable Deal Context

    Source watermarks and normalized records form a versioned, immutable Context Package.

    snapshot · version · provenance
  4. Fact Extraction and Resolver

    The model proposes facts, scenario, business goal, prerequisites and ownership through typed output with evidence references.

    AI interpretation
  5. Contracts and validation

    Deterministic code verifies types, reference existence, completion validity, blockers and ownership.

    accept or reject
  6. Clarification 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

LayerAuthority
CRM / messenger / transcript recordsSource evidence
Immutable Context PackageReproducible evidence view
Fact Extraction / ResolverAI interpretation
Contracts / validatorsStructural acceptance
Manager ClarificationExplicit human assertion
Planner / ExecutorSeparate action boundary

Current implementation status

CapabilityStatus
amoCRM, Wazzup and Yonote synchronizationImplemented
Entity Resolution, Immutable Deal Context, timeline and provenanceImplemented
Fact Extraction and Scenario / Business Goal ResolverImplemented; Resolver actively hardened
Typed evidence boundary and deterministic validationImplemented; contracts evolve under control
Manager ClarificationImplemented with guarded pilot writes
Call transcript ingestion and operational dashboardImplemented
General Action PlannerNot active
Autonomous customer-facing messagingNot active

Technology

BackendLaravel 13 · PHP 8.4 · structured AI outputs
DataPostgreSQL 17 · Redis · immutable evidence
InterfaceVue 3 · Inertia
IntegrationsamoCRM · Wazzup · Yonote · LLM relay
OperationsDocker · Caddy · queues · scheduler · private networks

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.

Public architecture on GitHub →

AI Agent · CRM Automation · Laravel · PostgreSQL · Redis · LLM · Evidence · Human-in-the-loop