agent.tool audit events in _agent_reply
Browse files- freestream/bot.py +6 -2
freestream/bot.py
CHANGED
|
@@ -321,11 +321,15 @@ class BotSession:
|
|
| 321 |
self._spec_cancel = None
|
| 322 |
|
| 323 |
def _agent_reply(self, text: str) -> str:
|
| 324 |
-
"""Agent reply + event-log the character's physical actions (
|
| 325 |
-
|
| 326 |
reply = self.agent.reply(text)
|
| 327 |
for action in getattr(self.agent, "last_actions", []):
|
| 328 |
self.log.append("agent.action", text=action[:200])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
return reply
|
| 330 |
|
| 331 |
async def handle_utterance(self, utt: np.ndarray, speculative: bool = False):
|
|
|
|
| 321 |
self._spec_cancel = None
|
| 322 |
|
| 323 |
def _agent_reply(self, text: str) -> str:
|
| 324 |
+
"""Agent reply + event-log the character's physical actions (never
|
| 325 |
+
spoken) and tool calls (always audited — docs/CONSENT.md §6)."""
|
| 326 |
reply = self.agent.reply(text)
|
| 327 |
for action in getattr(self.agent, "last_actions", []):
|
| 328 |
self.log.append("agent.action", text=action[:200])
|
| 329 |
+
for tc in getattr(self.agent, "last_tool_calls", []):
|
| 330 |
+
self.log.append("agent.tool", tool=tc["tool"],
|
| 331 |
+
args=json.dumps(tc["args"])[:200],
|
| 332 |
+
ok=tc["ok"], output=tc["output"][:300])
|
| 333 |
return reply
|
| 334 |
|
| 335 |
async def handle_utterance(self, utt: np.ndarray, speculative: bool = False):
|