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.0.tar.gz (19.6 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.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: harness_runtime-0.1.0.tar.gz
  • Upload date:
  • Size: 19.6 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.0.tar.gz
Algorithm Hash digest
SHA256 148e910ada0eb0f7b52115bc40b299b6b7f9d01062a034dd15e9633a7fe5c80c
MD5 0c3f0fde18425d299ccc6573be33f4fb
BLAKE2b-256 7e65b2b86eb668fe9cdb95529d5a23d78e149da16e240e75897d5ef97bebc4d9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for harness_runtime-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7288fa043da68e359364c0edda834ab1aedce4158afc6eae893fe7eb31499b51
MD5 116e9d6e1375ef8846cc7e7386414d42
BLAKE2b-256 0f1bbc956cd391240ad48fac25aab09c04a9a289f1abf82ace003d6bfeb38133

See more details on using hashes here.

Provenance

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