The .env file is created when you download your agent code:
xpander init
This downloads your agent code from the platform with the .env file pre-configured with your keys.
custom_tools_example.py
from dotenv import load_dotenvload_dotenv()from xpander_sdk import Backend, register_toolfrom agno.agent import Agent@register_tooldef weather_check(location: str) -> str: """Check weather for a location""" return f"Weather in {location}: Sunny, 25°C"backend = Backend()agno_agent = Agent(**backend.get_args())agno_agent.print_response(message="What's the weather in Tel Aviv?")
This example shows automatic tool discovery where the agent recognizes it needs weather information, calls the custom weather_check tool seamlessly during conversation, and uses the tool’s response to provide a complete answer. Tools are registered with type hints and docstrings that help the AI understand their purpose and usage.