Core Insight: Code as Tool Invocation
Instead of JSON tool schemas and message passing, the LLM writes and executes Python code directly. Tools become Python functions. No schema translation, no parsing layers, no abstraction tax.
# Traditional agent (JSON tool calls)
{"tool": "search", "args": {"query": "latest news"}}
{"tool": "summarize", "args": {"text": "..."}}
# smolagents (Python code)
results = search("latest news")
summary = summarize(results["text"][:1000])
final_answer(summary)