Cost awareness in smolagents is handled through token usage tracking rather than direct dollar amounts. TokenUsage (defined in src/smolagents/monitoring.py) accumulates input_tokens and output_tokens for each ActionStep and PlanningStep. When return_full_result=True, the run-level RunResult.token_usage sums all step-level counts.
The benchmark (examples/smolagents_benchmark/) demonstrates that CodeAgent uses ~30% fewer steps than ToolCallingAgent for the same tasks, which directly translates to fewer LLM calls and lower cost. The planning_interval knob trades token cost (planning calls add tokens) against solution quality (plans help on long-horizon tasks). The max_steps hard limit on MultiStepAgent prevents runaway cost from infinite loops.
For providers with strict rate limits, ApiModel accepts a requests_per_minute float that activates RateLimiter throttling across all calls.
src/smolagents/monitoring.pysrc/smolagents/agents.pysrc/smolagents/models.py