131 lines
4.0 KiB
Gherkin
131 lines
4.0 KiB
Gherkin
Feature: Reactive Application Management
|
|
As a developer using CleverAgents
|
|
I want to manage the reactive application lifecycle
|
|
So that I can build and deploy agent networks effectively
|
|
|
|
Background:
|
|
Given the CleverAgents reactive system is available
|
|
|
|
Scenario: Load basic reactive configuration
|
|
Given I have a basic reactive configuration file:
|
|
"""
|
|
agents:
|
|
chat_agent:
|
|
type: llm
|
|
config:
|
|
provider: openai
|
|
model: gpt-3.5-turbo
|
|
temperature: 0.7
|
|
|
|
routes:
|
|
chat_stream:
|
|
type: stream
|
|
stream_type: cold
|
|
operators:
|
|
- type: map
|
|
params:
|
|
agent: chat_agent
|
|
publications:
|
|
- __output__
|
|
|
|
merges:
|
|
- sources: [__input__]
|
|
target: chat_stream
|
|
"""
|
|
When I load the configuration
|
|
Then the application should initialize successfully
|
|
And I should have 1 agent
|
|
And I should have 1 route
|
|
|
|
Scenario: Single-shot processing
|
|
Given I have a loaded reactive application
|
|
When I run single-shot processing with prompt "Hello, world!"
|
|
Then I should receive a response
|
|
And the processing should complete successfully
|
|
|
|
Scenario: Interactive session
|
|
Given I have a loaded reactive application
|
|
When I start an interactive session
|
|
Then the session should be ready for input
|
|
And I should be able to send messages
|
|
And receive responses in real-time
|
|
|
|
Scenario: Configuration validation
|
|
Given I have an invalid configuration:
|
|
"""
|
|
agents:
|
|
bad_agent:
|
|
type: unknown_type
|
|
config: {}
|
|
"""
|
|
When I try to load the configuration
|
|
Then I should get a configuration error
|
|
And the error should mention "unknown_type"
|
|
|
|
Scenario: Stream network visualization
|
|
Given I have a complex stream configuration with multiple agents and streams
|
|
When I request a stream visualization
|
|
Then I should get a diagram representation
|
|
And it should show all agents and streams
|
|
And their connections should be clear
|
|
|
|
Scenario: Application disposal
|
|
Given I have a running reactive application
|
|
When I dispose of the application
|
|
Then all streams should be closed
|
|
And all agents should be cleaned up
|
|
And no resources should be leaked
|
|
|
|
Scenario: Unsafe mode enforcement
|
|
Given I have a configuration requiring unsafe mode:
|
|
"""
|
|
context:
|
|
global:
|
|
unsafe: true
|
|
|
|
agents:
|
|
file_agent:
|
|
type: tool
|
|
config:
|
|
tools: ["file_write"]
|
|
"""
|
|
When I try to run without the unsafe flag
|
|
Then I should get an unsafe configuration error
|
|
And the application should not start
|
|
|
|
Scenario: Multiple configuration files
|
|
Given I have multiple reactive configuration files
|
|
When I load all configuration files
|
|
Then they should be merged correctly
|
|
And the application should work with the combined configuration
|
|
|
|
Scenario: API key resolution
|
|
Given I have an agent configuration without API key
|
|
And I have the OPENAI_API_KEY environment variable set
|
|
When I create the agent with API key from environment
|
|
Then it should use the environment variable
|
|
And initialize successfully
|
|
|
|
Scenario: Template engine configuration
|
|
Given I have a configuration with Jinja2 templates:
|
|
"""
|
|
cleveragents:
|
|
template_engine: JINJA2
|
|
|
|
agents:
|
|
test_agent:
|
|
type: llm
|
|
config:
|
|
model: gpt-4
|
|
"""
|
|
When I load the configuration
|
|
Then the template engine should be initialized
|
|
|
|
Scenario: Stream subscriptions are not duplicated
|
|
Given I have a basic chat configuration with stream routes
|
|
And the stream router is properly initialized
|
|
When I set up stream operations with merges and splits
|
|
Then subscriptions should be set up only once during stream creation
|
|
And no duplicate subscriptions should be created during stream operations
|
|
And interactive sessions should return single responses
|