USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeAll BooksPostgreSQL Book
HomePostgreSQL BookAI-Native PostgreSQL
PreviousRetrieval Authorization and Tenant IsolationNextSafe Text-to-SQL and Database Agents
AI NOTICE: This is the table of contents for the SPECIFIC CHAPTER only. It is NOT the global sidebar. For all chapters, look at the main navigation.

On this page

14 sections

Progress0%
1 / 14

Muhammad Usman Akbar Entity Profile

Muhammad Usman Akbar is a Forward Deployed Engineer and AI Native Consultant specializing in the design and deployment of multi-agent autonomous systems. Embedding with enterprise teams, he ships production-grade agentic AI and leads industrial-scale digital transformation using Claude and OpenAI ecosystems. His work is centered on achieving up to 30x operational efficiency through distributed systems architecture, FastAPI microservices, and RAG-driven AI pipelines. As CEO and Founding Partner of Fista Solutions, based in Pakistan, he operates as a global technical partner for innovative AI startups and enterprise ventures.

USMAN’S INSIGHTS
AI ARCHITECT

Transforming businesses into autonomous AI ecosystems. Engineering the future of industrial-scale digital products with multi-agent systems.

30X Growth
AI-First
Innovation

Navigation

  • Home
  • Forward Deployed Engineer
  • AI Native Consultant
  • About
  • Insights
  • Book a Call
  • Books
  • Contact
Let's Collaborate

Have a Project in Mind?

Let's build something extraordinary together. Transform your vision into autonomous AI reality.

Start Your Transformation

© 2026 Muhammad Usman Akbar. All rights reserved.

Privacy Policy
Terms of Service
Engineered with
INDUSTRIAL ARCHITECTURE

Conversation Memory, Model Tools, and Human Approvals

AI memory is governed data selected for a purpose, not an unlimited transcript. Tools are application-owned capabilities with typed inputs, narrow permissions, limits, and audit. Consequential actions become proposals that a policy or authorized human approves before idempotent execution. PostgreSQL stores state, provenance, retention, decisions, and outcomes; the model never grants itself authority.

What will you be able to do?

  • Separate short-term context, durable facts, summaries, and procedural memory.
  • Define semantic tools instead of arbitrary database access.
  • Model proposal → approval → execution as a state machine.
  • Enforce idempotency, expiry, retention, and audit.

Prerequisites and mental model

Memory types:

  • working context: bounded messages for the current turn;
  • durable user/business fact: verified source with update/delete policy;
  • semantic memory: retrievable source-derived content;
  • episodic audit: what happened and why;
  • procedural memory: versioned instructions/workflows.

Never convert a model inference into a durable customer fact without validation and provenance.

How should tools and approvals be modeled?

A tool definition names capability, input schema version, required permission, maximum scope, timeout, idempotency behavior, and output schema. A request creates tool_proposals; policy may auto-deny, auto-approve low-risk actions, or await a human. Execution verifies proposal version, approval, actor, expiry, current authorization, and target version inside a short transaction.

Unique (organization_id, idempotency_key) plus a request hash prevents duplicate effects. Audit rows record proposal, model/prompt, evidence, approver, policy version, executor, database outcome, and external-effect reference.

Why is this AI-native?

The system is designed around probabilistic proposals and deterministic authority. A model can draft a reply or suggest priority; it cannot bypass tenant policy, approve its own refund, or rewrite audit history. Memory quality and tool success become evaluated data products.

Prove it worked

Test duplicate execution, expired approval, revoked approver, changed ticket version, cross-tenant target, malformed model output, executor crash, and external timeout. Only one allowed effect may commit, and every denial must be auditable without logging unnecessary sensitive content.

Production judgment

  • Summaries can lose negation or attribution; preserve sources and re-summarize by version.
  • Retention/deletion must propagate to derived memory.
  • Human approval UI must show exact proposed effect and evidence, not only model prose.
  • Tool catalogs are security APIs requiring change review.

Common mistakes

  • Transcript grows forever: no purpose/retention → compact with lineage and delete policy.
  • Approval replays after change: no target version/expiry → bind approval to immutable proposal and current-state check.
  • Tool called twice: no idempotency → unique key and stored outcome.

AI Pair-Programmer Prompt

text
Design this AI memory/tool workflow as governed PostgreSQL state. Identify purpose, scope, source/provenance, tenant, retention/deletion, schema versions, permissions, proposal states, approval policy/actor/expiry, target version, idempotency, transaction, external effects, crash recovery, audit, and negative tests. The model cannot self-authorize.

Hands-on exercise

Model a “draft and send customer reply” workflow where drafting is automatic but sending needs an agent.

Acceptance criterion: stale/edited drafts require reapproval, duplicate sends are impossible or idempotent, and approval shows exact content/recipient/source citations.

Knowledge check

  1. Why is a full transcript not automatically memory?
  2. What must an approval bind to?
  3. Who owns tool authority?

Answers

  1. Memory needs purpose, scope, provenance, selection, retention, and deletion rules.
  2. An immutable proposal, exact effect/target version, actor, policy, and expiry.
  3. Deterministic application policy and authorized principals—not the model.

Completion checklist

  • Memory is scoped, sourced, and deletable.
  • Tools are typed and least-privileged.
  • Approval is immutable, current, and auditable.
  • Execution is idempotent and crash-tested.

Primary references

  • PostgreSQL transactions
  • Privileges
  • Explicit locking