Skip to main content

Behavioral Annotations: Why readonly and destructive guide LLM Planning

Updated 4 min readMarkdown
Part of seriesAPCORE
Behavioral Annotations: Why readonly and destructive guide LLM Planning

In a previous post, we discussed how Schemas act as the "Postman" of the apcore ecosystem—ensuring that data is delivered in the correct format. But knowing how to deliver a message isn't enough for an autonomous Agent. The Agent also needs to know the Impact of the delivery.

Imagine an Agent tasked with "fixing a data inconsistency." It finds two modules: common.user.sync and executor.user.reset. Without behavioral context, the Agent might pick the reset module because it sounds more "thorough," not realizing it will delete the entire user profile.

This is why Behavioral Annotations are a core technical pillar of the apcore protocol. In this post, we explore how these simple boolean flags act as "Cognitive Stop Signs" for AI planners.


Syntax vs. Semantics

A schema handles the Syntax (Is it a string? Is it required?). Annotations handle the Semantics (Is it safe? Is it permanent?).

By providing this semantic layer, we move from "Code-Calling" to "Skill-Perceiving." The AI Agent no longer treats your modules as black boxes; it perceives their personality.


The Core apcore Annotations

The apcore protocol defines several standardized annotations that are mapped directly to LLM-readable hints:

  1. readonly: Tells the AI that this operation has no side effects. It’s safe to call during the discovery phase and safe to retry infinitely.

  2. destructive: The opposite of readonly. It warns the AI that data will be permanently modified or deleted.

  3. idempotent: Tells the AI that calling this module twice with the same inputs has the same effect as calling it once. This is critical for network reliability—the Agent knows it can safely retry a failed call.

  4. requires_approval: The ultimate safety valve. It tells the apcore Executor to pause and wait for a human "Yes" before proceeding.

  5. open_world: Informs the AI that this module interacts with systems outside your immediate control (e.g., sending an email or querying an external API).


Guiding the Agent's Brain

How does an LLM actually use these flags? It’s all about the Planning Phase.

When a sophisticated Agent (like those powered by Claude or GPT-4) receives a list of tools, it builds a "Plan of Action."

  • If it sees a module marked as destructive: true, the model's internal safety alignment often triggers a "Caution" state.

  • It might decide to check for a "Dry Run" flag first.

  • Or, it might generate a response to the user: "I have found a way to fix this, but it requires a destructive database operation. Do you want me to proceed?"

Without these annotations, the Agent is "blind." It executes the plan first and discovers the consequences later—which is usually too late.


Real-World Case: apexe

The power of automated annotations is a highlight of apexe, our tool for wrapping existing CLIs. When you run apexe scan git, it doesn't just extract the parameters. It uses pattern matching to classify the commands:

  • git status and git log are automatically marked as readonly: true.

  • git push --force and git reset --hard are marked as destructive: true.

By simply scanning your help text, apexe creates a "Safe Workspace" where an AI Agent can browse your repository without accidentally blowing up your production branch.


Conclusion: Professional Skills, Not Just Functions

Engineering for AI means engineering for Cognitive Safety. By using apcore Behavioral Annotations, you turn your raw functions into "Professional Skills." You give the AI the wisdom it needs to plan responsibly, reducing token waste and preventing Agentic disasters.

Next up: Context Object: State Management and Trace Propagation


GitHub: aiperceivable/apcore | Docs: apcore.aiperceivable.com

About the author

  • Build once, invoke by Code or AI. Where every interface is AI-perceivable by design. A schema-enforced module standard for the AI-Perceivable era.

No comments yet. Be the first to comment.

APCORE

Part 9 of 16

apcore is an AI-Perceivable module standard that makes every interface naturally perceivable and understandable by AI through enforced Schema definitions and behavioral annotations.

Up nextThe 11-Step Execution Pipeline: A Secured Journey for Every CallWhen an AI Agent calls a tool, we often think of it as a simple "request-response" event. But in the apcore world, every call is a mission-critical journey. Whether you are invoking a Python module or

More from this blog