acoustic-pharmacist-34178
04/13/2026, 5:15 PMtall-airline-16756
04/13/2026, 5:15 PMtall-airline-16756
04/13/2026, 5:15 PMsession.say() or session.generate_reply() inside the tool — leaving those out prevents audio output.
3. Return the extracted value (or a structured object) from the tool so the agent/LLM receives it for further programmatic handling.
◦ If you want the tool to act silently and not prompt any LLM reply, you can return None after storing/using the value internally.
1. If the JSON lives on the client, use a client RPC tool to fetch it, apply steps 1–3 in that tool, and return the value silently.
If you’d like, tell me:
• where the JSON is (tool backend vs frontend),
• an example JSON and the key you want, and
I’ll give a short code example tailored to your setup.
Sources: Function tool definition | LiveKit Documentation | Agent Builder | LiveKit Documentation, with interactive elementsacoustic-pharmacist-34178
04/13/2026, 5:17 PMtall-airline-16756
04/13/2026, 5:17 PMacoustic-pharmacist-34178
04/13/2026, 5:18 PMtall-airline-16756
04/13/2026, 5:18 PMacoustic-pharmacist-34178
04/13/2026, 5:18 PMtall-airline-16756
04/13/2026, 5:19 PMsession.say() or session.generate_reply()) in the tool — omitting those prevents audio. 3) If you want the tool to be entirely silent to the LLM while still acting, you can store/use the value internally and return `None`; otherwise return the extracted value so the agent receives it for further logic.
Minimal example (backend tool):
def find_value_tool(input_json, query):
# extract/match value (example: exact or fuzzy logic here)
matched = my_matching_function(input_json, query)
# do NOT call session.say() or session.generate_reply()
return matched # or return None if you want no LLM response at all
If JSON is client-side, call a client RPC tool that performs the same steps and returns the matched value without invoking speech.
If you want, share one line of your tool environment (backend vs client) and I’ll give a 1–2 line code example that fits it.
, with interactive elementsacoustic-pharmacist-34178
04/13/2026, 5:23 PMtall-airline-16756
04/13/2026, 5:23 PMsession.say() / session.generate_reply()).
Python (tool) example:
from livekit_tools import AgentTask # adjust import to your SDK
def agent_find_json_value(agent_client, json_obj, query):
task = AgentTask(
instruction=f"Find the best-matching value in this JSON for: {query}",
input={"json": json_obj, "query": query},
# ensure task settings don't auto-generate speech (if SDK has such flags)
)
# run the agent task and get its programmatic response
result = agent_client.run_task(task)
# result contains the agent's returned value (no audio generated if tool avoids speech calls)
return result # could be a string, object, or None
Notes:
• Inside the agent/tool logic, parse the input and return the matched value without calling session.say() or session.generate_reply().
• If you want the agent completely silent to the LLM loop, have the tool store/use the value and return `None`; otherwise return the value so you can act on it programmatically.
If you want, tell me whether you prefer a short example using exact/fuzzy/semantic matching and I’ll provide the matching snippet.
, with interactive elementsacoustic-pharmacist-34178
04/13/2026, 5:29 PMtall-airline-16756
04/13/2026, 5:29 PMsession.say() / session.generate_reply()).
Quick examples:
1) Using AgentTask (already shown) — run the task and read the returned value; ensure the agent/tool implementation does not call speech.
2) Direct LLM call (pseudo-Python):
# call the LLM client directly from your tool
response = llm_client.generate(
messages=[{"role":"system","content":"Extract the best matching value."},
{"role":"user","content":f"JSON: {json_obj}\nQuery: {query}"}],
# any other params...
)
# do NOT call session.say() or session.generate_reply()
value = parse_response(response) # extract the matched value programmatically
return value # or return None if you want no LLM/agent reply at all
If you tell me which SDK/language you’re using (Python, Node, or specific LiveKit client), I’ll give a 1–2 line exact snippet for that environment.
, with interactive elementsacoustic-pharmacist-34178
04/13/2026, 5:30 PMtall-airline-16756
04/13/2026, 5:31 PM# inside a @function_tool or AgentTask method with RunContext or self.session
llm_client = ctx.session.llm # or self.session.llm
chat_ctx = llm.ChatContext()
chat_ctx.add_message(role="user", content=f"JSON: {json_obj}\nQuery: {query}")
response = await llm_client.chat(chat_ctx=chat_ctx).collect()
value = parse_response(response.text)
return value # no session.say()/session.generate_reply() => no audio
2) Instantiate directly (standalone)
from livekit.agents import inference, llm
llm_client = inference.LLM(model="openai/gpt-4.1-mini")
response = await llm_client.chat(chat_ctx).collect()
Key points:
• Use ctx.session.llm or self.session.llm when inside agent/tool code.
• Do not call session.say() or session.generate_reply() — omitting those prevents audio.
• Return the extracted value (or return None if you want completely silent completion). Sources: Bring your LangChain Agents to LiveKit | LiveKit | Large language models (LLM) overview | LiveKit Documentation, with interactive elementsacoustic-pharmacist-34178
04/13/2026, 5:32 PMtall-airline-16756
04/13/2026, 5:32 PMfrom livekit.agents import inference, llm
llm_client = inference.LLM(model="openai/gpt-4.1-mini")
chat_ctx = llm.ChatContext()
chat_ctx.add_message(role="user", content=f"JSON: {json_obj}\nQuery: {query}")
response = await llm_client.chat(chat_ctx=chat_ctx).collect()
value = parse_response(response.text)
# no session.say() or session.generate_reply() — nothing is spoken
2) Why this stays out of session chat:
• You created and used a separate llm_client instance instead of ctx.session.llm or self.session.llm, so the call is not recorded in the active session chat state.
3) Checklist to ensure silence and separation:
• Use a standalone LLM instance (as above).
• Do not call session.say() or session.generate_reply().
• Return or store the parsed value programmatically (or return None if you want no agent reply).
If you want a 1–2 line snippet for Node or the exact matching prompt to extract values, tell me which language and I’ll provide it.
, with interactive elements