adk_agent_instruction (erlang_adk v0.7.0)

View Source

Safe static/dynamic instruction resolution for an agent specification.

Dynamic providers receive a deliberately narrow read-only context. Service handles, credential references, authentication values, and arbitrary runner internals are never passed to provider code. Template placeholders can read only the supplied scoped-state snapshot or an artifact from the exact scope supplied by the runner.

Summary

Functions

Conservative credential-key detector shared by template validation and the dynamic callback's state projection.

Resolve one instruction. Options require timeout_ms, artifact_timeout_ms, and max_bytes.

Types

error_reason/0

-type error_reason() ::
          invalid_instruction | instruction_too_large | invalid_instruction_context |
          invalid_instruction_callback | instruction_callback_timeout | instruction_callback_failed |
          instruction_callback_error | invalid_instruction_callback_result |
          {secret_template_key, binary()} |
          {instruction_state_not_found, binary()} |
          {instruction_artifact_not_found, binary()} |
          {instruction_artifact_unavailable, binary()} |
          {invalid_instruction_artifact, binary()}.

instruction/0

-type instruction() :: {static, [segment()]} | {dynamic, module(), atom()}.

segment/0

-type segment() :: {text, binary()} | {placeholder, state | artifact, binary(), boolean()}.

Functions

compile(Value, MaxBytes)

-spec compile(binary() | string() | {dynamic, module(), atom()}, pos_integer()) ->
                 {ok, instruction()} | {error, error_reason()}.

is_secret_key(Key)

-spec is_secret_key(term()) -> boolean().

Conservative credential-key detector shared by template validation and the dynamic callback's state projection.

resolve(Instruction, Context0, Options)

-spec resolve(instruction(), map(), map()) -> {ok, binary()} | {error, error_reason()}.

Resolve one instruction. Options require timeout_ms, artifact_timeout_ms, and max_bytes.