import asyncio from agents import Runner, trace, gen_trace_id from port_recomendations import port_recommendations_agent async def get_port_recommendation(query: str): """Get port recommendations using the specialized agent""" trace_id = gen_trace_id() with trace("Port Recommendation", trace_id=trace_id): print(f"View trace: https://platform.openai.com/traces/trace?trace_id={trace_id}") try: result = await Runner.run( port_recommendations_agent, f"Query: {query}", max_turns=5, ) return result.final_output except Exception as e: print(f"Error during port recommendation: {e}") return f"An error occurred: {str(e)}" async def main(): """Test the port recommendations agent with various queries""" test_queries = [ "I need an unused port", "I need an unused port without redundancy", "I need to dual connect a server to the network, what ports should I use?", "What ports are available on leaf01?", "I need 4 ports for a new switch connection" ] for query in test_queries: print(f"\n{'='*60}") print(f"Query: {query}") print(f"{'='*60}") result = await get_port_recommendation(query) print(f"Recommendation: {result}") print() if __name__ == "__main__": asyncio.run(main())