LLMs & Generative AI

Tool Calling & Agents

Tool calling lets a model request typed external operations. An agent is an application loop that lets the model plan, call tools, observe results, update state, and continue until done or stopped.
  • Tools are typed capabilities exposed by your application
  • The model should not own authorization
  • Agents are control loops
  • Long-horizon agents need budgets
  • Agent evals measure task completion
Agent loop sketch
state = initial_task
while not state.done and budget.remaining():
    step = model.plan(state, available_tools)
    if step.kind == "tool_call":
        args = validate_schema(step.args)
        authorize(user, step.tool, args)
        result = run_tool(step.tool, args)
        state = state.with_observation(result)
    else:
        return validate_answer(step.answer)
The model proposes; the application enforces.
Tool safety checklist
ConcernApplication responsibility
SchemaValidate types, required fields, ranges
AuthorizationCheck user/session/tenant permissions
Side effectsConfirm risky actions, make idempotent
ObservabilityLog tool name, args summary, result, cost
FailureHandle timeouts, retries, partial results
Sources
  • OpenAI API DocumentationFunction calling; Agents SDK
  • Claude Prompt Engineering and Evaluation DocsTool use and prompt engineering
  • Hugging Face LLM CourseAdvanced LLM topics