Minimal agent loop: observe → decide → act → observe until the model returns a final answer.
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtSet your Groq API key (e.g. in .env or export):
export GROQ_API_KEY=your-key-herepython agent.py "Fetch https://api.github.com and tell me the current_user_url."With no argument, it uses a default prompt.
- Observe: Messages list (user input + assistant messages + tool results).
- Decide: One LLM call with tools; it can reply with text only (done) or request tool calls.
- Act: Run the requested tool (
get_request) and append results to messages. - Loop: Repeat until the model responds without tool calls or
max_stepsis reached.
Single tool: get_request(url) — performs a GET request to any URL and returns status and body.