fleet-memory/hindsight-api-slim/hindsight_api/engine
Kagura 585ac76f39
fix(claude-code): implement tool_choice support for forced tool calls (#733)
* fix(claude-code): implement tool_choice support for forced tool calls

The call_with_tools() method now properly handles the tool_choice parameter
to force specific tool calls. Previously, the parameter was accepted but ignored,
causing the reflect agent to fail when trying to force specific tools on each
iteration.

Fixes #732

Changes:
- When tool_choice forces a specific function: filter allowed_tools to only
  that tool (with mcp prefix) and add a strong system prompt instruction
- When tool_choice is 'required': add instruction that model must call at
  least one tool
- When tool_choice is 'none': clear allowed_tools and mcp_servers to disable
  all tools
- When tool_choice is 'auto' (default): no change (existing behavior)

This matches the approach used in the OpenAI provider while adapting to the
Claude Agent SDK's lack of native tool_choice parameter by using allowed_tools
filtering and system prompt instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix ruff formatting in alembic migration

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 10:30:53 +02:00
..
consolidation feat: add max_observations_per_scope bank config (#729) 2026-03-30 10:29:56 +02:00
directives feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
parsers feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
providers fix(claude-code): implement tool_choice support for forced tool calls (#733) 2026-03-30 10:30:53 +02:00
reflect feat(reflect): make source facts in search_observations configurable (#688) 2026-03-25 17:54:49 +01:00
retain perf(stats): add bank_id to memory_links for direct filtering (#718) 2026-03-27 16:12:13 +01:00
search fix: control plane UI fixes for recall and data view (#693) 2026-03-25 18:42:57 +01:00
storage feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
__init__.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
audit.py feat: add audit log for feature usage tracking (#717) 2026-03-27 09:52:03 +01:00
cross_encoder.py docs: add config vars for local reranker FP16 and bucket batching (#589) 2026-03-16 17:35:09 +01:00
db_budget.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
db_utils.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
embeddings.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
entity_resolver.py fix(entity_resolver): prevent _pending_stats/_pending_cooccurrences memory leak (#662) 2026-03-23 16:06:04 +01:00
interface.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
jina_mlx_reranker.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
llm_interface.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
llm_wrapper.py feat: add support for ark and volcano LLM providers (#714) 2026-03-26 17:14:13 +01:00
memory_engine.py perf(stats): add bank_id to memory_links for direct filtering (#718) 2026-03-27 16:12:13 +01:00
operation_metadata.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
query_analyzer.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
response_models.py fix: return metadata in recall responses (#680) 2026-03-25 11:24:18 +01:00
task_backend.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
utils.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00