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.8.tar.gz (32.9 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.8-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: harness_runtime-0.1.8.tar.gz
  • Upload date:
  • Size: 32.9 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.8.tar.gz
Algorithm Hash digest
SHA256 29ee289119ac3d4f6ff7e824c806a04728e4013fb833e0af0304f7ad491146df
MD5 f6e0cc66d556e183d1f8cd007144b9b3
BLAKE2b-256 389d7132e8025b92d84bc019ceb0931a79ce163deaab9e976fbdfe6a280534d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for harness_runtime-0.1.8.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.8-py3-none-any.whl.

File metadata

  • Download URL: harness_runtime-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 36.5 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ff7b54c7fc87164b499ba468d7d6cc411883057ccea3e38e10623e799efb884f
MD5 16836199ec504c1b710c3c04539ddbe5
BLAKE2b-256 3e39ad7d28b5528f263eee10146fb4ea6e256b294fc407bb777725e03beb8b36

See more details on using hashes here.

Provenance

The following attestation bundles were made for harness_runtime-0.1.8-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