AI Agents - lesson 2 | HackIndia Skills | HackIndia
AI Agents
Define reliable tool schemas
Why schemas matter
A tool schema is the contract between the model and your code. It tells the model what the tool does, what inputs are allowed, and what shape to expect back.
Current agent systems use tools for actions like fetching data, running code, calling APIs, or using a computer. The model decides when to request a tool call, but your app or provider executes it.
Key point
One idea
A reliable tool schema removes guessing. If the name, description, and input fields are vague, the model will call the wrong tool or pass bad arguments.
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.
0 of 5 done
Example
Tool schema file
Put schemas in a visible file, not hidden inside a long agent script. This helps hackathon reviewers see that your agent has a real tool boundary.
This example is for a campus event helper. The tool only searches events. It does not book seats or send messages.
{
"name": "search_campus_events",
"description": "Search public campus events by city, date, and topic. Use this when the user asks for events to attend, not when they want to register.",
"risk": "low",
"input_schema": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "Indian city name, for example Bengaluru, Pune, Delhi, or Jaipur."
},
"date": {
"type": "string",
"description": "Date in YYYY-MM-DD format."
},
"topic": {
"type": "string",
"description": "Event topic, for example AI, web3, design, finance, or open source."
},
"max_results": {
"type": "integer",
"description": "Maximum number of events to return. Use 1 to 10."
}
},
"required": ["city", "date", "topic", "max_results"]
},
"output_schema": {
"type": "object",
"properties": {
"events": {
"type": "array",
"description": "List of matching public events with title, date, venue, and source_url."
},
"error": {
"type": "string",
"description": "Empty string when successful, otherwise a short error message."
}
}
}
}
Common mistake
Avoid broad tools
Do not create one tool called do_task, run_command, or manage_user. Broad tools make the model invent hidden behaviour.
Split risky actions from safe reads. For example, search_campus_events is safe. register_for_event should be a separate tool, because it changes something and may need approval.
Tip
Use AI carefully
You can ask ChatGPT, Gemini, or Claude to draft schemas from your app idea. Then check every field yourself.
Check three things: can a developer implement this function, can the model know when to use it, and can bad inputs be rejected before execution.
Prompt:
I am building a tool-calling agent for a hackathon project. Draft JSON tool schemas for these tools: search campus events, summarize one event page, and save a shortlist. For each tool include name, description, risk, input_schema, output_schema, and one example call. Keep write actions separate from read actions.
Keep outputs boring
Tool outputs should be structured and predictable. Return JSON-like data your agent can read, not a paragraph full of styling.
Include errors as data. A failed API call, missing event, or invalid date should return a clear error field so the next lesson’s call-result loop can handle it.
Your to-do
Do this now
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.