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

# Claude Agent SDK Job

> Deploy a Claude Agent SDK app as a Nullspace job.

This example uses
`examples/python/agent_deployments/claude_agent_sdk_job/nullspace.agent.toml` to
package a Claude Agent SDK app, run it as a finite job, and collect declared
outputs.

## Setup

```bash theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
python -m pip install "nullspace-sdk[cli]==1.0.0"
export NULLSPACE_API_KEY=ns_live_...
export NULLSPACE_API_URL=https://api.your-nullspace-domain
export ANTHROPIC_API_KEY=sk-ant-...
cd examples/python/agent_deployments/claude_agent_sdk_job
```

## CLI

```bash theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
nullspace agent deploy .

nullspace agent run claude-agent-sdk-job \
  --input-json '{"prompt":"write a short release note"}' \
  --env ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \
  --retain-on-failure \
  --json

nullspace agent logs claude-agent-sdk-job --run adrun_123
nullspace agent outputs claude-agent-sdk-job --run adrun_123
nullspace agent machine claude-agent-sdk-job --run adrun_123
```

Use the retained backing machine for PTY, SSH, command, or file debugging when
the Claude run fails.

## Config

```toml theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
name = "claude-agent-sdk-job"
mode = "job"
install = "python -m pip install -e ."
entrypoint = "python main.py"

[env]
required = ["ANTHROPIC_API_KEY"]

[outputs]
paths = ["result.json", "reports"]
```

## Python

The companion `run.py` script uses the same deployment contract through the SDK:

```python theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
from pathlib import Path

from nullspace import AgentDeployment

project = Path(__file__).resolve().parent
deployment, version, manifest = AgentDeployment.deploy(path=project)
run = deployment.run(
    input={"prompt": "Write a short release note for Agent Deployments."},
    envs={"ANTHROPIC_API_KEY": "..."},
    retain_on_failure=True,
)
print(deployment.name, version.id, len(manifest.entries), run.id)
```

Run the complete script:

```bash theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
python run.py
```

Related: [Claude Agent SDK](../agents/claude-agent-sdk) and
[Agent Deployments](../agents/deployments).
