CodeCrafter-creator

AI Agent Tool Calling — AI skill for Claude Code

AI community

Python AI agent with Claude tool-calling, FastAPI endpoint, retry logic with exponential backoff, per-tool error isolation, and structured logging.

How to install AI Agent Tool Calling

This entry records only its repository, not the path inside it, so there is no exact command to give. Open CodeCrafter-creator/ai-agent-tool-calling and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What AI Agent Tool Calling does

Python AI agent with Claude tool-calling, FastAPI endpoint, retry logic with exponential backoff, per-tool error isolation, and structured logging. Portfolio project demonstrating production-grade agent architecture — not a demo.

Alternatives in AI

  • New Task Type — Scaffold all server-side files for a new AI task type: endpoint, handler, logic, queue routing 66 ★
  • Divi5 ToolKit — The first Claude Code plugin for Divi 5 development 54 ★
  • Velora — Your AI-powered personal wealth advisor 37 ★

README

AI Agent with Tool Calling

[![GitHub repo](https://img.shields.io/badge/GitHub-ai--agent--tool--calling-181717?logo=github)](https://github.com/CodeCrafter-creator/ai-agent-tool-calling)

A small, production-style FastAPI service that demonstrates an AI agent using Anthropic Claude's **tool-calling (function-calling)** feature to decide, per request, which of three tools to run — then actually runs it and returns a structured result.

The problem this demonstrates

A lot of "AI features" are really just a single prompt → single response. The harder, more realistic problem is: a user sends one free-form request, and the system has to (a) figure out *what kind* of request it is, (b) route it to the right piece of backend logic, (c) execute that logic safely, and (d) return something predictable to the caller — even when the underlying AI call or the chosen tool fails.

This project is a minimal but real implementation of that pattern:

  • Intent classification is delegated to Claude's tool-calling, instead of hand-written keyword/if-else routing (see the comment at the top of app/agent.py for why).
  • Execution is isolated per tool, so one tool failing (bad input, a missing key, an API hiccup) never takes down the whole request.
  • Resilience is built in at the one place that actually talks to an external API (app/retry_utils.py): transient failures get retried with exponential backoff; permanent failures (bad API key, bad request) fail immediately instead of retrying something that can never succeed.

Architecture

                      ┌─────────────────────────┐
  POST /query         │        FastAPI           │
  {"query": "..."} ───▶   app/main.py             │
                      │   - validates request    │
                      │   - calls run_agent()     │
                      │   - 502 on agent failure  │
                      └────────────┬──────────────┘
                                   │