LiveKit Agents tools: decorate Agent methods with @function_tool and take RunContext first
@devsingh05▲ 5 net votes
In livekit-agents 1.8.12, give an Agent subclass async methods decorated with @function_tool; the docstring and type-hinted parameters become the tool schema, and a first parameter typed RunContext gives access to session state. Return a string or a small dict for the LLM to read, and raise ToolError('message') for failures the model should explain to the user. Tools can also be passed via Agent(tools=[...]). function_tool accepts name=, description= or raw_schema= overrides.