Skip to content
CLI & API / SDKs

SDKs

Markdown

Install and use the Atracode SDKs for Python, TypeScript, Go, Rust and C# to compile programs and read RAVEN hashes or refusals.

Preview. Atracode opens at launch, and the commands, tools and API shapes on this page may change before then.

Atracode has SDKs for Python, TypeScript, Go, Rust and C#. Each one wraps the same authenticated compiler API that the CLI and the MCP server use. The SDKs are published at platform launch; the shapes below are the preview interface.

How the SDKs work

Every SDK follows the same pattern:

  • The client reads your API key from the ATRACODE_API_KEY environment variable. Keys look like atc_live_xxxxxxxxxxxx. See Authentication.
  • compile sends a program to the hosted compiler. Each call counts as one compilation against your workspace quota.
  • The result has a status. A verified result carries the RAVEN hash, 64 hex characters that identify the program’s behavior. A refused result carries the file, line, column, reason and hint of the construct the compiler could not verify.

A refusal is a normal result, not an exception. Authentication failures, an exhausted quota and other problems that stop the call are reported as errors in each language’s usual way. Errors describes them.

Set the key before you run any of the examples:

export ATRACODE_API_KEY=atc_live_xxxxxxxxxxxx

Python

pip install atracode
from atracode import Client

client = Client()  # reads ATRACODE_API_KEY
result = client.compile("interest.py")
print(result.raven_hash)

TypeScript

npm install @atracode/sdk
import { Atracode } from "@atracode/sdk";

const client = new Atracode(); // reads ATRACODE_API_KEY
const result = await client.compile({ path: "src/main.ts" });
console.log(result.ravenHash);

Go

go get atracode.com/sdk-go
client := atracode.NewClient() // reads ATRACODE_API_KEY
res, err := client.Compile(ctx, "main.go")
if err != nil { log.Fatal(err) }
fmt.Println(res.RavenHash)

Rust

cargo add atracode
let client = atracode::Client::from_env()?; // reads ATRACODE_API_KEY
let res = client.compile("src/lib.rs").await?;
println!("{}", res.raven_hash);

C#

dotnet add package Atracode
var client = new AtracodeClient(); // reads ATRACODE_API_KEY
var result = await client.CompileAsync("Program.cs");
Console.WriteLine(result.RavenHash);

Verified and refused results

A compile result has the same fields in every SDK, in each language’s naming style (raven_hash in Python and Rust, ravenHash in TypeScript, RavenHash in Go and C#):

FieldWhen presentContents
statusAlwaysverified or refused
RAVEN hashVerified64 hex characters
refusalRefusedfile, line, column, reason and hint

For a verified program, the hash looks like this:

13803fe6908d64b3301b931688e6244c99d9b80f15c781f5de7581abb7c3d2af

For a refused program, the refusal holds the same information the CLI prints:

refused  rotate.sh:12:9  reads $(date), which differs on every run
  hint: pass the timestamp in as an argument and compile again

Check the status before you read the hash. In Python, for example:

result = client.compile("rotate.sh")
if result.status == "refused":
    r = result.refusal
    print(f"{r.file}:{r.line}:{r.column} {r.reason}")
    print(f"hint: {r.hint}")
else:
    print(result.raven_hash)

Next steps

  • Authentication API keys and how to keep them safe
  • Refusals What each refusal means and how to fix it
  • RAVEN What the hash identifies
  • Errors Failures that are not refusals
esc

Type to search titles, headings and text.