# Set up an SDK project

> Create a minimal TypeScript package that the managed builder can validate, reproduce, and deploy.

## Before you begin {#before-you-begin}

Choose one package kind and obtain a deployment key. The archive contains source and immutable configuration only—never Credentials, `.env`, `node_modules`, generated output, or lifecycle scripts.

## Steps {#steps}

1. Install the SDK. The package manager records the resolved dependency in your lockfile:

   ```sh
   npm install @constal/sdk
   ```

2. Add one root manifest:

   ```json constal.agent.json
   {
     "schemaVersion": 2,
     "kind": "agent",
     "id": "support-agent",
     "namespace": "default",
     "version": "1.0.0",
     "entry": "src/index.ts",
     "mode": "script",
     "bindings": {
       "model": "crn:constal:production:acme:default:model/support"
     },
     "policies": [],
     "tools": [],
     "limits": { "maxRunMicroUsd": 100000, "maxTurns": 8 },
     "expectedCurrentDeploymentRevision": null
   }
   ```

3. Export the matching definition:

   ```ts src/index.ts
   import { agent } from "@constal/sdk";

   export default agent({
     id: "support-agent", version: "1.0.0", model: "model",
     async onMessage(message, ctx) {
       const turn = await ctx.turn({ system: "Help the caller.", objective: message });
       return turn.message.content;
     },
   });
   ```

   Other root manifests are `constal.channel.json`, `constal.auth-provider.json`, `constal.policy.json`, and `constal.credential-provider.json`. Identity, entrypoint, Resource bindings, and Policy attachments must agree with the exported definition.

4. Package and upload:

   ```sh
   zip -r support-agent.zip constal.agent.json package.json src
   curl https://platform.constal.ai/v1/deployments \
     -H "Authorization: Bearer $CONSTAL_DEPLOYMENT_KEY" \
     -H "Idempotency-Key: support-agent-1.0.0" \
     -H "Content-Type: application/zip" \
     --data-binary @support-agent.zip
   ```

## Verify {#verify}

Poll `GET /v1/deployments/:deploymentId`. Success records the Resource identity, immutable deployment revision, executable artifact, code digest, and probe outcome. Confirm that version, bindings, and Policies match the archive. A public Git repository pinned to a full commit enters the same build path through the Console.

## Next steps {#next-steps}

Follow [Build an Agent](/docs/sdk/agents.md), [Build a Channel and Auth Provider](/docs/sdk/channels-and-auth.md), or [Build a Credential Provider](/docs/sdk/credential-providers.md). Use [Deploy an Agent](/docs/agents/deploy.md) for the complete archive and release workflow.
