Skip to content

Tools & Auto Tooling

Agently ships a built‑in tool system so the model can decide when to call tools, then inject tool results back into the reply. Core capabilities:

  • Tool registration via function signatures and type hints
  • Auto decision before calling tools
  • Result injection into action_results

Register tools

Use @agent.tool_func to register a tool from a function:

python
from typing import Annotated
from agently import Agently

agent = Agently.create_agent()

@agent.tool_func
async def add(
  a: Annotated[int, "first number"],
  b: Annotated[int, "second number"],
) -> int:
  """Return a + b"""
  return a + b

You can also use register_tool:

python
agent.register_tool(
  name="add",
  desc="Return a + b",
  kwargs={"a": (int, "first number"), "b": (int, "second number")},
  func=add,
)

Auto use (use_tools / use_tool)

use_tools() attaches tools to the agent. The model decides whether to call a tool.

python
response = (
  agent
  .input("34643523+52131231=? Use tool to calculate!")
  .use_tool(add)
  .get_response()
)

result = response.get_data()
print(result)

Tool logs

Tool calls are stored under extra.tool_logs in the full response data.

python
full = response.get_data(type="all")
print(full["extra"]["tool_logs"])

To show tool logs in console:

python
from agently import Agently
Agently.set_settings("runtime.show_tool_logs", True)