Files
cleveragents-core/features/routing_langgraph_port.feature

186 lines
5.8 KiB
Gherkin

Feature: Actor-first port of v2 routing and LangGraph suites
As a developer migrating v2 routing flows
I want actor-only routing and LangGraph coverage
So that v3 matches the v2 behaviors without provider/model flags
Background:
Given the routing system is initialized for actor-first operation
Scenario: Route bridge converts stream to graph configuration
Given I have a stream route configuration
"""
name: "test-stream"
type: "stream"
stream_type: "sequential"
batch_size: 10
"""
When I bridge the route to graph type
Then the bridged route should be a graph configuration
And the graph should have sequential execution
And the graph should preserve batch settings
Scenario: Unified route handles actor-only context variables
Given I have a unified route with context
"""
name: "actor-route"
type: "graph"
actor: "openai/gpt-4"
context_vars:
temperature: 0.7
max_tokens: 2000
"""
When I process the unified route
Then the route should use the specified actor
And the context should include temperature and max_tokens
And no provider/model fields should exist
Scenario: Stream router validates actor configuration
Given I have a stream router configuration
"""
routes:
- name: "primary"
actor: "anthropic/claude-3"
stream_type: "parallel"
- name: "fallback"
actor: "openai/gpt-3.5-turbo"
stream_type: "sequential"
"""
When I initialize the stream router
Then the router should have 2 routes
And each route should use its configured actor
And the router should support actor-based fallback
Scenario: LangGraph bridge handles state management
Given I have a LangGraph configuration with state
"""
name: "stateful-graph"
type: "graph"
actor: "local/custom-agent"
enable_checkpointing: true
state_schema:
current_task: "string"
completed_steps: "array"
"""
When I create a LangGraph bridge
Then the bridge should enable checkpointing
And the state schema should be preserved
And the bridge should use the custom actor
Scenario: Route complexity analysis with actor paths
Given I have a complex actor route configuration
"""
name: "complex-route"
type: "graph"
nodes:
- name: "analyze"
actor: "openai/gpt-4"
type: "llm"
- name: "generate"
actor: "anthropic/claude-3"
type: "llm"
- name: "validate"
actor: "local/validator"
type: "tool"
edges:
- from: "analyze"
to: "generate"
- from: "generate"
to: "validate"
"""
When I analyze the actor route complexity
Then the complexity score should reflect multi-actor coordination
And the analysis should identify 3 nodes and 2 edges
And each node should use its assigned actor
Scenario: Stream router handles parallel actor execution
Given I have parallel stream routes
"""
routes:
- name: "fast-route"
actor: "openai/gpt-3.5-turbo"
stream_type: "parallel"
priority: 1
- name: "accurate-route"
actor: "anthropic/claude-3-opus"
stream_type: "parallel"
priority: 2
execution_mode: "race"
"""
When I execute the parallel streams
Then both actors should be invoked concurrently
And the first completion should be used
And unused results should be properly cleaned up
Scenario: Conditional routing based on actor capabilities
Given I have conditional routing configuration
"""
name: "conditional-graph"
type: "graph"
nodes:
- name: "router"
type: "conditional"
conditions:
- if: "requires_vision"
then: "vision_node"
- if: "requires_code"
then: "code_node"
- else: "default_node"
- name: "vision_node"
actor: "openai/gpt-4-vision"
type: "llm"
- name: "code_node"
actor: "anthropic/claude-3-opus"
type: "llm"
- name: "default_node"
actor: "openai/gpt-3.5-turbo"
type: "llm"
"""
When I route with vision requirements
Then the vision actor should be selected
And the routing decision should be logged
Scenario: Route validation rejects invalid actors
Given I have a route with invalid actor
"""
name: "invalid-route"
type: "stream"
actor: "nonexistent/model"
"""
When I validate the route configuration
Then validation should fail with actor not found error
And the error should suggest available actors
Scenario: Bridge preserves actor-specific options
Given I have a route with actor options
"""
name: "options-route"
type: "stream"
actor: "openai/gpt-4"
actor_options:
temperature: 0.9
top_p: 0.95
frequency_penalty: 0.5
"""
When I bridge to a different route type
Then the actor options should be preserved
And the options should override defaults
And the bridged route should maintain actor identity
Scenario: Reactive streams with actor-based transformations
Given I have a reactive stream configuration
"""
name: "transform-stream"
type: "stream"
stream_type: "transform"
transformations:
- stage: "parse"
actor: "local/parser"
- stage: "enrich"
actor: "openai/gpt-3.5-turbo"
- stage: "format"
actor: "local/formatter"
"""
When I process data through the stream
Then each transformation should use its actor
And the data should flow through all stages
And errors should be handled per-actor