Skip to content
CoRISE

Before Adding AI: Prepare APIs, Data, Authority and Auditability

Prepare boundaries that AI can use safely: business APIs, meaningful data, runtime authorization, action-bound approval and verifiable audit trails.

T. AsanoPublished Updated 17 min read
  • AI
  • API
  • Data
  • Identity
Open table of contents

Before connecting AI, examine the existing system

When adding generative AI or agents to business operations, it is tempting to begin with models, RAG, agent frameworks and tool calling. Integration often exposes problems further upstream: capabilities available only through screens, data accessible only with knowledge of internal schemas, inconsistent terminology, uncertain authoritative sources, permissions that APIs cannot enforce, and changes whose actors or outcomes cannot be traced.

People compensate with experience and organizational knowledge. Giving an agent broad credentials and the ability to act quickly can turn those ambiguities into unauthorized disclosure or incorrect operations. Natural-language ability does not replace missing business contracts or authorization.

An AI-ready architecture is not simply a connection from an LLM to an existing system. It provides boundaries that AI can use safely on the existing system’s side. This article examines APIs, data, authorization and audit. These are principles for incremental modernization, not a mandatory authentication product or deployment topology.

Scroll horizontally to view the complete diagram.

Connect model proposals through four system boundaries A trusted user or workload identity accompanies the model proposal. The executor applies API contracts, data meaning, authorization and audit before reaching existing domain services. Reads also require authorization; consequential actions add required approval.
Fig. 01 — Connect model proposals through four system boundaries
Read the diagram as text

A trusted user or workload identity accompanies the model proposal. The executor applies API contracts, data meaning, authorization and audit before reaching existing domain services. Reads also require authorization; consequential actions add required approval.

APIs — expose business capabilities, not screen procedures

Browser automation can connect systems without APIs. Being able to press a button, however, is different from having explicit execution conditions. Production callers need a machine-readable account of what can be done, with which inputs, by whom and in which state.

POST /orders/{id}/cancel expresses a narrower capability than POST /records/update. A specific name alone does not establish the boundary. The receiving system must validate the order’s tenant, cancellation state, treatment after shipping, and consequences for refunds or notifications.

Contract elementOrder cancellation example
Input and targetOrder ID, cancellation reason, expected order version
AuthorityCancellation permission for the tenant and order
PreconditionsBusiness-defined cancellable state, such as not yet shipped
Side effectsRelease inventory reservations; initiate refund or notification
OutcomeAccepted, processing, completed, denied or awaiting reconciliation
Retry behaviorOperation identity, status lookup and duplicate handling

Define input schemas, types, enumerations and stable errors, and enforce business invariants in the domain service. Well-typed arguments can still identify another tenant’s resource or request an invalid transition. A tool definition describes an interface; it is not itself the enforcement point for authorization or business rules.

Prefer capabilities whose authority can be constrained

Tools such as read_table, update_table and execute_sql offer flexibility while widening the internal knowledge and authority required. Narrowing update_customer to change_shipping_address makes it easier to constrain fields and consequences.

A refund workflow might separate calculation, request, approval and execution. Give a calculation an expiry and stated assumptions, then revalidate the amount and target before execution. An approved quote should not remain executable indefinitely under changed conditions.

Split capabilities where responsibility or authority differs. Excessive fragmentation can force the agent to reconstruct business consistency across many tools. Keep responsibility for a coherent business operation in the domain system, including coordination of its internal updates.

Separate reads and writes, and authorize both

Searching an order and executing a refund need not share credentials. OWASP’s AI Agent Security Cheat Sheet recommends least privilege per tool, separation of read/write and resource scopes, and independent validation for consequential operations. [1]

Reading is not automatically low risk. Payroll, contracts and bulk customer records can produce serious disclosure without modifying anything. Limit fields, result counts, search scope and destinations. Do not put authorization only on the write path.

OperationExample prerequisites for automation
Read an orderResource permission, necessary fields only, result limits
Calculate a refundAccess to the inputs, side-effect-free calculation, expiry
Execute a refundExecution permission, current-state checks, approval where required
Change permissions or send externallyTarget and destination restrictions, required independent approval, outcome confirmation

