Spaces:
Runtime error
Runtime error
Download dev-agent/tests/test_dev_agent.py from BeastGokul/MVP: direct link, hf CLI and curl.
- Browser
- Download file 1.89 kB
-
https://huggingface.co/spaces/BeastGokul/MVP/resolve/main/dev-agent/tests/test_dev_agent.py
- Command line
-
hf download hf://spaces/BeastGokul/MVP/dev-agent/tests/test_dev_agent.py
-
curl -L -o test_dev_agent.py https://huggingface.co/spaces/BeastGokul/MVP/resolve/main/dev-agent/tests/test_dev_agent.py
1.89 kB
| import pytest | |
| from app.agents.dev_agent import DevAgent | |
| def test_dev_agent_clarification_flow(): | |
| agent = DevAgent() | |
| history = [] | |
| # 1. First prompt (generic requirement description) | |
| result = agent.process( | |
| session_id="test-session", | |
| user_message="I want to create an agent that analyzes incoming support requests and alerts.", | |
| history=history, | |
| state_init=None | |
| ) | |
| assert result["status"] == "awaiting_clarification" | |
| assert len(result["clarification_questions"]) > 0 | |
| assert result["draft_spec"] is None | |
| def test_dev_agent_complete_generation_flow(): | |
| agent = DevAgent() | |
| # Simulate collected requirements state | |
| state_init = { | |
| "extracted_requirements": { | |
| "name": "Support Alert Agent", | |
| "description": "Analyzes alerts and posts to REST API", | |
| "trigger": "api", | |
| "connection": "api", | |
| "connection_base_url": "https://api.pagerduty.com", | |
| "error_on_failure": "retry", | |
| "retry_max_attempts": 3, | |
| "mode": "workflow" | |
| }, | |
| "missing_information": [], | |
| "clarification_questions": [], | |
| "draft_spec": None, | |
| "validation_result": None, | |
| "status": "collecting_requirements" | |
| } | |
| result = agent.process( | |
| session_id="test-session", | |
| user_message="Make the API connection base URL https://api.pagerduty.com and trigger via API call. Failures should retry 3 times.", | |
| history=[], | |
| state_init=state_init | |
| ) | |
| assert result["status"] == "completed" | |
| assert result["draft_spec"] is not None | |
| assert result["draft_spec"]["name"] == "Support Alert Agent" | |
| assert result["draft_spec"]["connection"]["config"]["base_url"] == "https://api.pagerduty.com" | |
| assert result["draft_spec"]["error_handling"]["retry"]["max_attempts"] == 3 | |