Skip to main content
Attesta provides full implementations in both Python and TypeScript. The two SDKs share the same approval pipeline, risk scoring logic, and audit format, but differ in naming conventions and language-specific patterns. This page documents every significant difference.

Naming Conventions

Python uses snake_case for all identifiers. TypeScript uses camelCase for properties and methods, and PascalCase for types and classes.

Gate Syntax

The @gate decorator in Python has no direct equivalent in TypeScript. Instead, TypeScript uses gate() as a higher-order function.
Python supports three calling styles:

Async Patterns

Python’s asyncio and TypeScript’s Promise model have significant differences that affect how Attesta works in each language.
The Python SDK supports both sync and async functions. When a sync function is decorated with @gate, Attesta internally bridges to async using asyncio.run() or schedules a task if a loop is already running (e.g., Jupyter).
The sync_timeout parameter (default 300s) controls how long Attesta waits when bridging from sync to async.
In TypeScript, if you wrap a synchronous function with gate(), it is automatically treated as an async function. The return type becomes Promise<T> regardless of the original function’s return type.

Configuration Loading

from_config() is synchronous and returns an Attesta instance directly.

Evaluate API

The evaluate() method is available on both SDKs and runs the full approval pipeline without raising AttestaDenied. The caller is responsible for checking the verdict.
Key differences:
  • Python ActionContext uses keyword arguments to the constructor; TypeScript uses an object literal matching the interface shape.
  • Python uses == for enum comparison; TypeScript uses ===.
  • Python accesses result.risk_assessment; TypeScript accesses result.riskAssessment.

Custom Implementations

Both SDKs use structural typing for pluggable components (scorers, renderers, loggers), but the mechanism differs.
Python uses Protocol classes with @runtime_checkable. Any object with the right methods satisfies the protocol — no inheritance needed.

Error Handling


Feature Parity

Most features are available in both SDKs. The table below documents known differences as of v0.1.x.
Even if you are building a TypeScript project, you can install the Python package (pip install attesta) to use the attesta CLI for audit verification, trust management, and MCP wrapping. The CLI operates on the shared .attesta/ data directory and attesta.yaml config file.

Audit Log Compatibility

Both SDKs use hash-chained JSONL audit logs, but the serialized field names differ (snake_case in Python, camelCase in TypeScript). Do not mix Python- and TypeScript-produced entries in the same file if you need chain verification to pass.
For now, pick one SDK as the writer for a given audit log file. Cross-SDK mixed logs can break hash-chain verification.

Next Steps

TypeScript Getting Started

Install and configure the TypeScript SDK

Attesta Class

Full API reference for the Attesta class

Protocols

Implement custom scorers, renderers, and loggers

Vercel AI SDK

TypeScript-native Vercel AI integration