Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,28 +131,36 @@ The table below summarizes the support level for each binding surface.

## Third-Party Integrations

Some framework integrations are maintained as patch sets against upstream
projects rather than as packages in this repository.
Some framework integrations are maintained as packages in this repository. Other
sample integrations are maintained as patch sets against upstream projects.

### Public API-based Integrations
Some integrations can be implemented using public APIs without patching. Currently the Python based integrations are located under `python/nemo_flow/integrations/` with their own README files and test suites.

Some integrations can be implemented using public APIs without patching. Public
API-based integrations live under language-specific integration packages such as
`python/nemo_flow/integrations/` and `integrations/`.

The OpenClaw observability plugin is available under `integrations/openclaw/`
and uses OpenClaw public plugin hooks to export NeMo Flow telemetry. See the
[OpenClaw Plugin Guide](docs/integrate-frameworks/openclaw-plugin.md).

### Patch-based Integrations

Use [third_party/README.md](third_party/README.md) for the clone, checkout, and
Comment thread
coderabbitai[bot] marked this conversation as resolved.
patch-application workflow for those integrations.

### Support Matrix

The following table summarizes maintained third-party patch integrations and whether each provides observability, request intercepts, execution intercepts, and conditional execution.
The following table summarizes maintained third-party integrations and whether each provides observability, request intercepts, execution intercepts, and conditional execution.

| Integration | Method | Observability | Request Intercepts | Execution Intercepts | Conditional Execution |
|---|---|---|---|---|---|
| [LangChain](third_party/README-langchain.md), [LangGraph](third_party/README-langgraph.md), [LangChain NVIDIA](third_party/README-langchain-nvidia.md) | 🚧 Patch | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
| [opencode](third_party/README-opencode.md) | 🚧 Patch | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
| [OpenClaw](third_party/README-openclaw.md) | 🚧 Patch | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
| [OpenClaw](docs/integrate-frameworks/openclaw-plugin.md) | `nemo-flow-openclaw` plugin | ✅ Yes | ❌ No | ❌ No | ❌ No |
Comment thread
mnajafian-nv marked this conversation as resolved.
| [Hermes Agent](third_party/README-hermes-agent.md) | 🚧 Patch | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

All patches offer experimental support. Our roadmap includes switching over to first-party plugins and packages.
Patch-based integrations offer experimental support. Our roadmap includes switching over to first-party plugins and packages where upstream extension points allow it.

