Skip to main content
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

python -m pip install "nullspace-sdk[cli]==0.1.9"
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

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

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:
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:
python run.py
Related: LangGraph, Agent Deployments, and Preview URLs.