Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

ValueError: tool_choice and tool_config.tool_choice must match

Open
#175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api, backend

Research direction

Start with the tool_choice validation in llama_stack/distribution/routers/routers.py, then trace how AgentConfig and tool_config values reach chat_completion. Reproduce the AgentConfig example with tool_choice set to required and verify that matching values no longer raise the reported ValueError.

Written by the indexing model from the issue text.

Description

Not able to set tool_choice to "required"

Below is my code...

self.agent_config = AgentConfig(
            model=MODEL_NAME,
            instructions=WEB_SEARCH_INSTRUNCTION_PROMPT,
            sampling_params={
                "strategy": {
                    "type": "greedy",
                },
            },
            toolgroups=["builtin::websearch"],
            tool_choice="required", # This is throwing error when changed to required from auto.
            input_shields=[],
            output_shields=[],
            enable_session_persistence=False,
        )

Error Logs ....

Traceback (most recent call last):
2025-03-01 15:56:53   File "/usr/local/lib/python3.10/site-packages/llama_stack/distribution/server/server.py", line 208, in sse_generator
2025-03-01 15:56:53     async for item in event_gen:
2025-03-01 15:56:53   File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/inline/agents/meta_reference/agents.py", line 169, in _create_agent_turn_streaming
2025-03-01 15:56:53     async for event in agent.create_and_execute_turn(request):
2025-03-01 15:56:53   File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 189, in create_and_execute_turn
2025-03-01 15:56:53     async for chunk in self.run(
2025-03-01 15:56:53   File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 258, in run
2025-03-01 15:56:53     async for res in self._run(
2025-03-01 15:56:53   File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 493, in _run
2025-03-01 15:56:53     async for chunk in await self.inference_api.chat_completion(
2025-03-01 15:56:53   File "/usr/local/lib/python3.10/site-packages/llama_stack/providers/utils/telemetry/trace_protocol.py", line 89, in async_wrapper
2025-03-01 15:56:53     result = await method(self, *args, **kwargs)
2025-03-01 15:56:53   File "/usr/local/lib/python3.10/site-packages/llama_stack/distribution/routers/routers.py", line 144, in chat_completion
2025-03-01 15:56:53     raise ValueError("tool_choice and tool_config.tool_choice must match")
2025-03-01 15:56:53 ValueError: tool_choice and tool_config.tool_choice must match
Dominant language
Python
Stars
198
Forks
102
PR merge metrics
No merged PRs in 30d

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ogx-ai/ogx-client-python

All issues in ogx-ai/ogx-client-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.