from praisonaiagents import Agent# Create an agentagent = Agent( name="Assistant", instructions="You are a helpful assistant.", llm="gpt-4o-mini")# Launch as HTTP serveragent.launch( path="/agent", port=8000, host="0.0.0.0" # Accept connections from any IP)# Agent is now accessible at http://localhost:8000/agent
try: session = Session(agent_url="remote-server:8000/agent") response = session.chat("Process this request")except ConnectionError as e: print(f"Failed to connect to remote agent: {e}") # Fallback to local agent or retryexcept TimeoutError as e: print(f"Request timed out: {e}")