proactive_tools
proactive_tools
¶
Proactive agent tools — check/record permissions, queue and execute actions.
These tools are used exclusively by ProactiveAgent to manage the
propose → approve → execute lifecycle for autonomous actions.
Permission key convention: "{action_type}:{context_key}"
Approval response parsing
When the user replies to a pending-actions notification, their message is expected to contain one or more tokens of the form:
``{action_id} yes`` or ``{action_id} no``
``yes {action_id}`` or ``no {action_id}``
``always yes {action_id}`` → approve + remember
``always no {action_id}`` → deny + remember
``yes all`` / ``no all`` → bulk approve/deny all pending
Call parse_approval_response(text, store) from any channel message handler
to process these replies without running the full agent.
Classes¶
CheckPermissionTool
¶
CheckPermissionTool(store: Optional[ApprovalStore] = None)
QueueActionTool
¶
QueueActionTool(store: Optional[ApprovalStore] = None)
GetPendingActionsTool
¶
GetPendingActionsTool(
store: Optional[ApprovalStore] = None,
)
RecordDecisionTool
¶
RecordDecisionTool(store: Optional[ApprovalStore] = None)
ExecutePendingActionsTool
¶
ExecutePendingActionsTool(
store: Optional[ApprovalStore] = None,
executor_fn: Optional[Any] = None,
)
Bases: BaseTool
Execute all approved (or trivial) actions and return a summary.
Source code in src/diapason/tools/proactive_tools.py
Functions:¶
parse_approval_response
¶
parse_approval_response(
text: str, store: Optional[ApprovalStore] = None
) -> List[Dict[str, Any]]
Parse a free-text message for approval tokens and update the store.
Returns a list of dicts describing each decision that was processed, for use in an acknowledgement message back to the user.
Call this from any channel message handler before routing the message to the main agent, e.g. inside the iMessage daemon or Telegram bot.