Spaces:
Runtime error
Runtime error
Download test_agent.py from junaidte14/aiverse: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/spaces/junaidte14/aiverse/resolve/main/test_agent.py
- Command line
-
hf download hf://spaces/junaidte14/aiverse/test_agent.py
-
curl -L -o test_agent.py https://huggingface.co/spaces/junaidte14/aiverse/resolve/main/test_agent.py
1.31 kB
| # scripts/test_agent.py | |
| import asyncio | |
| from app.services.agents.agent_service import AgentService | |
| from app.services.agents.templates import get_order_taking_template | |
| async def test_agent(): | |
| """Test agent creation and execution""" | |
| # This is a simulation - in production use actual DB session | |
| print("π€ Testing Agent System\n") | |
| # Load template | |
| template = get_order_taking_template() | |
| print(f"β Loaded template: {template['name']}") | |
| print(f" Steps: {len(template['config']['steps'])}") | |
| print(f" Actions: {len(template['config']['actions'])}\n") | |
| # Simulate conversation flow | |
| print("π¬ Simulating Conversation:\n") | |
| responses = [ | |
| "John Doe", | |
| "john@example.com", | |
| "555-1234", | |
| "2 large pizzas", | |
| "123 Main St" | |
| ] | |
| for i, step in enumerate(template['config']['steps']): | |
| print(f"Agent: {step['prompt']}") | |
| print(f"User: {responses[i]}") | |
| print(f"β Collected: {step['field']} = {responses[i]}\n") | |
| print("β Workflow completed!") | |
| print("π§ Executing actions...") | |
| print(" - Sending confirmation email") | |
| print(" - Saving to Google Sheets") | |
| print("\nπ Order processed successfully!") | |
| if __name__ == "__main__": | |
| asyncio.run(test_agent()) |