> ## 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.

# LangGraph Service

> Deploy a LangGraph-backed HTTP service on Nullspace.

This example uses
`examples/python/agent_deployments/langgraph_service/nullspace.agent.toml` to
package a LangGraph-backed FastAPI service and expose it through a Nullspace
service URL.

## 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 OPENAI_API_KEY=sk-...
cd examples/python/agent_deployments/langgraph_service
```

## CLI

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

nullspace agent url langgraph-service \
  --env OPENAI_API_KEY="$OPENAI_API_KEY"

nullspace agent status langgraph-service --service adsvc_123
nullspace agent logs langgraph-service --service adsvc_123
nullspace agent stop langgraph-service
```

The service exposes `/health` and `/invoke`. Keep LangGraph thread IDs in your
application request/session layer.

## Config

```toml theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
name = "langgraph-service"
mode = "service"
install = "python -m pip install -e ."
entrypoint = "python -m uvicorn src.server:app --host 0.0.0.0 --port 8000"

[service]
port = 8000
readiness = { type = "http", path = "/health", timeout_seconds = 30 }

[permissions]
public_url = true
```

## 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)
service = deployment.start_service(envs={"OPENAI_API_KEY": "..."})
service_url = deployment.service_url(service.id)
print(deployment.name, version.id, len(manifest.entries), service_url.url)
```

Run the complete script:

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

Related: [LangGraph](../agents/langgraph), [Agent Deployments](../agents/deployments),
and [Preview URLs](../networking/preview-urls).
