Open
Conversation
✅ Deploy Preview for nextflow-docs-staging canceled.
|
903a1a0 to
bc04da9
Compare
Member
|
Interesting, but does it still need ansi escape capabilities? |
Member
Author
|
No, agent mode doesn't need ANSI escape capabilities. The implementation explicitly disables ANSI output. The feature was intentionally designed this way. When NXF_AGENT=true:
|
Member
|
Nice! |
ewels
approved these changes
Jan 30, 2026
Member
ewels
left a comment
There was a problem hiding this comment.
Very nice!
Haven't tested but a skim of the code on my phone looks sensible / as I'd expect 👍🏻
Member
|
is the output format complete for this? |
pditommaso
reviewed
Feb 6, 2026
bentsherman
reviewed
Feb 6, 2026
Comment on lines
317
to
322
Member
There was a problem hiding this comment.
Since I assume you would only ever enable one observer or another, maybe we should combine these into a single logObserver field
Member
|
This works better with ansi-mode false |
edd3bc4 to
9445df3
Compare
Tests for AI agent-friendly output mode via env vars. All tests marked @PendingFeature until implementation. Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
Add AI agent-friendly output mode triggered by env vars: - NXF_AGENT=true - AGENT=true - CLAUDECODE=true When enabled, outputs minimal structured format: - [PIPELINE] name version | profile=X - [WORKDIR] path - [WARN] deduplicated warnings - [ERROR] with exit/cmd/stderr/workdir context - [SUCCESS|FAILED] summary Achieves 98-100% token savings for AI context windows. Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
- agent-output.nf: Tests successful workflow in agent mode - agent-output-error.nf: Tests error output format in agent mode - Validates [PIPELINE], [WORKDIR], [SUCCESS/FAILED] format - Verifies banner suppression and error context (exit code, workdir) Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
Co-authored-by: Ben Sherman <bentshermann@gmail.com> Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
Co-authored-by: Ben Sherman <bentshermann@gmail.com> Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
Only one observer is ever active. Use instanceof for ANSI-specific features (appendSticky, started/stopped checks). Co-authored-by: Ben Sherman <bentshermann@gmail.com> Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
Task hashes and submission lines flow through ConsoleAppender instead of being captured and suppressed. Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com> Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
9445df3 to
627659b
Compare
…t mode AgentLogObserver.println wrote to System.out but integration tests capture stderr. Also enable CaptureAppender in agent mode so log-level warnings/errors are forwarded to the observer. Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
printConsole was routing view operator output through logObserver.appendInfo() which suppresses most messages in agent mode. Only AnsiLogObserver needs to capture console output for rendering. Signed-off-by: Edmund Miller <edmund.miller@seqera.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add AI agent-friendly output mode for Nextflow, triggered by environment variables:
NXF_AGENT=trueAGENT=1CLAUDECODE=1When enabled, Nextflow outputs a minimal format optimized for AI agent context windows.
Inspired by Bun's test agent mode
Output Format
Key Features
Token Savings
Experiments show 98-100% token savings while preserving all diagnostic information:
Changes
SysEnv.isAgentMode()- Detects agent mode via env varsAgentLogObserver- New TraceObserverV2 for minimal outputSession- Adds agentLog flag and observer integrationCmdRun- Suppresses banner/launch info in agent modeLoggerHelper- Routes logs to AgentLogObserverTests