A small demo of an LLM agent with tool use: single Python file, OpenRouter API, and a few tools (time, math, book meeting). Built to show the basics of function calling and the agent loop in one place.
- Chat loop with an assistant (via OpenRouter).
- Tools: get current time, evaluate math expressions, “book” a meeting (name + time).
- Optional TTS on macOS using
say(toggle withTTS_ENABLEDinagent.py).
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -r requirements.txtSet your OpenRouter API key:
export OPENROUTER_API_KEY=your_key_hereGet a key at openrouter.ai.
python agent.pyThen type messages; Jimmy can use the tools (e.g. “What time is it?”, “What’s 2 + 3 * 4?”, “Book a meeting with Alice tomorrow at 3pm”) and you’ll see tool calls and results in the terminal.
agent.py— agent loop, tool definitions, and tool runner (all in one file for the demo).requirements.txt—openai(used against OpenRouter’s OpenAI-compatible API).