aiverse / test_agent.py
junaidte14's picture
agents initial version maybe issues
3304258
Raw History Blame Contribute Delete
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())