forked from cleveragents/cleveragents-core
210 lines
5.9 KiB
Gherkin
210 lines
5.9 KiB
Gherkin
Feature: RxPY Route Validation for Run Command
|
|
As a CleverAgents user
|
|
I want RxPY stream routes to be restricted to interactive mode only
|
|
So that I can avoid incomplete processing due to quiescence detection issues
|
|
|
|
Background:
|
|
Given I have a working directory for CLI tests
|
|
|
|
|
|
Scenario: Detect RxPY routes in configuration
|
|
Given I have a configuration with RxPY stream routes:
|
|
"""
|
|
agents:
|
|
test_agent:
|
|
type: tool
|
|
config:
|
|
tools: ["echo"]
|
|
safe_mode: true
|
|
|
|
routes:
|
|
main:
|
|
type: stream
|
|
stream_type: cold
|
|
operators:
|
|
- type: map
|
|
params:
|
|
agent: test_agent
|
|
publications:
|
|
- __output__
|
|
|
|
merges:
|
|
- sources: [__input__]
|
|
target: main
|
|
"""
|
|
When I create a ReactiveCleverAgentsApp with this configuration
|
|
Then the app should detect RxPY stream routes
|
|
|
|
|
|
Scenario: Allow LangGraph routes in configuration
|
|
Given I have a configuration with LangGraph routes:
|
|
"""
|
|
agents:
|
|
test_agent:
|
|
type: tool
|
|
config:
|
|
tools: ["echo"]
|
|
safe_mode: true
|
|
|
|
routes:
|
|
main:
|
|
type: graph
|
|
entry_point: start
|
|
nodes:
|
|
start:
|
|
type: agent
|
|
agent: test_agent
|
|
edges:
|
|
- source: start
|
|
target: end
|
|
|
|
merges:
|
|
- sources: [__input__]
|
|
target: main
|
|
"""
|
|
When I create a ReactiveCleverAgentsApp with this configuration
|
|
Then the app should not detect RxPY stream routes
|
|
|
|
|
|
Scenario: Run command rejects RxPY routes
|
|
Given I have a configuration file with RxPY stream routes "rxpy_config.yaml":
|
|
"""
|
|
agents:
|
|
echo_agent:
|
|
type: tool
|
|
config:
|
|
tools: ["echo"]
|
|
safe_mode: true
|
|
|
|
routes:
|
|
echo_stream:
|
|
type: stream
|
|
stream_type: cold
|
|
operators:
|
|
- type: map
|
|
params:
|
|
agent: echo_agent
|
|
publications:
|
|
- __output__
|
|
|
|
merges:
|
|
- sources: [__input__]
|
|
target: echo_stream
|
|
"""
|
|
When I run "cleveragents run -c rxpy_config.yaml -p 'test' --unsafe"
|
|
Then the command should fail
|
|
And the error should contain "RxPY stream routes which are only supported in 'interactive' mode"
|
|
And the error should contain "Use 'interactive' command instead"
|
|
And the error should contain "Migrate routes to LangGraph"
|
|
|
|
|
|
Scenario: Run command with RxPY routes and context does not create context
|
|
Given I have a configuration file with RxPY stream routes "rxpy_config.yaml"
|
|
And the context "rxpy_test_context" does not exist
|
|
When I run "cleveragents run -c rxpy_config.yaml -p 'test' --unsafe --context rxpy_test_context"
|
|
Then the command should fail
|
|
And the error should contain "RxPY stream routes which are only supported in 'interactive' mode"
|
|
And the context "rxpy_test_context" should not exist
|
|
|
|
|
|
Scenario: Interactive command accepts RxPY routes
|
|
Given I have a configuration file with RxPY stream routes "rxpy_config.yaml"
|
|
When I start interactive session "cleveragents interactive -c rxpy_config.yaml --unsafe"
|
|
Then the interactive session should start successfully
|
|
And no error about RxPY routes should be shown
|
|
|
|
|
|
Scenario: Run command with LangGraph routes succeeds
|
|
Given I have a configuration file with LangGraph routes "langgraph_config.yaml":
|
|
"""
|
|
agents:
|
|
echo_agent:
|
|
type: tool
|
|
config:
|
|
tools: ["echo"]
|
|
safe_mode: true
|
|
|
|
routes:
|
|
main:
|
|
type: graph
|
|
entry_point: start
|
|
nodes:
|
|
start:
|
|
type: agent
|
|
agent: echo_agent
|
|
edges:
|
|
- source: start
|
|
target: end
|
|
|
|
merges:
|
|
- sources: [__input__]
|
|
target: main
|
|
"""
|
|
When I run "cleveragents run -c langgraph_config.yaml -p 'echo test' --unsafe"
|
|
Then the command should succeed
|
|
And no error about route types should be shown
|
|
|
|
|
|
Scenario: App method _has_rxpy_stream_routes with no routes
|
|
Given I have a configuration with no routes:
|
|
"""
|
|
agents:
|
|
test_agent:
|
|
type: tool
|
|
config:
|
|
tools: ["echo"]
|
|
safe_mode: true
|
|
"""
|
|
When I create a ReactiveCleverAgentsApp with this configuration
|
|
Then the app should not detect RxPY stream routes
|
|
|
|
|
|
Scenario: App method _has_rxpy_stream_routes with mixed routes
|
|
Given I have a configuration with both RxPY and LangGraph routes:
|
|
"""
|
|
agents:
|
|
test_agent:
|
|
type: tool
|
|
config:
|
|
tools: ["echo"]
|
|
safe_mode: true
|
|
|
|
routes:
|
|
stream_route:
|
|
type: stream
|
|
stream_type: cold
|
|
operators:
|
|
- type: map
|
|
params:
|
|
agent: test_agent
|
|
publications:
|
|
- graph_route
|
|
|
|
graph_route:
|
|
type: graph
|
|
entry_point: start
|
|
nodes:
|
|
start:
|
|
type: agent
|
|
agent: test_agent
|
|
edges:
|
|
- source: start
|
|
target: end
|
|
|
|
merges:
|
|
- sources: [__input__]
|
|
target: stream_route
|
|
"""
|
|
When I create a ReactiveCleverAgentsApp with this configuration
|
|
Then the app should detect RxPY stream routes
|
|
|
|
|
|
Scenario: Validation error provides helpful guidance
|
|
Given I have a configuration file with RxPY stream routes "rxpy_config.yaml"
|
|
When I run "cleveragents run -c rxpy_config.yaml -p 'test' --unsafe"
|
|
Then the command should fail
|
|
And the error message should explain the reason for restriction
|
|
And the error message should provide solution alternatives
|
|
And the error message should mention quiescence detection
|
|
And the error message should mention nested operators
|