adk_tool_executor (erlang_adk v0.7.0)

View Source

Bounded execution for already-resolved tool calls.

A resolved call is a map containing name, args, and either module or an internal zero-arity execute function. Optional thought_signature and call_id values are copied unchanged to the result. Toolsets may also attach validated internal confirmation metadata; the executor preserves it but does not interpret or expose it to providers. Serial execution is the default. In parallel mode, only calls explicitly marked parallel_safe (or whose module opts in through parallel_safe/0 or schema metadata) overlap; an unsafe call is a barrier.

Summary

Types

call_result/0

-type call_result() ::
          #{index := pos_integer(),
            name := binary(),
            thought_signature := term(),
            call_id := term(),
            outcome := {ok, term()} | {error, term()} | {paused, term(), term()}}.

resolved_call/0

-type resolved_call() ::
          #{index => pos_integer(),
            name := binary(),
            args := map(),
            module => module(),
            execute => fun(() -> term()),
            thought_signature => term(),
            call_id => term(),
            context => map(),
            parallel_safe => boolean(),
            pause_capable => boolean(),
            confirmation => #{required := boolean(), hint => binary()},
            timeout => non_neg_integer() | infinity,
            deadline => integer() | infinity}.

Functions

await(TaskRef)

-spec await(adk_task:task_ref()) -> {ok, [call_result()]} | {error, term()}.

await(TaskRef, Timeout)

-spec await(adk_task:task_ref(), timeout()) -> {ok, [call_result()]} | {error, term()}.

cancel(TaskRef)

-spec cancel(adk_task:task_ref()) -> ok | {error, term()}.

cancel(TaskRef, Reason)

-spec cancel(adk_task:task_ref(), term()) -> ok | {error, term()}.

execute(Calls)

-spec execute([resolved_call()]) -> {ok, [call_result()]} | {error, term()}.

execute(Calls, Opts)

-spec execute([resolved_call()], map()) -> {ok, [call_result()]} | {error, term()}.

execute(Calls, Context, Opts)

-spec execute([resolved_call()], map(), map()) -> {ok, [call_result()]} | {error, term()}.

is_parallel_safe(Call)

-spec is_parallel_safe(resolved_call()) -> boolean().

is_pause_capable(Call)

-spec is_pause_capable(resolved_call()) -> boolean().

start(Calls)

-spec start([resolved_call()]) -> {ok, adk_task:task_ref()} | {error, term()}.

start(Calls, Opts)

-spec start([resolved_call()], map()) -> {ok, adk_task:task_ref()} | {error, term()}.

start(Calls, Context, Opts)

-spec start([resolved_call()], map(), map()) -> {ok, adk_task:task_ref()} | {error, term()}.