<#1242 add support for flyte io in agents> Pull re...
# flyte-github
a
#1242 add support for flyte io in agents Pull request opened by cosmicBboy This pull request introduces support for using Flyte IO types (
File
,
Dir
,
DataFrame
) as inputs and outputs for agent tools, enabling seamless integration of blob and structured-dataset types in LLM-driven workflows. It adds a new example demonstrating these capabilities, improves type coercion and serialization for agent tool arguments and results, and enhances the agent's system prompt to guide correct handling of IO types. Several internal utilities are updated to support these features. New Example and Documentation: • Added
io_types_agent.py
, an example agent demonstrating tools with
flyte.io.File
,
Dir
, and
DataFrame
inputs/outputs, including multi-step tool chaining and code-mode agent execution. Agent Tool Argument Coercion and Serialization: • Introduced
_coerce_tool_args
and updated agent tool execution to coerce LLM-provided JSON arguments to the correct Flyte types using type hints, ensuring proper handling of
File
,
Dir
, and
DataFrame
arguments. • Updated result serialization with
_stringify_tool_result
to handle Flyte IO types by serializing them to JSON before returning to the LLM. Agent Prompt and Tool Registry Enhancements: • Improved the agent's system prompt to provide explicit guidance for passing IO-type tool results as arguments to downstream tools, only when relevant tools are registered. • Added
_registry_uses_flyte_io
to detect when IO types are present in the tool registry and trigger the above prompt enhancement. CLI Parameter Parsing: • Updated CLI parameter parsing to use Flyte's JSON coercion for blob types, improving robustness and consistency for command-line workflows. These changes collectively make it easier to build LLM-powered agents that interact with Flyte's advanced IO types, enabling more complex and reliable toolchains. flyteorg/flyte-sdk