Simple Agent Process
Inheritors
Constructors
Properties
The blackboard for this process. Implementations should delegate to it to implement the Blackboard interface for convenience, but explicitly separating it simplifies persistence.
Unique identifier of this blackboard. Blackboard doesn't extend StableIdentified to avoid conflict with implementations that are otherwise identified
If we failed, this may contain the reason for the failure.
History of actions taken by this process
True if this is a root process (no parent).
The last world state that was used to plan the next action Will be non-null if the process is running
Options this process was started with
How long this process has been running
Status of this operation
Functions
Add to entries without binding to a variable name. Implementations must respect the order in which entities were added. This is equivalent to using the default binding name as the key. For example, if you add a Dog to the blackboard without a key, it will be bound to the default binding name "it" and will be the last entry in the list of objects. Equivalent:
Bind a value to a name and mark it as protected. Protected bindings survive Blackboard.clear operations, which occur during state transitions. Use this for bindings that should persist across states, such as conversation history and user identity.
Count entries of the given type
Embedding cost = own + sum of each child's embedding cost (recursive).
Total embedding call count across the whole subtree.
Distinct embedding services used anywhere in the subtree, sorted by name.
Embedding usage aggregated across the whole subtree.
Expose the model data for use in prompts Prefer more strongly typed usage patterns
Get a variable value. Handles "it" default type specially, because it could be an "it" of different variables, defined as the most recently added entry.
Resolve the value of a variable, if it is set. Resolve superclasses For example, getValue("it", "Animal") will match a Dog if Dog extends Animal
Kill this process and return an event describing the kill if we are successful
Last entry of the given type, if there is one
Last result, of any type, if there is one.
Total LLM call count across the whole subtree.
Distinct LLMs used anywhere in the subtree, sorted by name. distinctBy { it.name } removes duplicates when the same model is used at multiple levels.
Return all objects of the given type
Return all entries of a specific type
Distinct LLMs used by this process's own invocations, excluding any child processes. See modelsUsed for the aggregate across the entire process subtree.
Token usage of this process's own LLM invocations, excluding any child processes. See usage for the LLM usage aggregate across the entire process subtree, and totalUsage for the usage including embeddings.
Record an embedding invocation against this process. Default implementation is a no-op for AgentProcess implementations that don't track embeddings; com.embabel.agent.core.support.AbstractAgentProcess provides a thread-safe storage.
Convenience function to get the result of a specific type
Run the process as far as we can. Might complete, fail, get stuck or hit a waiting state. This is a slow operation. We may wish to run this async. Events will be emitted as the process runs, so we can track progress.
Explicitly set the condition value Used in planning.
Spawn an independent child blackboard based on the content of this
Return a serializable status report for this process.
Request graceful termination of the current action only. The action will terminate at the next natural checkpoint (between tool calls), and the agent will continue with the next planned action.
Request graceful termination of the entire agent process. The agent will terminate at the next natural checkpoint (before next tick).
Perform the next step only. Return when an action has been completed and the process is ready to plan, regardless of the result of the action.
Combined cost/usage info across LLM and embedding invocations. Use this for a full report; use costInfoString for LLM-only.
Distinct models used (LLM and embedding), including any child processes when the implementation supports subtree aggregation. Use this when you want all models; use modelsUsed for LLM-only.
Total token usage combining LLM and embedding invocations, including any child processes when the implementation supports subtree aggregation. Use this when you want the full token usage; use usage for LLM-only.
Execute a block with this AgentProcess as the current process for the thread. Properly saves and restores any previous value, ensuring cleanup even on exception.