Skip to content

feat: OpenClaw integration — Phase 1 (spawn mode, dashboard badge, examples & docs)#376

Open
AndreRatzenberger wants to merge 36 commits intomainfrom
feat/openclaw
Open

feat: OpenClaw integration — Phase 1 (spawn mode, dashboard badge, examples & docs)#376
AndreRatzenberger wants to merge 36 commits intomainfrom
feat/openclaw

Conversation

@AndreRatzenberger
Copy link
Member

@AndreRatzenberger AndreRatzenberger commented Feb 11, 2026

Summary

First-class OpenClaw agent support for Flock. OpenClaw agents participate in Flock pipelines using the same fluent API — same blackboard semantics, different compute backend.

flock = Flock(openclaw=OpenClawConfig.from_env())
pizza_master = flock.openclaw_agent("codie").consumes(MyPizzaIdea).publishes(Pizza)

What's Included

Core Integration (src/flock/integrations/openclaw/)

  • OpenClawConfig / GatewayConfig — Gateway registration with env-based auto-discovery (OPENCLAW_<ALIAS>_URL + OPENCLAW_<ALIAS>_TOKEN)
  • OpenClawEngine — Engine implementation (spawn mode) with task prompt builder, JSON response parsing, repair pass for malformed output, and error mapping
  • .openclaw_agent() — Builder method on Flock class for fluent API

Dashboard

  • 🦞 Lobster badge — OpenClaw agents show an orange "🦞 OpenClaw" pill in the graph UI
  • Backend: GraphAssembler emits isOpenClawAgent + engineKind fields
  • Frontend: AgentNode.tsx renders badge with triple detection (flag, engineKind, label fallback)

Examples (examples/11-openclaw/)

  • 01_pizza_with_openclaw.py — Single OpenClaw agent in a pipeline
  • 02_mixed_pipeline.py — OpenClaw + native LLM agents in the same workflow
  • 03_env_config.py — 12-factor env-based configuration
  • README.md — Example guide

Documentation

  • docs/guides/openclaw.md — Comprehensive integration guide (setup, config, usage, error handling, Phase 2+ roadmap)
  • docs/guides/index.md — Updated with Integrations section
  • docs/specs/004-openclaw-integration/concept.md — Full design spec (Phases 1–4)
  • README.md — OpenClaw announcement banner + integration section with code samples

Architecture Decision

Engine-based, not a new agent type. OpenClaw replaces only the compute step — all Flock semantics work unchanged:

  • ✅ Blackboard routing, visibility controls, fan-out, predicates
  • ✅ JoinSpec / BatchSpec, workflow conditions (Until)
  • ✅ Tracing / observability, context providers, dashboard

Test Coverage

  • 25 OpenClaw tests across 4 files (config, builder, engine, integration pipeline)
  • 6 dashboard graph tests (including OpenClaw badge verification)
  • Zero regressions on existing test suite
  • Uses respx for HTTP mocking — no real gateway needed

Phase 1 Scope (Locked)

Decision Choice
Mode Spawn only (isolated session per invocation)
Output Single type per agent
API surface flock.openclaw_agent() on Flock class directly
Cleanup Delete spawned sessions after result collection
Error mapping ValueError (config/auth), RuntimeError (transport/timeout/parse)
JSON repair Single retry with repair prompt on malformed output

Future Phases

  • Phase 2: Session mode, retry with backoff, concurrency limits, loop prevention, OTel trace spans
  • Phase 3: Bidirectional publish-back, streaming to dashboard, capability discovery
  • Phase 4: Generic lease/claim primitives, OTLP export convenience, verification workflows

Note

Medium Risk
Introduces a new remote-execution engine path (HTTP calls, retries, error mapping) and new public API surface (openclaw_agent, config exports), which can affect runtime behavior and dashboard rendering despite being opt-in.

