This commit is contained in:
2026-08-09 06:50:37 +07:00
parent da16c80a0a
commit 6b3d575ea0
3 changed files with 192 additions and 2 deletions
+2 -1
View File
@@ -119,7 +119,8 @@ function loadTools(dir::String)::Vector{agentTool}
end
# Call getTool() — it runs in current scope where types are visible
tool = getTool()
# Use invokelatest to handle world-age semantics after include()
tool = invokelatest(getTool)
if !(tool isa agentTool)
throw(ArgumentError(
"getTool() in $(filepath) did not return an agentTool instance, got: $(typeof(tool))"
+11
View File
@@ -269,6 +269,17 @@ struct agentTool # A tool available to the agent
parallelToolExecute::Bool # Override: run tool calls sequentially or in parallel
end
"""
Keyword constructor for agentTool — allows `agentTool(name=..., label=..., ...)`.
"""
function agentTool(; name::String, label::String, description::String, inputSchema::Any,
execute::Function, prepareArguments::Union{Function, Nothing}=nothing,
validateRequiredArgs::Union{Function, Nothing}=nothing,
parallelToolExecute::Bool=false)
return agentTool(name, label, description, inputSchema, execute,
prepareArguments, validateRequiredArgs, parallelToolExecute)
end
# ------------------------------------------------------------------------------------------------ #
# Agent context #