RequirementAgent
is a declarative AI agent that combines language models, tools, and execution requirements to create predictable, controlled behavior across different LLMs.
RequirementAgent
provides a declarative framework for designing agents that strikes a balance between flexibility and control. It allows for agent behavior that is both predictable and adaptable, without the complexity and limitations of more rigid systems.
You can define rules that control when and how tools are used.
ThinkTool
to reason about the requestOpenMeteoTool
DuckDuckGoSearchTool
(at least once)Attribute | Description |
---|---|
target | The tool the rule applies to |
allowed | Whether the tool can be used |
hidden | Whether the tool’s definition is visible to the agent |
prevent_stop | Whether the rule blocks termination |
forced | Whether the tool must be invoked |
prevent_stop
rules are respectedThinkTool
for reasoning followed by DuckDuckGoSearchTool
to retrieve data. This trajectory ensures that even a small model can arrive at the correct answer by preventing it from skipping tool calls entirely.
Think
tool after every other tool:
ConditionalRequirement(ThinkTool, force_at_step=1, force_after=Tool, consecutive_allowed=False)
, where the option consecutive_allowed=False
prevents ThinkTool
from being used multiple times in a row.ThinkTool
after every other action.
my_tool
.
weather_tool = ...
) or a class (OpenMeteoTool
) rather than a tool’s name. Some tools may have dynamically generated names.remove_data
or the get_data
tool.
init(tools)
method:tools
is a list of available tools for a given agent.init
method is None
.run(state)
method:state
is a generic parameter; in RequirementAgent
, it refers to the RequirementAgentRunState
class.run
method is a list of rules.