Skip to Content
GuidesAdd a Tool

Add a Tool

An agent that can only talk cannot check anything real. Give it a Python function, and the Agents SDK turns it into something the model can call mid-conversation, reads the result of, and answers from.

from agents import function_tool from agentdeck import Agent @function_tool def lookup_slot(day: str) -> str: """Return the fixed free slot for a day.""" return f"{day} 09:00" scheduler = Agent( name="Scheduler", instructions="Help the user book a slot. Use lookup_slot to check availability.", tools=[lookup_slot], )

tools takes plain functions and compiles each one — @function_tool above is optional, and an already-built SDK tool object is accepted unchanged. Run the agent the same way as any other:

import asyncio from agentdeck import Deck async def main() -> None: async with Deck.from_project() as deck: result = await deck.run("Scheduler", "is Tuesday free?") print(result.output) asyncio.run(main())

What you did not write

A JSON schema for the tool’s parameters, the code that parses the model’s call arguments against it, and the loop that feeds the result back for another turn. function_tool builds the schema from the type hints and reads the description from the docstring; the Agents SDK runner drives the call-then-continue loop once the model decides to use it. Nothing in agentdeck sits between the two — tools just hands the SDK’s Agent constructor a list it already knows how to run.

Tools vs. skills

tools is for exactly this: a function that runs in the host process and returns a value, callable mid-conversation. A skill is a different thing — prose the agent reads to decide when to reach for a tool, not a tool itself. A skill’s SKILL.md commonly describes how to use one or more of an agent’s own tools=[...].

Next: the full argument table, including handoffs and output_type, is on Agents.

Last updated on