Decide automation policy using classification, amount, volume, reversibility and external consequences, not the verb alone. Verify that a tool described as read-only actually has the claimed behavior.

Retry without repeating the business operation

An invoice may be created even if the response is lost. Retrying as a new operation can create a second invoice. HTTP idempotency concerns the intended effect of repeated identical requests. A POST is not inherently idempotent, and a non-idempotent request should not be retried automatically without grounds for doing so safely. [2]

Persist an operation ID or idempotency key in a trusted execution component and reuse it for retries of that operation. Letting the model generate a fresh key on every attempt defeats duplicate suppression.

  • Scope keys to the relevant tenant and operation. Reject changed arguments under an existing key.
  • Avoid races between duplicate detection and mutation, using transactions or uniqueness constraints where applicable.
  • Distinguish processing, completed, failed and unknown outcomes, and provide status lookup.
  • Specify retention and retry windows. Do not blindly execute again as a new operation after a key expires.
  • If effects extend to payments or email, design downstream duplicate suppression and reconciliation too.

This is not a universal exactly-once guarantee. Where an external system lacks idempotency, stop automatic retries and reconcile or seek a human decision. Even when compensation is available, it may not restore the original state perfectly.

Scroll horizontally to view the complete diagram.

Preserve operation identity when responses are lost The executor persists an operation ID. The target authorizes and checks duplicates, then executes a new operation or returns existing status. A lost response remains unknown and is reconciled with the same ID. Retention, downstream effects and concurrency are part of the contract.
Fig. 02 — Preserve operation identity when responses are lost
Read the diagram as text

The executor persists an operation ID. The target authorizes and checks duplicates, then executes a new operation or returns existing status. A lost response remains unknown and is reconciled with the same ID. Retention, downstream effects and concurrency are part of the contract.

Data — establish meaning, responsibility and applicable time

Putting internal documents into a vector database does not establish their authority. Conflicting contract amounts in CRM, spreadsheets and accounting cannot be resolved by choosing the most semantically similar document. Assign responsibility by fact: contract management for agreed terms, accounting for invoiced amounts, and sales notes as supplementary context.

A source of truth does not require one database for the whole organization. It identifies which source determines which fact, for which business purpose and time. Define precedence, escalation to an owner, and conditions for withholding an answer when sources disagree.

A data contract can include metadata such as the following. This is illustrative: storing this YAML does not enforce access control.

resource: travel-policy
version: v2
owner: corporate-operations
source_system: policy-register
classification: internal
valid_from: 2026-04-01
valid_to: null
authority: approved-policy
access_policy_ref: employee-policy

Assign authority and access policy through a trusted registration and approval process, not a document’s self-description or model output. An approved source still requires separate checks for freshness, accuracy and permission to disclose.

An update timestamp does not fully describe “current”

A policy registered in March but effective in April is not the applicable March policy. A question about October 2025 needs the version valid then. Model business validity separately from creation and update timestamps, with clear time zones and interval boundaries.

Later corrections can also distinguish what was valid at a past date from what the system knew at that date. Where the business requires it, separate valid time and recorded time. Not every dataset needs a complex temporal model, but the time being answered must be clear.

Historical retention does not grant historical access rights. Authorize disclosure to the current requester even when the question concerns an old policy.

Design provenance together with updates and deletion

Make it possible to follow a claim to a retrieved chunk, document version, source system, transformation and responsible party. W3C PROV-O defines Entity, Activity and Agent, with relationships for generation, use, derivation and attribution. [3] Its vocabulary can inform which relationships to preserve without requiring an RDF implementation. “Agent” here means a responsible entity, not specifically an LLM agent.

Provenance does not establish truth. A citation is a route back to evidence. Revision, deletion or withdrawal must also propagate to chunks, indexes, caches and generated summaries. Track content updates and ACL changes separately, and observe their propagation lag.

Scroll horizontally to view the complete diagram.

Preserve provenance and propagate source changes Trace context through chunks, document versions and their source and owner. Evaluate validity, current access and authority before retrieval enters context. Propagate revisions, deletion and ACL changes to indexes and caches, and control citation access.
Fig. 03 — Preserve provenance and propagate source changes
Read the diagram as text

