> ## Documentation Index
> Fetch the complete documentation index at: https://hexelstudio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get started with the Hexel TypeScript SDK in five minutes.

**What you'll accomplish:** by the end of this page you'll have initialized the client, run code in a sandbox, managed an agent instance, submitted an orchestration task, and executed a tool.

This quickstart covers running code in a sandbox, managing agent instances, submitting an orchestration task, and executing a tool.

## Initialize

```typescript theme={"dark"}
import { Hexel } from "hexel-sdk";

const client = new Hexel({ apiKey: "YOUR_API_KEY" });
```

## Run code in a sandbox

```typescript theme={"dark"}
const sandbox = await client.compute.sandbox.create({ tier: "standard" });

const result = await client.compute.sandbox.execute(sandbox.sandbox_id, {
  code: "print('Hello from Hexel')",
  language: "python",
});
console.log(result);

await client.compute.sandbox.release(sandbox.sandbox_id);
```

## Deploy an agent instance

Deploying is done via the REST API or the `hexel` CLI. The TypeScript SDK manages instances after deployment.

<Tabs>
  <Tab title="CLI">
    ```bash theme={"dark"}
    hexel compute instance deploy YOUR_AGENT_ID --env-file .env
    ```
  </Tab>

  <Tab title="curl">
    ```bash theme={"dark"}
    curl -X POST https://api.hexelstudio.com/compute/v1/agents/YOUR_AGENT_ID/instances \
      -H "Authorization: Bearer $TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"env": {"MODEL": "gpt-4"}}'
    ```
  </Tab>
</Tabs>

Once deployed, manage instances with the SDK:

```typescript theme={"dark"}
// List running instances
const instances = await client.compute.instance.list("YOUR_AGENT_ID");

// Get instance details
const instance = await client.compute.instance.get("YOUR_INSTANCE_ID");
console.log(instance.endpoint);

// Redeploy with updated config
await client.compute.instance.redeploy("YOUR_INSTANCE_ID");

// Stop an instance
await client.compute.instance.stop("YOUR_INSTANCE_ID");
```

## Submit an orchestration task

```typescript theme={"dark"}
const task = await client.orchestrator.task.create({
  fleet_id: "YOUR_FLEET_ID",
  environment_id: "YOUR_ENVIRONMENT_ID",
  workspace_id: "YOUR_WORKSPACE_ID",
  input: "Summarize this week's support tickets",
});

console.log(task.id);
```

## Execute a tool

In the TypeScript SDK, tools are accessed via `client.orchestrator.tools`:

```typescript theme={"dark"}
const result = await client.orchestrator.tools.execute("SLACK_POST_MESSAGE", {
  input: { channel: "#alerts", text: "Deploy complete" },
});
console.log(result);
```

## Next steps

<CardGroup cols={2}>
  <Card title="Resources" icon="cubes" href="/docs/sdks/typescript/resources">
    Every client and method.
  </Card>

  <Card title="Error Handling" icon="triangle-exclamation" href="/docs/sdks/typescript/error-handling">
    Retries, timeouts, and errors.
  </Card>

  <Card title="Examples" icon="code" href="/docs/sdks/typescript/examples">
    End-to-end examples.
  </Card>

  <Card title="Authentication" icon="key" href="/docs/getting-started/authentication">
    Credentials and tokens.
  </Card>
</CardGroup>
