Skip to main content
Tools are functions that agents invoke to perform specific operations. The SDK supports four tool types: custom Python tools (MCP), inline JavaScript tools, platform tool library references, and knowledge tools.

Prerequisites

  • AgenticAI Core SDK installed and configured.
  • Python 3.8+ for custom tool development.
  • Familiarity with async/await in Python.

Tool types

Custom tools (MCP)

Create Python functions using the @Tool.register decorator. These tools register automatically to ToolsRegistry and support request context, logging, tracing, and type-safe parameters:

Inline tools

Define tools directly in configuration with JavaScript code:

Tool library

Reference pre-built platform tools:

Knowledge tools

Access knowledge bases and RAG systems:

Use request context

Access request metadata inside any tool using RequestContext:

Memory operations

Use context.get_memory() to store and retrieve session data:
Always check result.success before accessing data. Provide fallback values for missing data and use projections to retrieve only the fields you need.

Logging

Use the Logger class for structured logging. Initialize it with a tool name and call the appropriate log level method:
Available log levels:

Distributed tracing

Decorate tools with @tracer.observe to capture execution spans:

Add tools to agents

Pass tools to AgentBuilder during configuration. Custom tools registered with @Tool.register are available automatically at runtime:

Best practices

  • Tool design: Keep tools focused on a single operation. Write clear, detailed descriptions — the agent uses these to decide when to call a tool. Use meaningful parameter names. Handle errors explicitly.
  • Logging: Log tool entry, exit, and parameter values. Log errors with enough context to diagnose the issue. Use the appropriate log level for each message.
  • Memory: Always check result.success before using returned data. Use projections to fetch only required fields. Handle missing or null data with fallback values.
  • Error handling: Catch and log exceptions. Return meaningful error messages. Avoid exposing sensitive data in error responses.
  • Performance: Keep tools lightweight and focused. Use async/await correctly — avoid blocking calls. Monitor execution times with distributed tracing.