Agents in 60 lines of python : Part 1
The Agent Function Lesson 1 of 9 — A Tour of Agents Every time you send a message to ChatGPT, Claude, or any LLM — your app makes one HTTP POST request and gets a response back. That's it. No magic...

Source: DEV Community
The Agent Function Lesson 1 of 9 — A Tour of Agents Every time you send a message to ChatGPT, Claude, or any LLM — your app makes one HTTP POST request and gets a response back. That's it. No magic. No framework. One function. This is where agents start. What is an agent, really? Strip away the buzzwords and an AI agent is a pipeline with four steps: Your message → agent() → POST /completions → Response Your message goes in. A function wraps it into the right format. An HTTP call goes out. A response comes back. That flow diagram is the entire architecture of Lesson 1. There's no orchestration engine. No agent framework. Just a function that talks to an API. The function Here's the core of it — a function called ask_llm: async def ask_llm(messages): resp = await pyfetch( "https://api.groq.com/v1/chat/completions", method="POST", headers={"Authorization": f"Bearer {KEY}"}, body=json.dumps({ "model": "llama-3.3-70b", "messages": messages }) ) data = await resp.json() return data["choices