Spaces:
Runtime error
Runtime error
File size: 1,305 Bytes
3304258 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # 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()) |