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
Optional[str]Defaults to None

Optional instructions to include in the reply.

Returns

None

Example

1from signalwire.livewire import Agent, AgentSession, AgentServer, JobContext, run_app
2
3server = AgentServer()
4
5@server.rtc_session()
6async def entrypoint(ctx: JobContext):
7 await ctx.connect()
8 agent = Agent(instructions="You are a helpful assistant.")
9 session = AgentSession()
10 await session.start(agent, room=ctx.room)
11 session.generate_reply(instructions="Please introduce yourself to the caller.")
12
13run_app(server)