2.4.0

AgentTool

Package: flyte.ai.agents

A normalized tool descriptor used by :class:Agent.

Most users do not construct :class:AgentTool directly — pass plain callables, @flyte.trace helpers, or @env.task templates to :class:Agent and they will be wrapped automatically. Build one explicitly when you need to:

  • rename a tool for the LLM,
  • override the description shown to the model,
  • require human approval before execution (HITL),
  • inject a fully custom JSON schema.

Parameters

class AgentTool(
    name: str,
    description: str,
    parameters: dict[str, Any],
    execute: _ToolExecutor,
    requires_approval: bool,
    source: Literal['function', 'task', 'trace', 'remote_task', 'mcp', 'custom'],
)
Parameter Type Description
name str
description str
parameters dict[str, Any]
execute _ToolExecutor
requires_approval bool
source Literal['function', 'task', 'trace', 'remote_task', 'mcp', 'custom']

Methods

Method Description
to_openai_format() Convert to the OpenAI / litellm tools schema.

to_openai_format()

def to_openai_format()

Convert to the OpenAI / litellm tools schema.