fix: disable tool call pruning at browser agent factory level

Move prune_tool_calls_from_memory=False from chat_service persistent
agent override to browser factory directly, so all browser agents
(workforce and @mention) retain tool call history.
This commit is contained in:
puzhen 2026-02-27 01:33:30 +00:00
parent 53cc86ce59
commit b5e2bc2206
2 changed files with 4 additions and 8 deletions

View file

@ -308,7 +308,7 @@ def browser_agent(options: Chat):
),
options,
tools,
prune_tool_calls_from_memory=True,
prune_tool_calls_from_memory=False,
tool_names=[
SearchToolkit.toolkit_name(),
HybridBrowserToolkit.toolkit_name(),

View file

@ -620,10 +620,6 @@ async def step_solve(options: Chat, request: Request, task_lock: TaskLock):
# Factory internally sends create_agent
# via ActionCreateAgentData in the queue
agent = await _create_persistent_agent(target, options)
# Persistent agents are reused across turns;
# keep tool call history so the LLM remembers
# what it did in previous turns.
agent.prune_tool_calls_from_memory = False
task_lock.persistent_agents[target] = agent
logger.info(
f"[DIRECT-AGENT] Created NEW "
@ -655,9 +651,9 @@ async def step_solve(options: Chat, request: Request, task_lock: TaskLock):
agent.process_task_id = options.task_id
# Build prompt: reused agents already have
# conversation history in their CAMEL memory,
# so only prepend context for brand-new agents.
# New agents need prior conversation context
# injected into the prompt; reused agents
# already have it in CAMEL memory.
if is_new_agent:
conv_ctx = build_conversation_context(
task_lock,