Overview
Adds an opt-in OpenClaw integration that lets pipelines run agents via flock.openclaw_agent() using a new OpenClawEngine (spawn-mode HTTP transport) plus OpenClawConfig/GatewayConfig (including from_env() discovery), and re-exports these types from flock/flock.core.

Updates the dashboard graph payload to tag agents with engineKind/isOpenClawAgent and updates the frontend AgentNode to render an OpenClaw badge, with new unit/integration tests covering config, builder chaining, engine error/repair behavior, mixed pipelines, and dashboard tagging.

Bumps version to 0.5.400 and adds substantial docs/examples/spec artifacts (OpenClaw guide, README/AGENTS updates, examples, changelog, OpenSpec + Beads tracking/merge configuration).

Written by Cursor Bugbot for commit 19fb103. This will update automatically on new commits. Configure here.

…ph UI)

- graph_builder.py: detect OpenClaw engines, emit isOpenClawAgent + engineKind
- AgentNode.tsx: render orange 🦞 OpenClaw badge pill
- AgentNode.test.tsx: badge rendering test
- test_dashboard_graph.py: backend graph assembler test
…ion mismatch

The CI rich version has a different Text.assemble() signature than local.
Using no_output=True isolates transport tests from terminal rendering.
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 91.70507% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.78%. Comparing base (135ddba) to head (19fb103).

Files with missing lines Patch % Lines
src/flock/integrations/openclaw/engine.py 90.22% 7 Missing and 6 partials ⚠️
src/flock/api/graph_builder.py 76.92% 2 Missing and 1 partial ⚠️
src/flock/core/orchestrator.py 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #376      +/-   ##
==========================================
+ Coverage   83.64%   83.78%   +0.13%     
==========================================
  Files         144      148       +4     
  Lines        9245     9454     +209     
  Branches     1174     1209      +35     
==========================================
+ Hits         7733     7921     +188     
- Misses       1212     1228      +16     
- Partials      300      305       +5     
Flag Coverage Δ
backend 83.78% <91.70%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…oost test coverage to 93%

- engine.py: raise RuntimeError on non-auth ok:false (was silently falling through)
- core/__init__.py: add GatewayConfig, OpenClawConfig, OpenClawDefaults to __all__
- test_openclaw_engine.py: 10 new tests covering error paths, parse edge cases, tokenless auth
- test_openclaw_builder.py: __all__ verification test
- uv.lock: regenerated for version 0.5.400
@AndreRatzenberger
Copy link
Member Author

@codex

@chatgpt-codex-connector
Copy link

To use Codex here, create a Codex account and connect to github.

@AndreRatzenberger
Copy link
Member Author

@codex

@chatgpt-codex-connector
Copy link

To use Codex here, create a Codex account and connect to github.

@AndreRatzenberger
Copy link
Member Author

@codex pls take a look

@chatgpt-codex-connector
Copy link

To use Codex here, create a Codex account and connect to github.

AndreRatzenberger and others added 10 commits February 11, 2026 18:11
Updated the title and introductory text in README.
…-input artifacts, auto-label openclaw agents

- engine.py: thread agent into _build_spawn_payload, include description in prompt
- engine.py: iterate all input artifacts (array if >1, single object if 1)
- orchestrator.py: auto-apply 'openclaw' label for dashboard badge detection on inactive agents
- Tests updated to verify label and new payload structure
Updated the README to improve formatting and clarity.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

data,
produced_by=agent.name,
metadata={"correlation_id": ctx.correlation_id},
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pydantic ValidationError bypasses engine retry/repair loop

Medium Severity

When output_decl.apply(data, ...) calls spec.build, the underlying self.model(**data) performs Pydantic validation. If the OpenClaw agent returns valid JSON that doesn't match the output model (e.g., missing a required field), a Pydantic ValidationError is raised. This exception is not caught by the retry loop, which only handles RuntimeError and ValueError. As a result, no repair attempt is made and the error doesn't match the documented RuntimeError mapping. The repair prompt includes the schema, so a retry could succeed — but the opportunity is missed.

