Skip to content

M19 solution: the same agent, eight ways (+ no-code)

One agent, a tool multiply(a, b) asked "What is 23 times 17?", built across every major agent framework, so you can see what each one does for you and pick the right tool per job. The agent is identical; only the ergonomics change.

Live runs call Claude and cost tokens (and need your ANTHROPIC_API_KEY). Read 01_from_scratch.py first, it's the loop all the others wrap.

The files

# File Framework Install Model string
1 01_from_scratch.py None (hand-rolled ReAct loop, Anthropic SDK) anthropic claude-opus-4-8
2 02_langgraph.py LangChain / LangGraph langgraph langchain-anthropic claude-opus-4-8 (ChatAnthropic)
3 03_crewai.py CrewAI (role/goal/task crews) crewai anthropic/claude-opus-4-8 (LiteLLM)
4 04_autogen.py Microsoft AutoGen (agentchat 0.4+) autogen-agentchat "autogen-ext[anthropic]" claude-opus-4-8 (native)
5 05_claude_agent_sdk.py Claude Agent SDK (tool via in-process MCP) claude-agent-sdk + Claude Code CLI claude-opus-4-8
6 06_smolagents.py Hugging Face smolagents "smolagents[litellm]" anthropic/claude-opus-4-8 (LiteLLM)
7 07_llamaindex.py LlamaIndex (FunctionAgent) llama-index-core llama-index-llms-anthropic claude-opus-4-8
8 08_openai_agents_sdk.py OpenAI Agents SDK → Claude "openai-agents[litellm]" anthropic/claude-opus-4-8 (LiteLLM)
- n8n_workflow.json n8n (no-code, importable) n8n app set in the node

Every framework needs Python 3.10-3.12 (a few don't yet ship 3.13/3.14 wheels) and reads ANTHROPIC_API_KEY from the environment. The three LiteLLM-routed ones (CrewAI, smolagents, OpenAI Agents SDK) need the anthropic/ prefix on the model string; the rest use the bare id.

What's actually verified (honest status)

File Verification done here
01_from_scratch.py Run for real: ReAct loop executed end-to-end with a mocked LLM + real tool; returns "391" in 2 turns (tool_use → tool_result → final).
02_langgraph.py Built for real: graph compiles to a CompiledStateGraph (__start__→agent→tools→__end__) with the multiply tool bound, on langgraph 1.2.5 + langchain-anthropic 1.4.6.
03, 08 Syntax-checked (py_compile) and written against current official docs (APIs confirmed: import paths, tool decorators, model strings). Marked pilot: install on Python 3.10-3.12 and run with your key; live calls cost tokens.
n8n_workflow.json Valid JSON, 4 nodes wired (trigger → agent ← model, ← tool). Import into n8n and add your Anthropic credential to run.

Why not run all eight live here? Each live run spends tokens and several frameworks lag the newest Python. The pattern (M18, M9): verify the loop/logic for real, mock or pilot the paid LLM call. The two anchors are verified by execution; the rest are doc-grounded reference you run as a pilot.

Run an anchor

# venv active (Python 3.10-3.12), key in .env
pip install anthropic python-dotenv
python 01_from_scratch.py            # -> "...391"

pip install langgraph langchain-anthropic
python 02_langgraph.py               # -> "...391"

The takeaway

  • 01 is the truth. Every framework is sugar over ask → maybe call tool → feed result back → repeat.
  • Single agent + tools? LangGraph, smolagents, LlamaIndex, OpenAI Agents SDK, Claude Agent SDK are all comfortable. Pick by what else you need (LangGraph for graph control; LlamaIndex if you're already doing RAG there; Claude Agent SDK to reuse MCP tools from M16).
  • Multi-agent crews/conversations? CrewAI (role-based crews) and AutoGen (conversational agents) lean into that, they map onto the orchestration shapes from M18.
  • No code? n8n wires the same agent in a visual canvas, great for ops/automation and non-developers.
  • APIs shift fast. If an import breaks, check that framework's current docs, the pattern (model + tools + run) is stable even when names move.