USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeAll BooksAI Agent Book
HomeAI Agent BookThe AI Harness
PreviousEngineer Context and Version Prompt AssetsNextBuild the State Store, Memory Lifecycle, and Compaction
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

10 sections

Progress0%
1 / 10

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

Build a Tool Registry and Policy Engine

A tool registry describes available capabilities; a policy engine decides whether a specific actor may execute a specific call in current context. Keep discovery, model selection, authorization, approval, execution, and verification separate. The model can choose among visible tools, but it cannot grant itself a tool, tenant scope, credential, or exception.

What will you be able to do?

You will define tool and policy contracts, filter the visible tool set, and enforce allow, deny, or approval decisions at execution time.

What should a tool specification contain?

python
from dataclasses import dataclass from typing import Literal @dataclass(frozen=True) class ToolSpec: name: str version: str risk: Literal["read", "write", "destructive", "external"] permission: str timeout_seconds: int idempotent: bool requires_approval: bool input_schema_hash: str output_schema_hash: str

Keep handlers in the registry by internal reference; do not serialize code into model context.

What should policy return?

python
@dataclass(frozen=True) class PolicyDecision: effect: Literal["allow", "deny", "require_approval"] reason_code: str policy_version: str constraints: tuple[str, ...] = ()

Inputs include authenticated identity, tenant, tool/version, normalized arguments, resource attributes, data classification, environment, and current approval. Outputs must be explainable and auditable.

Where should policy run?

  1. Before the run, filter tools that can never apply.
  2. On every proposed call, evaluate exact arguments and current context.
  3. Before commit, re-evaluate stale/changed resources.
  4. After execution, verify result constraints and record evidence.

SDK guardrails, permissions, and hooks can enforce local pieces; the central harness policy keeps business rules consistent across providers.

Failure injection: Change an argument after approval but before execution. The proposal hash and policy engine must reject the call.

How do you prove the policy engine works?

Use table-driven tests for actors, tenants, tools, risk, environments, approval state, and time. Add deny-by-default and unknown-version tests. Run the same policy suite through both provider adapters.

What mistakes should you avoid?

  • Treating tool visibility as authorization.
  • Allowing unversioned tool schemas.
  • Encoding business policy only in provider-specific prompts.
  • Returning vague deny reasons that operators cannot diagnose.
  • Allowing policy service failure to default to allow.

Check your understanding

  1. What is the difference between registry and policy?
  2. Why evaluate policy more than once?
  3. Which policy inputs must never come from model claims?

Expert extension

Implement a table-driven policy evaluator and prove with property tests that unknown tools, schemas, tenants, or actors always deny.

Official references

  • OpenAI tools guide
  • Claude Agent SDK permissions