Trace context through chunks, document versions and their source and owner. Evaluate validity, current access and authority before retrieval enters context. Propagate revisions, deletion and ACL changes to indexes and caches, and control citation access.

Redacting an answer after unauthorized material has reached the model is too late to prevent that exposure. Filter retrieval using trusted identity and, where needed, recheck current permission at fetch time before placing permitted content into context. Define denial or suspension behavior when authorization cannot be established.

A shared cache that ignores tenant or permission context can leak content even when the original search was correct. Review citation access, exports and sharing of generated results. Revocation cannot reliably retrieve information already disclosed, making limits on collection and destinations essential.

Authorization — whose request, using whose authority?

Passing a user’s request directly to a powerful shared service account can expose resources the user cannot access. Distinguish the user, agent acting on their behalf, execution component and target resource.

For delegated operations, constrain effective authority to the intersection of what the user may delegate, what the agent may do, resource policy and runtime conditions. Handoffs to other agents must not expand that authority.

RFC 8693, OAuth Token Exchange, supports expressing delegation while distinguishing the subject from the acting party. Token exchange alone does not guarantee least privilege or revocation propagation. Revoking an original token does not generally revoke exchanged tokens as an intrinsic property of the protocol. [4]

RFC 9700 recommends minimum necessary token privileges and audience, resource and action restrictions enforced by the recipient. [5] A model-supplied user_id is not trusted delegation. Validate signatures, issuer, audience and validity as appropriate, and derive identity from authenticated execution context. Keep credentials out of the model context.

Give unattended agents an owner and bounded business authority

An overnight process may have no interactive user. Use a dedicated workload identity and explicit business permissions rather than attaching it to someone’s everyday account. Manage its owner, environment, deployment, tenant scope, tools, operating windows and volume or cost limits. A dedicated product branded “Agent Identity” is not a prerequisite.

Delegated and unattended operations have different authorization bases. Both need credential lifetime, rotation and shutdown paths, plus accountable ownership. Do not silently carry broad interactive privileges into a scheduled job.

Evaluate authority against execution-time state

A user may have access at 09:00, lose it at 09:30, and resume a pending operation at 10:00. Permission checked at the beginning of a conversation is insufficient. OWASP recommends denying by default and validating permissions on every request. [6]

Check current identity, delegation, policy and resource state near execution. Define acceptable staleness using mechanisms such as short-lived tokens, revocation information and authorization-cache expiry. Checking the same stale cache on every request does not propagate revocation.

State can still change between checking and mutation. Include expected versions or states in mutation conditions and re-evaluate conflicts. When atomicity across services is unavailable, specify the tolerated gap and compensation or stopping policy. Model confidence cannot resolve these races.

Separate authorization from human approval

A user may be allowed to delete production resources without wanting an agent to do so automatically. Authorization establishes the actor’s right to act; approval permits a particular proposed operation to proceed. The approver also needs authority to approve that operation.

Bind approval to the target, action, normalized arguments including amount or destination, requester, relevant resource version and expiry. Changed details invalidate the old approval. Check authenticity, replay and expiry, while retaining execution-time authorization. OWASP’s agent guidance and Transaction Authorization Cheat Sheet discuss binding approval to transaction details, enforcing it server-side and validating at the final execution gate. [1][7]

Scroll horizontally to view the complete diagram.

Bind approval to an exact action and revalidate at execution Check authenticated identity, delegation and resource scope. Where approval is required, bind it to the action, arguments, relevant resource version and expiry. Revalidate authority and approval at execution and re-evaluate changed state. Denied, revoked, expired or unknown conditions do not authorize execution.
Fig. 04 — Bind approval to an exact action and revalidate at execution
Read the diagram as text

Check authenticated identity, delegation and resource scope. Where approval is required, bind it to the action, arguments, relevant resource version and expiry. Revalidate authority and approval at execution and re-evaluate changed state. Denied, revoked, expired or unknown conditions do not authorize execution.

A stored conversational “yes” leaves unclear what was approved. Build the confirmation view from details fixed by the trusted execution component so that a person can compare the proposed action with what will actually execute. For consequential operations, consider separation between requester and approver and additional authentication.

