How to Build Your First AI Agent (No-Code & Code)
Build your first AI agent in an afternoon — a no-code path with n8n, and a Python code example. India-first, beginner-friendly.
Building an AI agent sounds intimidating, but in 2026 it's genuinely a weekend project. This guide gives you a no-code path first, then a real Python example, plus the ₹ costs to expect so there are no surprises on your card.
What do you need before you build an agent?
- A brain — an LLM API key or a no-code tool that includes one.
- Tools — what the agent can do: search the web, send an email, query a sheet.
- A trigger — what starts it: a chat message, a new row in a sheet, or a schedule.
- A clear goal — one specific job, like 'summarise new emails and post to Slack.'
How do I build an AI agent with no code?
Step 1: Pick your platform
Create a free account on n8n (self-host free, or cloud trial). Popular in India because you can self-host on a cheap ₹400/month VPS.
Step 2: Add a trigger
Use a 'Chat' or 'Webhook' trigger so you can send the agent a topic.
Step 3: Add the LLM node
Drop in an AI node, paste your API key, and write the system prompt telling it its role and output format.
Step 4: Add a tool
Connect a tool node — e.g. an HTTP request to search the web, or a Google Sheets node to save the output.
Step 5: Test and deploy
Send a test message, check the output, then turn the workflow on so it runs automatically.
How do I build an AI agent with code?
When you outgrow no-code, Python gives you full control. The pattern is the same: an LLM that decides, and a function (tool) it can call.
# A minimal AI agent: the LLM decides when to call a tool.
def get_city_weather(city: str) -> str:
# In real life, call a weather API here.
fake_db = {"mumbai": "31C, humid", "delhi": "38C, dry"}
return fake_db.get(city.lower(), "No data")
tools = [{"name": "get_city_weather", "description": "Get weather for an Indian city", "parameters": {"city": "string"}}]
def run_agent(user_message):
decision = call_llm(user_message, tools) # LLM returns text OR a tool call
if decision.get("tool") == "get_city_weather":
result = get_city_weather(decision["args"]["city"])
return call_llm(f"Tool result: {result}. Answer the user.")
return decision["text"]
print(run_agent("What's the weather in Mumbai?"))The key idea: the LLM doesn't run the tool itself. It asks to run the function, your code runs it, and you feed the result back. This loop is the heart of every agent.
No-code vs code: which should you choose?
| Factor | No-code (n8n/Make) | Code (Python) |
|---|---|---|
| Setup time | Minutes | An hour+ |
| Skill needed | None | Basic Python |
| Flexibility | Limited to nodes | Unlimited |
| Cost to start | Free-₹400/mo VPS | Free (your laptop) |
| Best for | Automations, quick wins | Custom products, scale |
Frequently asked questions
Can I build an AI agent for free?
Yes for learning. Self-hosted n8n is free, many LLM APIs give free starter credits, and you can run a Python script on your own laptop. You pay only for always-on hosting or heavy usage.
Do I need to know Python to build an agent?
Not to start. No-code tools like n8n let you build a real agent with zero code. Learn basic Python only when you want full control or to ship a custom product.
Which is better for beginners, n8n or code?
Start with n8n. Its visual flow makes the agent loop easy to understand. Move to Python once you hit the limits of pre-built nodes.
Save this summary as an image or share it.
AICreatorHub Team
Hands-on AI practitioners covering tools, models and news for India.