Naming Conventions
Python usessnake_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
- TypeScript
Python supports three calling styles:
Async Patterns
Python’sasyncio and TypeScript’s Promise model have significant differences that affect how Attesta works in each language.
- Python
- TypeScript
The Python SDK supports both sync and async functions. When a sync function is decorated with The
@gate, Attesta internally bridges to async using asyncio.run() or schedules a task if a loop is already running (e.g., Jupyter).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
- Python
- TypeScript
from_config() is synchronous and returns an Attesta instance directly.Evaluate API
Theevaluate() method is available on both SDKs and runs the full approval pipeline without raising AttestaDenied. The caller is responsible for checking the verdict.
- Python
ActionContextuses 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 accessesresult.riskAssessment.
Custom Implementations
Both SDKs use structural typing for pluggable components (scorers, renderers, loggers), but the mechanism differs.- Python
- TypeScript
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.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.
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