Skip to main content

LangGraph Agent Execution Engine — stdio subprocess pattern

Project description

harness-runtime

LangGraph agent execution engine designed for the stdio subprocess pattern — spawned as a child process by the Waypoint SDK, communicating via NDJSON over stdin/stdout using the LiteLLM frame protocol.

Overview

Waypoint SDK → spawn → harness-runtime → stdin NDJSON → turn frames → stdout NDJSON → exit
  • Execution: LangGraph DAG execution with PostgreSQL checkpointing
  • Protocol: LiteLLM-compatible NDJSON frame protocol over stdio
  • Persistence: LangGraph PostgresSaver for multi-turn conversations
  • No network, no K8s, no Redis: Runs as a local subprocess

Quick Start

# Install
pip install .

# Run (expects NDJSON on stdin)
DATABASE_URL=postgresql://user:pass@localhost:5432/db harness-runtime

Example NDJSON session

echo '{"type":"control_request","request_id":"req_1","request":{"subtype":"initialize","agent_definition":{...},"input_payload":{"messages":[]}}}' | \
DATABASE_URL=postgresql://user:pass@localhost:5432/db harness-runtime

Protocol

See ADR-003 for the full protocol specification.

Frame Types (SDK → Server)

Type Purpose
control_request {initialize} Build LangGraph, init PostgresSaver
control_request {interrupt} Cancel in-flight turn
user {message} Each turn — runs graph with the input

Frame Types (Server → SDK)

Type Purpose
control_response {success} Ack for initialize/interrupt
system {init} Start of turn — model, tools
assistant {content} Complete assistant message with text / tool_use blocks
user {content} Echo of internal tool results (tool_result blocks)
stream_event {content_block_delta} Streaming LLM token deltas
result Terminates the turnsuccess, error_max_turns, or error_during_execution

Architecture

harness-runtime/
├── cli.py                      # CLI entry point — stdin NDJSON loop
├── core/
│   ├── builder.py              # GraphBuilder — builds LangGraph DAG
│   ├── event_publisher.py      # StdioPublisher — LiteLLM frame emitter
│   ├── executor.py             # ExecutionManager — runs graph, maps events → frames
│   ├── session.py              # Session — multi-turn lifecycle
│   ├── model_factory.py        # LLM model creation
│   ├── model_identifier.py     # "provider:model" string builder
│   ├── subagent_builder.py     # Specialist agent compilation
│   ├── tool_loader.py          # Dynamic tool loading from script defs
│   └── state_schema_builder.py # Dynamic AgentState subclass creation
├── models/
│   ├── __init__.py
│   └── frames.py               # LiteLLM frame dataclasses + content blocks
├── migrations/                  # PostgreSQL schema migrations (checkpointer)
├── scripts/ci/run.sh           # Docker entrypoint
├── Dockerfile
└── pyproject.toml

Environment Variables

Variable Required Description
DATABASE_URL Yes PostgreSQL connection string for LangGraph checkpointer
USE_MOCK_LLM No true to use mock LLM (default: false)
LLM_MODEL_NAME No Model name for real LLM calls (default: gpt-4o-mini)

LLM provider API keys are read from environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) or from Agent Vault via proxy env vars.

Development

# Install with dev dependencies
pip install -e ".[dev]"

# Code quality
black .
ruff check .
mypy .

# Testing
pytest

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harness_runtime-0.1.4.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harness_runtime-0.1.4-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file harness_runtime-0.1.4.tar.gz.

File metadata

  • Download URL: harness_runtime-0.1.4.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for harness_runtime-0.1.4.tar.gz
Algorithm Hash digest
SHA256 01d3bfefe3c0249da6433ad250aaff7476860a448934e4660a382dab31af197f
MD5 6629b122034123b5668d139e76a688e9
BLAKE2b-256 ce50ab9563ac3ec4bf9acf35f3e1ae11b6642789d314839f05c4ba6ec2153fe4

See more details on using hashes here.

Provenance

The following attestation bundles were made for harness_runtime-0.1.4.tar.gz:

Publisher: publish.yml on soloz-io/harness-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file harness_runtime-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: harness_runtime-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for harness_runtime-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a20b11c430fe70e9d10f31c6ff97cc1a6f2967becb646a4571ad0dbec919d721
MD5 cad9f95e403c8b0448ecaba49d079b1c
BLAKE2b-256 507f83ea94e00377e1f96823d24318e87da4da077fe9342363b8d800d2593570

See more details on using hashes here.

Provenance

The following attestation bundles were made for harness_runtime-0.1.4-py3-none-any.whl:

Publisher: publish.yml on soloz-io/harness-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page