External documents cannot change execution authority

Retrieved documents, email, web pages and tool results can contain attacker-controlled instructions. “Skip approval” or “act as administrator” in such material is external data, not a reason to change authorization policy.

Constrain tools, resources, destinations and execution volume outside the model, in addition to prompt-level guidance. [1] Well-typed requests can still form a dangerous combination, such as sending large quantities of confidential material to an otherwise permitted destination. Apply purpose-appropriate disclosure and egress controls. Deterministic policy is still only as correct as its rules and implementation.

Audit — record the operation, not just the conversation

“Renew the contract” followed by “Done” does not establish that anything changed. Preserve whose request was received, which agent and executor handled it, the policy and approval applied, the operation performed and its outcome. OWASP recommends structured records of authorization outcomes, approval identifiers, execution results and policy versions for high-risk actions. [1][8]

Useful fields include run and operation IDs, effective and acting principals, tenant, action and resource, policy version, authorization outcome, approval reference, tool version, event time and execution result. Model and deployment identifiers assist investigation but do not make nondeterministic output exactly reproducible. Preserve identifiers the provider exposes; do not invent inaccessible version information.

{
  "event_type": "operation.completed",
  "operation_id": "refund-1042",
  "principal": "user-42",
  "actor": "refund-agent-prod",
  "action": "issue_refund",
  "resource": "order-817",
  "amount": 5000,
  "currency": "JPY",
  "policy_version": "refund-v4",
  "authorization_decision_id": "decision-629",
  "approval_id": "approval-7821",
  "result": "completed",
  "provider_receipt": "receipt-903"
}

This is an event excerpt; production records also need time, tenant, schema version and other agreed fields. Derive completed from a confirmed execution or reconciliation result, not the model’s assertion. Use accepted for acceptance or unknown after an unresolved response loss, matching what is actually known.

Scroll horizontally to view the complete diagram.

Link proposals, decisions and outcomes as distinct evidence Correlate the proposal, authorization/approval and confirmed target outcome through operation identity. Persist and deliver audit events while observing gaps and delay. A conversational claim is not proof of success; unresolved outcomes remain unknown until reconciliation.
Fig. 05 — Link proposals, decisions and outcomes as distinct evidence
Read the diagram as text

Correlate the proposal, authorization/approval and confirmed target outcome through operation identity. Persist and deliver audit events while observing gaps and delay. A conversational claim is not proof of success; unresolved outcomes remain unknown until reconciliation.

Prevent missing evidence and excessive sensitive content

Decide what happens when audit persistence fails. Synchronous delivery to a central logging service is not always available. Durable local records or a transactional outbox can coordinate business state with events awaiting delivery. Detect missing, delayed and duplicate events. A high-risk operation may need to stop if no durable evidence can be recorded; that policy need not apply identically to every low-risk read.

Design access control, tamper detection, retention, clock handling and event deduplication. IDs alone do not establish completeness or authenticity. Avoid relying solely on records the application can freely erase. [8]

Conversely, recording all prompts, retrieved documents and tool inputs/outputs creates another sensitive repository. Exclude tokens and private keys, and prefer necessary resource references, versions, classifications and decision outcomes. IDs can themselves be personal data. Hashes are not universal anonymization: small sets of possible values can be guessed. Establish why each field is retained and who may read it.

Internal chain of thought is not required as an audit record. Preserve verifiable input references, system decision grounds, actions and outcomes. Where an explanation is required, record applied rules and source references. Treat generated explanations as supplementary material, separate from evidence of authorization or execution.

Use SQL and browser automation as deliberate adapters

Direct database access is not always inappropriate. Controlled analytics may benefit from read-only views, row/column authorization and query-time or cost limits. Exposing an internal schema as a contract nevertheless couples agents to implementation changes and can bypass business validation. Writes require particular care.

Browser automation can be useful for systems that cannot be changed. Add dedicated identities, restricted procedures, detection of screen/state changes, outcome reconciliation and approval for consequential actions at the adapter. An outer adapter cannot always guarantee atomicity or idempotency that the target system does not support.

