Sales-agent compiler, versioning, outreach gate; fix tool replay

FeatureAIService
Ya
19 Julai 2026, 01:27 UTC
Mwandishi
Kamo
Ahadi ya
fb11991

Structured agent config compiles to the system prompt, freezes per published version, and gains the gate an agent must pass before initiating contact. Compiler - AgentConfig + SalesAgentCompiler: pure, deterministic compile of structured config into a sectioned prompt. Empty sections are omitted so a three-rule agent does not compile to a document that is mostly headings. - Section-level override ("write this part yourself") rather than a document-level raw-edit switch: an author gets full expressive power on one section while every other section keeps compiling, keeps its locked rules and keeps versioning. - That same mechanism makes migration byte-identical - a pre-config agent's prose is stored as a whole-document override and compiles back unchanged, so migration day is a no-op for agents already talking to customers. Proven by test. - PhraseBank is deliberately two dimensions, with the good prose on the TEMPLATE. A global bank keyed on every enum combination needs ~90 hand-written paragraphs, degenerates into stacked clauses, and would make every org open with the same sentence - which destroys the one thing an org is buying. - Six templates (front-desk and inbound-lead first: they are horizontal and cover any org whose vertical is not listed). Each ships locked compliance rules a model can never remove, verified by test. Lifecycle + authorization - Publish freezes {config, compiledPrompt, hash, model, provider}; rollback repoints and restores the draft so the studio can never show one thing while the agent serves another. - Controller is rights-gated for the first time. Previously ANY authenticated member of any org could rewrite what that org says to its customers. Falls back to MANAGE_AI_SETTINGS so no existing admin is locked out on deploy. - Public chat prefers the published version's frozen prompt over live trainingContext, and stamps salesAgentId/versionId on the session - the agent was already resolved there and was being discarded. - AI-assisted drafting: one sentence in, reviewable config out. Locked rules are carried over in code, never shown to the model, so a compliance line can never be deleted by instruction-following. Outreach gate (all 14 rules tested) - Opt-out beats every other check AND is reported as the reason, because the reason recorded against a refusal is itself the evidence. - SMS with no consent record is refused: under TCPA the burden of proof is on the sender, so absence of a record is absence of consent. - Quiet hours are judged where the CONTACT is, not where the business is. - Failed sends do not spend the touch budget; suppressed sends do not either, or one block would cascade into blocking everything after it. - The gate fails CLOSED - an outreach gate that errors open sends messages nobody authorized, the one failure here that cannot be undone. Fixes found along the way - Tool-call history replay was broken: the TOOL row persisted no content and the assistant tool_use turn was never persisted, so turn 2 sent a null-content blocks. Enabling tools would have failed every multi-turn conversation. - textComplete had no timeout (blocking .get(), pinning a thread on a slow provider) and recorded no usage, making every helper call invisible to billing. - System partition in context fitting was uncapped, so a verbose agent plus a RAG block could crowd out all history. - costEstimate is now populated on the sync path only, from real provider tokens. Streaming stays null: it fabricates tokens as content.length()/4 and multiplying that by a real price yields an invoice-shaped number that is wrong.

Mabadiliko yote

Je, unaona nini kuhusu usafiri?

Kila moja ya hizi updates ardhi katika nafasi yako ya kazi moja kwa moja. Kuanza bure na kuangalia kukua wiki baada ya wiki.

Kuwa Huru MileleMtazamo wa bei