generate_reply

View as MarkdownOpen in Claude

Trigger the agent to generate a reply. On SignalWire the prompt handles generation automatically; when instructions is provided, it is queued as additional text to speak.

Parameters

instructions
str | NoneDefaults to None

Optional instructions to include in the reply.

Returns

None

Example

from signalwire.livewire import Agent, AgentSession, AgentServer, JobContext, run_app
server = AgentServer()
@server.rtc_session()
async def entrypoint(ctx: JobContext):
await ctx.connect()
agent = Agent(instructions="You are a helpful assistant.")
session = AgentSession()
await session.start(agent, room=ctx.room)
session.generate_reply(instructions="Please introduce yourself to the caller.")
run_app(server)