> 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. # registerWithAgent > Register this DataMap as a SWAIG function on an agent. [ref-datamap]: /docs/server-sdks/reference/typescript/agents/data-map Register this DataMap as a SWAIG function on an agent. Converts the DataMap to a SWAIG function definition and registers it with the agent's `registerSwaigFunction` method. ## **Parameters** **`agent`** `object` — required An object with a `registerSwaigFunction(fn: Record)` method (typically an `AgentBase` instance). --- ## **Returns** [`DataMap`][ref-datamap] -- Self for method chaining. ## **Example** ```typescript {10} import { AgentBase, DataMap, FunctionResult } from '@signalwire/sdk'; const dm = new DataMap('get_weather'); dm.purpose('Look up current weather'); dm.parameter('city', 'string', 'City name', { required: true }); dm.webhook('GET', 'https://api.weather.com/v1/current?q=${args.city}'); dm.output(new FunctionResult('Weather: ${response.current.condition.text}')); const agent = new AgentBase({ name: 'weather-agent' }); dm.registerWithAgent(agent); ``` > Register this DataMap as a SWAIG function on an agent.