Giving Scribe Tools
Function calling.
A customer asks, where's my order? No document contains that. The answer sits in Bright Books' order database. So Scribe needs to be able to do things, not just read. That's function calling, and it's the first step toward AI agents.

- Where's my order?
- The answer is in a database
- Scribe needs to act
A tool the model can call
We write an ordinary Python function that looks up an order. The doc string tells the model what it's for. We pass it in as a tool. The model can't run anything by itself. It asks for the function to be called, with the right arguments, and this library runs it, and hands back the result. Run it. It chose the tool, pulled the number out of the sentence, and wrote a natural reply. Our Agentic AI course takes this much further, into systems that plan and act over many steps.
from google import genai
from google.genai import types
ORDERS = {"48213": "shipped, arriving Friday"}
def order_status(order_id: str) -> str:
"""Look up the delivery status of an order."""
return ORDERS.get(order_id, "not found")
client = genai.Client()
reply = client.models.generate_content(
model="gemini-flash-latest",
contents="Where is my order 48213?",
config=types.GenerateContentConfig(tools=[order_status]))
print(reply.text)Your order #48213 has shipped and is scheduled to arrive this Friday. Direct use of automatic function calling (AFC) in Models.generate_content is not recommended. Instead, we recommend to use AFC in Chat.send_message. Similarly, direct use of AFC in Models.generate_content_stream is not recommended. Instead, we recommend to use AFC in Chat.send_message_stream.
Summary
Tools let a model reach real data. Keep them safe, with read-only access wherever you can. Next, let's go global. Bright Books wants customers everywhere, in every language, and even by voice.
Key takeaways- Functions become tools
- The doc string explains the tool
- Keep tools limited