Files
cleveragents-core/tests/features/reactive_agents.feature

157 lines
4.0 KiB
Gherkin

Feature: Reactive Agent Processing
As a developer using CleverAgents
I want agents to work within reactive streams
So that I can build complex asynchronous agent workflows
Background:
Given the CleverAgents reactive system is available
Scenario: LLM Agent in stream processing
Given I have an LLM agent configuration:
"""
{
"name": "test_llm",
"type": "llm",
"config": {
"provider": "openai",
"model": "gpt-3.5-turbo",
"temperature": 0.7
}
}
"""
And I have a stream with the agent:
"""
{
"name": "llm_stream",
"type": "cold",
"operators": [
{
"type": "map",
"params": {
"agent": "test_llm"
}
}
]
}
"""
When I create the agent and stream
And I send a message "Hello" to the stream
Then the message should be processed by the LLM agent
And I should receive a response
Scenario: Tool Agent in stream processing
Given I have a tool agent configuration:
"""
{
"name": "test_tool",
"type": "tool",
"config": {
"tools": ["echo", "math"],
"safe_mode": true
}
}
"""
And I have a stream with the tool agent:
"""
{
"name": "tool_stream",
"type": "cold",
"operators": [
{
"type": "map",
"params": {
"agent": "test_tool"
}
}
]
}
"""
When I create the agent and stream
And I send a message "echo Hello World" to the stream
Then the tool should execute the echo command
And I should receive "Hello World" as output
Scenario: Agent with memory in stream
Given I have an LLM agent with memory enabled:
"""
{
"name": "memory_agent",
"type": "llm",
"config": {
"provider": "openai",
"model": "gpt-3.5-turbo",
"memory_enabled": true,
"max_history": 5
}
}
"""
When I create the agent for memory test
And I send multiple messages through the agent
Then the agent should remember previous conversations
And responses should be contextually aware
Scenario: Multiple agents in parallel streams
Given I have multiple agents:
"""
{
"classifier": {
"type": "llm",
"config": {
"provider": "openai",
"model": "gpt-3.5-turbo",
"system_prompt": "Classify as: positive, negative, or neutral"
}
},
"processor": {
"type": "llm",
"config": {
"provider": "openai",
"model": "gpt-4",
"system_prompt": "Process the classified input appropriately"
}
}
}
"""
And I have parallel processing streams
When I send a message to the classifier
Then it should classify the message
And the result should be sent to the processor
And I should get the final processed output
Scenario: Agent error handling in stream
Given I have an agent that might fail
And I have a stream with error handling:
"""
{
"name": "robust_stream",
"type": "cold",
"operators": [
{
"type": "map",
"params": {
"agent": "unreliable_agent"
}
},
{
"type": "catch"
},
{
"type": "retry",
"params": {
"count": 2
}
}
]
}
"""
When I send a message that causes the agent to fail
Then the error should be caught
And the operation should be retried
And eventually provide a fallback response
Scenario: Agent as stream operator
Given I have a streamable agent
When I use the agent as an RxPy operator
Then it should integrate seamlessly with RxPy pipelines
And provide async processing capabilities
And maintain proper error boundaries