apcore

Define once.
Govern every call.

An embeddable microframework for application capabilities. Define each capability’s contract and apply the same validation, access and approval rules when code or AI agents call it through apcore.

Python · TypeScript · Rust

Where apcore runs
Application codeDirect SDK call
Through an adapterMCP · A2A · CLI · HTTP
Inside your application
apcoreSchemas · Configured policy · Trace context
Your capabilitymath.add

What the runtime governs

The same execution boundary applies whether the call comes from your code or an adapter. Your application supplies caller identity and configures its policies.

  • Capability contract

    Give each module a description, input and output schemas, and behavioral annotations. The runtime validates arguments and results against the contract.

  • Access and approval

    Attach access rules using caller identity and install an approval handler for operations that require a decision before they run.

  • Execution pipeline

    Run module code through middleware and call-chain guards for nested calls, with a shared execution contract across Python, TypeScript, and Rust.

  • Execution evidence

    Inspect structured errors, trace context, and runtime events. Connect those signals to your application’s observability tools.

Try the runtime in your browser

Run the TypeScript SDK with sample data. Compare a valid call, a schema error, and the two outcomes of a configured approval gate.

Pass two numbers to math.add and inspect the returned sum.

{"a":10,"b":5}
Runtime outputapcore-js
Run the selected scenario to see the result.

Run your first module

Choose a language, install the SDK, and run the complete example locally. Once you see the expected output, connect the same module to MCP.

Open the SDK guide

SDK 0.33.0 · Stable example

Python 3.11+

Install
python3 -m pip install apcore==0.33.0
Save as add.py
from apcore import APCore

client = APCore()

@client.module(id="math.add", description="Add two numbers")
def add(a: int, b: int) -> dict:
    return {"sum": a + b}

print(client.call("math.add", {"a": 10, "b": 5}))
Run
python3 add.py
Expected output{'sum': 15}

Next step · Connect MCP

Documentation

Browse all docs

Detailed capabilities and configuration

Choose a topic

Module contracts

Give each module a stable ID, a description, and input and output schemas. Behavioral annotations such as readonly and requires_approval describe how callers should use it and can inform configured governance rules.