A Jido.Action for breaking down complex goals into hierarchical sub-goals.
This action uses ReqLLM with a specialized system prompt for goal decomposition, creating hierarchical structures that break complex goals into manageable pieces.
Parameters
model(optional) - Model alias (e.g.,:planning) or direct specgoal(required) - The goal to decomposemax_depth(optional) - Maximum depth of decomposition (default:3)context(optional) - Additional context about the goalmax_tokens(optional) - Maximum tokens to generate (default:4096)temperature(optional) - Sampling temperature (default:0.6)timeout(optional) - Request timeout in milliseconds
Examples
# Basic decomposition
{:ok, result} = Jido.Exec.run(Jido.AI.Actions.Planning.Decompose, %{
goal: "Build a mobile app"
})
# With specific depth
{:ok, result} = Jido.Exec.run(Jido.AI.Actions.Planning.Decompose, %{
goal: "Launch a startup",
max_depth: 4
})
# With context
{:ok, result} = Jido.Exec.run(Jido.AI.Actions.Planning.Decompose, %{
goal: "Organize a conference",
context: "Technology conference with 500 attendees, limited budget"
})
Summary
Functions
Returns the Action metadata. Alias for to_json/0.
Returns the category of the Action.
Returns the description of the Action.
Returns the name of the Action.
Lifecycle hook called after Action execution.
Lifecycle hook called after output validation.
Lifecycle hook called after parameter validation.
Lifecycle hook called before output validation.
Lifecycle hook called before parameter validation.
Lifecycle hook called when an error occurs.
Returns the output schema of the Action.
Executes the decompose action.
Returns the input schema of the Action.
Returns the tags associated with the Action.
Returns the Action metadata as a JSON-serializable map.
Converts the Action to an LLM-compatible tool format.
Validates the output result for the Action.
Validates the input parameters for the Action.
Returns the version of the Action.
Functions
Returns the Action metadata. Alias for to_json/0.
Returns the category of the Action.
Returns the description of the Action.
Returns the name of the Action.
Lifecycle hook called after Action execution.
Lifecycle hook called after output validation.
Lifecycle hook called after parameter validation.
Lifecycle hook called before output validation.
Lifecycle hook called before parameter validation.
Lifecycle hook called when an error occurs.
Returns the output schema of the Action.
Executes the decompose action.
Returns
{:ok, result}- Successful response withdecomposition,sub_goals,goal, andusagekeys{:error, reason}- Error from ReqLLM or validation
Result Format
%{
decomposition: "The full decomposition text",
sub_goals: ["Sub-goal 1", "Sub-goal 2", ...],
goal: "The original goal",
depth: 3,
model: "anthropic:claude-sonnet-4-20250514",
usage: %{...}
}
Returns the input schema of the Action.
Returns the tags associated with the Action.
Returns the Action metadata as a JSON-serializable map.
Converts the Action to an LLM-compatible tool format.
Validates the output result for the Action.
Examples
iex> defmodule ExampleAction do
...> use Jido.Action,
...> name: "example_action",
...> output_schema: [
...> result: [type: :string, required: true]
...> ]
...> end
...> ExampleAction.validate_output(%{result: "test", extra: "ignored"})
{:ok, %{result: "test", extra: "ignored"}}
iex> ExampleAction.validate_output(%{extra: "ignored"})
{:error, "Invalid output for Action: Required key :result not found"}
Validates the input parameters for the Action.
Examples
iex> defmodule ExampleAction do
...> use Jido.Action,
...> name: "example_action",
...> schema: [
...> input: [type: :string, required: true]
...> ]
...> end
...> ExampleAction.validate_params(%{input: "test"})
{:ok, %{input: "test"}}
iex> ExampleAction.validate_params(%{})
{:error, "Invalid parameters for Action: Required key :input not found"}
Returns the version of the Action.