# SDKs

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

> Preview: the commands, tools and API shapes on this page may change before launch.

Source: https://atracode.com/docs/sdks

Atracode has SDKs for Python, TypeScript, Go, Rust and C#. Each one wraps the same authenticated compiler API that the [CLI](/docs/cli) and the [MCP server](/docs/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](/docs/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](/docs/errors) describes them.

Set the key before you run any of the examples:

```shell
export ATRACODE_API_KEY=atc_live_xxxxxxxxxxxx
```

## Python

```shell
pip install atracode
```

```python
from atracode import Client

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

## TypeScript

```shell
npm install @atracode/sdk
```

```ts
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

```shell
go get atracode.com/sdk-go
```

```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

```shell
cargo add atracode
```

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

## C#

```shell
dotnet add package Atracode
```

```csharp
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#):

| Field | When present | Contents |
| --- | --- | --- |
| status | Always | `verified` or `refused` |
| RAVEN hash | Verified | 64 hex characters |
| refusal | Refused | file, line, column, reason and hint |

For a verified program, the hash looks like this:

```text
13803fe6908d64b3301b931688e6244c99d9b80f15c781f5de7581abb7c3d2af
```

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

```text
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:

```python
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](/docs/authentication): API keys and how to keep them safe
- [Refusals](/docs/refusals): what each refusal means and how to fix it
- [RAVEN](/docs/raven): what the hash identifies
- [Errors](/docs/errors): failures that are not refusals
