Set your OpenAI API key as an environment variable in your terminal:
Copy
export OPENAI_API_KEY=your_openai_api_key_here
2
Create a file
Create a new file airbnb_search.py with the following code:
Copy
from praisonaiagents import Agent, MCPsearch_agent = Agent( instructions="""You help book apartments on Airbnb.""", llm="gpt-4o-mini", tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt"))search_agent.start("I want to book an apartment in Paris for 2 nights. 03/28 - 03/30 for 2 adults")
3
Install Dependencies
Make sure you have Node.js installed, as the MCP server requires it:
from praisonaiagents import Agent, MCPimport gradio as grdef search_airbnb(query): agent = Agent( instructions="You help book apartments on Airbnb.", llm="gpt-4o-mini", tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt") ) result = agent.start(query) return f"## Airbnb Search Results\n\n{result}"demo = gr.Interface( fn=search_airbnb, inputs=gr.Textbox(placeholder="I want to book an apartment in Paris for 2 nights..."), outputs=gr.Markdown(), title="Airbnb Booking Assistant", description="Enter your booking requirements below:")if __name__ == "__main__": demo.launch()