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.5.tar.gz (28.5 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.5-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: harness_runtime-0.1.5.tar.gz
  • Upload date:
  • Size: 28.5 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.5.tar.gz
Algorithm Hash digest
SHA256 022f57dc0ab15b15e1cf901cfefac223b7b6605fa073954fc24fffbf8d8a0697
MD5 219b9a1b231a76669e21a87fc3394791
BLAKE2b-256 9b0c9494bc4366050c736c2ce8009593773755ab27db7cfedebc85b1304f7b35

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: harness_runtime-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e7d680b29a9f0bd40e707ae6e5eaaf47f726b2cb5f1a29a8a2b3af13ea17b90b
MD5 eb823412e07f8670076d10b96954a8e8
BLAKE2b-256 7ec8dbb137cf2a6eaa921a8583a513474bf783cb0c46b418607947ff4eeb95cd

See more details on using hashes here.

Provenance

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