I’m trying to run this piece of code that i have found in the docs Agents - Guided tour
from smolagents import CodeAgent, TransformersModel
model_id = “meta-llama/Llama-3.2-3B-Instruct”
model = TransformersModel(model_id=model_id)
agent = CodeAgent(tools=, model=model, add_base_tools=True)
agent.run(
“Could you give me the 118th number in the Fibonacci sequence?”,
)
At step 1, it gives me this output:
*Executing parsed code: ────────────────────────────────────────────────────────────────────────────────────────
Generate the Fibonacci sequence up to the 120th number (since indexing starts at 0)
fibonacci_sequence = fibonacci(n=120)
Find the index of the 118th number in the sequence
index = index(fibonacci_sequence, 118)
Use the index to get the 118th number
answer = fibonacci_sequence[index]
print(f"The 118th number in the Fibonacci sequence is {answer}")
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Code execution failed at line ‘fibonacci_sequence = fibonacci(n=120)’ due to: InterpreterError: Forbidden function
evaluation: ‘fibonacci’ is not among the explicitly allowed tools or defined/imported in the preceding code*
I’m really stucked into this problem sice i would like to continue the agent course without using HfAPI
Is anyone able to tell me which is the problem?