Ash FrameworkAF
Ash Framework3w ago
5 replies
alfie

AshAI tool discovery missing some tools

Hi!
i've had a problem trying to use AshAI to create tools out of some actions, and i think i may have found a bug (i've barely started learning Ash so i might be missing something)
i have a ressource with these policies :
policies do
    policy action_type(:create) do
      authorize_if relating_to_actor(:client)
    end

    policy action_type([:read, :update, :destroy]) do
      authorize_if relates_to_actor_via(:client)
    end
  end


and these tools configured in the domain :
    tool :create_note, Myapp.Clients.ClientNote, :create
    tool :read_notes, Myapp.Clients.ClientNote, :read


using :
tools = AshAi.exposed_tools(otp_app: :myapp, actor: actor)
IO.inspect(Enum.map(tools, & &1.name), label: "Tools ")

i only get :
Tools : [:read_notes]


digging into it, it seems that relating_to_actor fails pre-flight checks, stopping the tool from being shown.
Is this expected behavior, a bug, or did i miss something?
Was this page helpful?