Where the system is under your control, prefer a shared domain service for human interfaces, integrations and agents. Adapters that reshape inputs for AI are useful; duplicating business rules and authorization into a separate AI implementation is not.

Verify the boundary as a contract

Alongside AI evaluations of answer quality, increase the guarantees that can be checked independently of model output. These are proposed integration checks, not claims of completed production exercises on this page.

ConditionEvidence to seek
Another tenant’s resource IDReads and writes denied without unnecessary existence disclosure
Revocation while awaiting approvalResumption denied; stale token/cache tolerance is understood
Changed amount or destination after approvalApproval invalidated; re-evaluation and approval required
Concurrent retries of one operationDuplicate effects prevented within the declared window; status remains queryable
Lost response after external executionUnknown state retained; no blind repetition as a new operation
Document deletion and ACL changeUpdates reach indexes, caches and citation access paths
External content attempts to bypass approvalExecutor constraints hold regardless of the model’s proposal
Audit delivery stopsAgreed persistence, stopping and retry behavior works; gaps are detectable

Include authority changes, concurrency, communication failure and incomplete evidence. Assess whether necessary work is blocked excessively and whether escalated decisions stall, as well as whether unauthorized operations are denied.

Start with one business boundary, not a complete rewrite

Select a workflow and identify what it reads, changes and affects, together with responsible owners. One possible progression is constrained retrieval and proposals, followed by observed outcomes and denials, then approved mutations. Even an initial read-only stage needs an explicit disclosure scope.

This shares the approach of modernizing by placing a boundary around a legacy API: preserve valuable business knowledge while containing dependencies behind stable contracts. The related legacy API modernization case provides API and integration context; it does not establish that the AI integration or outcomes proposed here were delivered or measured in that engagement.

For the execution system above this boundary, see six designs for taking AI agents into production. This article focuses on existing-system contracts; that article connects authority, durable state, execution, observation, evaluation and recovery across the agent runtime.

Design the usable boundary before adding AI

Stable APIs, meaningful data and ownership, least privilege, audit, idempotency and explicit state are useful without AI. AI readiness makes assumptions previously supplied by human experience machine-checkable and enforceable.

After a model interprets natural-language intent, connect that proposal to a typed action, explicit target, current authority and verifiable result. Do not treat the proposal itself as permission or business correctness.

Build a boundary on the existing system’s side that AI can use safely. This goes beyond preparation for AI: it modernizes the system for future applications, integrations and automation too.

If the decision to delegate is still unclear, From Tacit Knowledge to AI Workflows uses observation to identify criteria, exceptions and human escalation conditions. Connect that decision structure to the execution boundaries described here.

References

  1. OWASP, AI Agent Security Cheat Sheet — pinned revision, repository snapshot 2026-07-30. Least privilege, independent execution controls, action-bound approval and structured audit.
  2. IETF, RFC 9110: HTTP Semantics, §9.2.2, June 2022. Idempotency and retrying non-idempotent requests. Operation IDs, retention and reconciliation in this article are application design examples.
  3. W3C, PROV-O: The PROV Ontology, Recommendation of April 30, 2013. Entity, Activity, Agent, derivation and attribution.
  4. IETF, RFC 8693: OAuth 2.0 Token Exchange, January 2020. Delegation, actors, exchange and limits of revocation propagation.
  5. IETF, RFC 9700: Best Current Practice for OAuth 2.0 Security, §2.3, January 2025. Minimum token privileges and audience, resource and action restrictions.
  6. OWASP, Authorization Cheat Sheet — pinned revision, repository snapshot 2026-07-30. Deny by default, authorization per request and server-side enforcement.
  7. OWASP, Transaction Authorization Cheat Sheet — pinned revision, repository snapshot 2026-07-30. Significant transaction details, invalidation after changes, final execution checks, expiry and replay protection.
  8. OWASP, Logging Cheat Sheet — pinned revision, repository snapshot 2026-07-30. Event attributes, sensitive-data exclusion, log protection and failure verification.

T. Asano

More articles by T. Asano

Contact

Tell us about your engineering challenge.

Talk with CoRISE about the design, implementation and operation of your systems.

Start a Conversation