## Roadmap

Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ Basic Guide: Adding Scopes <integrate-frameworks/adding-scopes>
Basic Guide: Wrap Tool Calls <integrate-frameworks/wrap-tool-calls>
Basic Guide: Wrap LLM Calls <integrate-frameworks/wrap-llm-calls>
Advanced Guide: Coding-Agent Gateway <integrate-frameworks/coding-agent-gateway>
OpenClaw Plugin Guide <integrate-frameworks/openclaw-plugin>
Claude Code Gateway Guide <integrate-frameworks/coding-agent-claude-code>
Codex Gateway Guide <integrate-frameworks/coding-agent-codex>
Cursor Gateway Guide <integrate-frameworks/coding-agent-cursor>
Expand Down
1 change: 1 addition & 0 deletions docs/integrate-frameworks/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Use these guide links to move from the overview into task-specific instructions.
- [Basic Guide: Wrap Tool Calls](wrap-tool-calls.md) explains where to place managed tool wrappers and tool lifecycle fallbacks.
- [Basic Guide: Wrap LLM Calls](wrap-llm-calls.md) explains where to place managed provider wrappers, model names, streaming behavior, and LLM lifecycle fallbacks.
- [Advanced Guide: Coding-Agent Gateway](coding-agent-gateway.md) describes the Rust gateway for observing Codex, Claude Code, Cursor, and Hermes through canonical hooks plus a passthrough LLM gateway.
- [OpenClaw Plugin Guide](openclaw-plugin.md) covers configuring the OpenClaw plugin, mapping OpenClaw hooks to NeMo Flow telemetry, and understanding current LLM replay fidelity boundaries.
- [Claude Code Gateway Guide](coding-agent-claude-code.md) covers transparent Claude Code runs, Anthropic gateway routing, ATIF verification, and unsupported Claude application modes.
- [Codex Gateway Guide](coding-agent-codex.md) covers transparent Codex CLI runs, local GUI/app caveats, model provider routing, and remote-task limits.
- [Cursor Gateway Guide](coding-agent-cursor.md) covers transparent Cursor runs, temporary hook patching, GUI and CLI smoke tests, and gateway routing limits.
Expand Down
11 changes: 7 additions & 4 deletions docs/integrate-frameworks/code-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,25 +285,28 @@ event(

::::

## Sample Third-Party Integrations
## Sample Third-Party Patch Integrations

NeMo Flow keeps sample third-party integrations as patch sets under `patches/` and pinned upstream checkouts under `third_party/`.
NeMo Flow keeps sample third-party integrations as patch sets under `patches/`
and pinned upstream checkouts under `third_party/`. For the current OpenClaw
end-user integration, use the [OpenClaw Plugin Guide](openclaw-plugin.md).

The following table lists maintained patch checkouts:

| Integration | Upstream Checkout |
|---|---|
| Hermes Agent | `third_party/hermes-agent` |
| LangChain | `third_party/langchain` |
| LangChain NVIDIA | `third_party/langchain-nvidia` |
| LangGraph | `third_party/langgraph` |
| OpenClaw | `third_party/openclaw` |
| OpenClaw (legacy patch) | `third_party/openclaw` |
| opencode | `third_party/opencode` |

## Quickstart: Apply Maintained Patches

From the repository root, use the wrapper scripts when you want the maintained
NeMo Flow patches applied to the pinned third-party checkouts:


| Script | Purpose |
|---|---|
| `./scripts/bootstrap-third-party.sh` | Clone pinned third-party upstream checkouts from `third_party/sources.lock`. |
Expand Down
275 changes: 275 additions & 0 deletions docs/integrate-frameworks/openclaw-plugin.md
Comment thread
mnajafian-nv marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
<!--
SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->

# OpenClaw Plugin Guide

Use the OpenClaw plugin when OpenClaw owns the agent, tool, and LLM lifecycle
that needs NeMo Flow observability. The plugin observes supported OpenClaw
plugin hooks and converts them into NeMo Flow sessions, LLM spans, tool spans,
marks, ATIF JSON, OpenTelemetry spans, and OpenInference/Phoenix spans.

Use this guide to install the plugin, enable it in OpenClaw, configure telemetry
outputs, verify exported traces, and understand current LLM replay fidelity.

## Requirements

- OpenClaw `2026.5.6` or newer.
- The OpenClaw CLI available as `openclaw`.
- Node.js and npm when installing or managing the package directly.
- A Phoenix instance or OTLP collector when exporting OpenInference or
OpenTelemetry spans.

## Install

Install the plugin with OpenClaw so OpenClaw can register and manage it:

```bash
openclaw plugins install npm:nemo-flow-openclaw
openclaw gateway restart
```

OpenClaw uses the package `nemo-flow-openclaw` for installation and the plugin
manifest id `nemo-flow` for configuration. Use `nemo-flow` in
`plugins.allow`, `plugins.entries`, `plugins inspect`, and gateway status
commands.

If you manage OpenClaw plugin dependencies directly in a Node.js project,
install the package with npm:

```bash
npm install nemo-flow-openclaw
```

Installing with npm makes the package available to that project. Use
`openclaw plugins install` when you want OpenClaw to register and manage the
plugin.

## Enable the Plugin

Allow the `nemo-flow` plugin id and grant conversation hook access when OpenClaw
runs with restrictive plugin settings:

```json
{
"plugins": {
"allow": ["nemo-flow"],
"entries": {
"nemo-flow": {
"enabled": true,
"hooks": {
"allowConversationAccess": true
},
"config": {}
}
}
}
}
```

`plugins.allow` controls plugin trust and loading.
`hooks.allowConversationAccess` lets trusted non-bundled plugins receive
conversation-sensitive hook payloads such as LLM prompts, LLM responses, agent
finalization messages, and tool payloads.

Restart the gateway after changing plugin configuration:

```bash
openclaw gateway restart
```

## Configure Outputs

Plugin configuration is passed through
`plugins.entries["nemo-flow"].config`.

ATIF export is enabled by default. OpenTelemetry and OpenInference subscribers
are disabled until explicitly configured.

Use the following configuration for ATIF-only local export:

```json
Comment thread
coderabbitai[bot] marked this conversation as resolved.
{
"atif": {
"enabled": true,
"outputDir": "./nemo-flow-atif"
},
"telemetry": {
"otel": {
"enabled": false
},
"openInference": {
"enabled": false
}
}
}
```

Use the following configuration for OpenTelemetry OTLP export:

```json
Comment thread
coderabbitai[bot] marked this conversation as resolved.
{
"telemetry": {
"otel": {
"enabled": true,
"transport": "http_binary",
"endpoint": "http://localhost:4318/v1/traces",
"serviceName": "openclaw-nemo-flow"
}
}
}
```

Use the following configuration for OpenInference/Phoenix OTLP export:

```json
Comment thread
coderabbitai[bot] marked this conversation as resolved.
{
"telemetry": {
"openInference": {
"enabled": true,
"transport": "http_binary",
"endpoint": "http://localhost:6006/v1/traces",
"serviceName": "openclaw-nemo-flow"
}
}
}
```

Privacy defaults capture prompts and responses, and strip tool arguments and
tool results:

```json
{
"capture": {
"includePrompts": true,
"includeResponses": true,
"stripToolArgs": true,
"stripToolResults": true
}
}
```

Tool arguments and tool results are stripped by default because they often
contain user data, local paths, tokens, or large payloads.

Correlation uses bounded in-memory records. By default, the plugin waits 250 ms
for a matching `llm_input` after an `llm_output`, keeps correlation records for
600 seconds, and keeps at most 32 records per correlation key.

## Verify the Integration

Inspect the plugin runtime:

```bash
openclaw plugins inspect nemo-flow --runtime --json
```

This verifies that the plugin package is installed, enabled, importable, and
exposes its config schema. It does not prove that every hook and gateway method
surface is active in a running gateway.

Run an OpenClaw session with the plugin enabled, then verify the configured
sink:

- ATIF: confirm JSON files appear in the configured `atif.outputDir`.
- OpenTelemetry: confirm spans arrive at the configured OTLP collector.
- OpenInference: confirm spans arrive at the configured OpenInference/Phoenix
endpoint.

The plugin also registers the `operator.admin` scoped gateway method
`nemoFlow.status`. If your CLI is already paired with admin-capable gateway
access, run:

```bash
openclaw gateway call nemoFlow.status --json
```

Otherwise, pass your normal admin-capable gateway auth options:

```bash
openclaw gateway call nemoFlow.status --token "$OPENCLAW_GATEWAY_TOKEN" --json
```

If OpenClaw requests a device scope upgrade for `operator.admin`, approve it
through the normal OpenClaw device approval flow and retry the status call.

The status response reports backend state, output health for `atif`, `otel`,
and `openInference`, replay counters, and the latest degraded or unavailable
reason when present.

## Runtime Mapping

The plugin maps supported OpenClaw hook events into NeMo Flow telemetry without
changing OpenClaw execution behavior.

| OpenClaw hook | NeMo Flow behavior |
| --- | --- |
| `gateway_start` | Touches the replay backend early; session roots still open lazily from session-scoped hooks. |
| `gateway_stop` | Drains open sessions, shuts down subscribers, and clears the NeMo Flow plugin host. |
| `session_start` | Opens or aliases a NeMo Flow session scope. |
| `session_end` | Closes the session, flushes pending replay state, and exports ATIF if enabled. |
| `model_call_started` / `model_call_ended` | Records provider timing for later LLM span correlation. |
| `llm_input` / `llm_output` | Replays direct LLM spans when request and response hooks can be paired safely. |
| `before_message_write` | Records assistant turns for ordered LLM replay when provider timing can be paired later. |
| `after_tool_call` | Replays successful tool calls as tool spans; blocked tools emit marks. |
| `agent_end` | Emits an agent lifecycle mark, flushes recorded assistant-turn LLM spans, and preserves the final assistant answer as the session output. |
| `before_agent_finalize` | Preserves the last assistant message as fallback session output and emits a lifecycle mark without mutating the finalization payload. |
| `subagent_spawned` / `subagent_ended` | Emits subagent lifecycle marks under the best available parent or child session. |

## LLM Replay Fidelity

OpenClaw currently exposes request, response, message-write, and provider
timing details through separate hook events. The plugin correlates those events
within the same session, provider, model, and run.

When model timing cannot be safely paired with an assistant turn, the plugin
emits diagnostic marks instead of inventing latency. This keeps traces honest
and makes current fidelity boundaries explicit.

When OpenClaw provides usage data, the plugin maps input, output, total, cache
read, cache write, and cost fields into OpenInference-friendly usage fields.

## Troubleshooting

If the plugin does not load:

- verify the package was installed with `openclaw plugins install`
- verify `plugins.allow` includes `nemo-flow`
- verify `plugins.entries["nemo-flow"].enabled` is not disabled
- restart the gateway after config changes

If conversation payloads are missing:

- verify `hooks.allowConversationAccess` is enabled for the plugin
- verify the OpenClaw session emits the relevant LLM, message-write, and tool
hooks

If tool spans exist but LLM spans are incomplete:

- verify `llm_input` and `llm_output` hooks are emitted
- verify `before_message_write` hooks are emitted when relying on assistant-turn
replay
- verify `model_call_started` and `model_call_ended` hooks are emitted when
timing attribution is expected
- check diagnostic marks for ambiguous or unpaired timing records

If no export output appears:

- verify `atif.outputDir`, `telemetry.otel.endpoint`, or
`telemetry.openInference.endpoint`
- verify the configured collector or output directory is reachable
- verify session end or gateway stop hooks fired so pending replay state can
drain

If ambiguous timing marks appear, treat them as expected conservative behavior.
The plugin avoids attaching unsafe latency when multiple timing candidates could
match the same assistant turn.

## Known Limitations

Current OpenClaw public hooks are separate event streams, so some LLM timing
attribution is best-effort. If a matching request hook is missing, the plugin
may replay an LLM output with a placeholder request after the configured grace
window. If timing is ambiguous, the plugin emits diagnostic marks instead of
unsafe latency.
Loading
Loading