Additional Locations (1)

Fix in Cursor Fix in Web

{"id":"flock-repo-cv4.8","title":"Write failing integration tests: mixed OpenClaw + native pipeline behavior","notes":"Starting TDD step: add failing integration tests for OpenClaw + native mixed pipeline behavior.","status":"closed","priority":1,"issue_type":"task","owner":"pyros.sd.models@gmail.com","created_at":"2026-02-11T14:48:15.061717+01:00","created_by":"pyros-projects","updated_at":"2026-02-11T15:44:24.722408+01:00","closed_at":"2026-02-11T15:44:24.722408+01:00","close_reason":"Added failing integration tests in tests/integration/openclaw/test_openclaw_pipeline.py for validated OpenClaw artifact publishing and mixed OpenClaw+native pipeline; verified red (2 failed) due missing OpenClaw config exports from flock/flock.core namespaces.","dependencies":[{"issue_id":"flock-repo-cv4.8","depends_on_id":"flock-repo-cv4","type":"parent-child","created_at":"2026-02-11T14:48:15.062407+01:00","created_by":"pyros-projects"},{"issue_id":"flock-repo-cv4.8","depends_on_id":"flock-repo-cv4.7","type":"blocks","created_at":"2026-02-11T14:48:15.063393+01:00","created_by":"pyros-projects"}]}
{"id":"flock-repo-cv4.9","title":"Implement orchestrator/export wiring for OpenClaw integration","status":"closed","priority":1,"issue_type":"task","owner":"pyros.sd.models@gmail.com","created_at":"2026-02-11T14:48:15.170707+01:00","created_by":"pyros-projects","updated_at":"2026-02-11T15:50:17.691989+01:00","closed_at":"2026-02-11T15:50:17.691989+01:00","close_reason":"Implemented package export wiring for OpenClawConfig/GatewayConfig/OpenClawDefaults in flock and flock.core; integration red tests from cv4.8 turned green (commit 0fc4d780).","dependencies":[{"issue_id":"flock-repo-cv4.9","depends_on_id":"flock-repo-cv4","type":"parent-child","created_at":"2026-02-11T14:48:15.171334+01:00","created_by":"pyros-projects"},{"issue_id":"flock-repo-cv4.9","depends_on_id":"flock-repo-cv4.8","type":"blocks","created_at":"2026-02-11T14:48:15.172217+01:00","created_by":"pyros-projects"}]}
{"id":"flock-repo-cv5","title":"OpenClaw Phase1 Docs \u0026 Examples","status":"closed","priority":0,"issue_type":"epic","owner":"andre.ratzenberger@whiteduck.de","created_at":"2026-02-11T15:56:00.73672+01:00","created_by":"AndreRatzenberger","updated_at":"2026-02-11T16:05:02.334229+01:00","closed_at":"2026-02-11T16:05:02.334229+01:00","close_reason":"done"}
{"id":"flock-repo-cv5.1","title":"Create OpenClaw examples (01-03 + README)","status":"closed","priority":1,"issue_type":"task","owner":"andre.ratzenberger@whiteduck.de","created_at":"2026-02-11T15:56:17.244299+01:00","created_by":"AndreRatzenberger","updated_at":"2026-02-11T16:05:02.231448+01:00","closed_at":"2026-02-11T16:05:02.231448+01:00","close_reason":"done"}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Development tracking files committed to repository

Low Severity

The .beads/ directory (issue tracker database, config, metadata) and openspec/ directory (change proposals, task lists, test discovery notes) are development process scaffolding from the TDD workflow. They contain closed task tracking data with personal email addresses and duplicate information already captured in docs/specs/004-openclaw-integration/. Neither directory is mentioned in the PR's "What's Included" section, suggesting they were swept into the commit unintentionally.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant