> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # Agent > LiveKit-compatible agent class that holds instructions, tools, and user data. [agentsession]: /docs/server-sdks/reference/typescript/agents/livewire/agent-session [agentbase]: /docs/server-sdks/reference/typescript/agents/agent-base [functiontool]: /docs/server-sdks/reference/typescript/agents/livewire/function-tool The `Agent` class mirrors a LiveKit voice agent. It holds the system prompt (instructions), a set of tools, and optional user data. When bound to an [`AgentSession`][agentsession], the session translates this into a SignalWire [`AgentBase`][agentbase] under the hood. ```typescript {11-14} import { Agent, tool } from '@signalwire/sdk/livewire'; const getWeather = tool({ description: 'Get the current weather for a city.', parameters: { city: { type: 'string' } }, execute: (params) => { return `It is sunny in ${params.city}.`; }, }); const agent = new Agent({ instructions: 'You are a helpful weather assistant.', tools: [getWeather], }); ``` ## **Constructor** ```typescript {1-13} new Agent(options?: { instructions?: string; tools?: FunctionTool[]; userData?: UserData; chatCtx?: unknown; stt?: unknown; tts?: unknown; llm?: unknown; vad?: unknown; turnDetection?: unknown; mcpServers?: unknown; allowInterruptions?: boolean; minEndpointingDelay?: number; maxEndpointingDelay?: number; }) ``` > **Info** > > The constructor options are source-compatible with LiveKit's `Agent` > constructor, including pipeline fields like `stt`, `tts`, `vad`, > `turnDetection`, and `mcpServers`. SignalWire handles speech, TTS, and VAD on > the control plane, so those fields are accepted but logged as a no-op the > first time they are supplied. **`instructions`** `string` — default: "" System prompt text. Mapped to the SignalWire prompt when the session starts. --- **`tools`** `FunctionTool[]` — default: \[] Array of [`FunctionTool`][functiontool] objects. Stored internally as a name-keyed record; each tool is registered as a SWAIG function on the underlying agent. --- **`userData`** `UserData` — default: undefined Arbitrary data attached to the agent. Accessible from tool handlers via `RunContext.userData`. --- **`llm`** `unknown` Accepted for LiveKit parity. Pipeline mapping hint — SignalWire selects the model from the SWML `ai.params`. --- **`allowInterruptions`** `boolean` Accepted for LiveKit parity. Forwarded to the SignalWire AI params when the session starts. --- **`minEndpointingDelay`** `number` Accepted for LiveKit parity. Forwarded to the SignalWire AI params when the session starts. --- **`maxEndpointingDelay`** `number` Accepted for LiveKit parity. Forwarded to the SignalWire AI params when the session starts. --- **`stt / tts / vad / turnDetection / mcpServers`** `unknown` Accepted for LiveKit source compatibility. SignalWire handles these capabilities on the control plane; passing a value logs a one-time "no-op" advisory and does not affect behavior. --- ## **Properties** **`instructions`** `string` The system prompt text for the agent. Can be read or modified directly. --- **`tools`** `Record` Internal name-keyed map of registered tools. --- **`userData`** `UserData | undefined` The user data attached to this agent. --- **`session`** `AgentSession | undefined` The [`AgentSession`][agentsession] bound to this agent, if any. Set when `session.start({ agent })` is called. --- ## **Example** ```typescript {13-17} import { Agent, AgentSession, tool, defineAgent, runApp, JobContext } from '@signalwire/sdk/livewire'; const lookupAccount = tool({ description: 'Look up a customer account by email.', parameters: { email: { type: 'string' } }, execute: (params) => { return `Account found for ${params.email}: Premium tier.`; }, }); const agentDef = defineAgent({ entry: async (ctx: JobContext) => { const agent = new Agent({ instructions: 'You are a customer support agent. Help users with their accounts.', tools: [lookupAccount], userData: { department: 'support' }, }); const session = new AgentSession(); await session.start({ agent }); session.generateReply({ instructions: 'Greet the customer and ask how you can help.' }); }, }); runApp(agentDef); ``` > LiveKit-compatible agent class that holds instructions, tools, and user data.