Connectors¶
Agent Framework¶
tac_microsoft.agent_framework_connector ¶
Agent Framework connector for TAC
Connector logic (agent lifecycle, session management, tool factories) for Microsoft
Agent Framework. HTTP/WebSocket routing is delegated to TACFastAPIServer from the
tac package.
Key design:
create_agentfactory returns an Agent FrameworkAgent- Voice, SMS, chat, RCS, and WhatsApp channel instances are exposed as
voice_channel/sms_channel/chat_channel/rcs_channel/whatsapp_channel— pass whichever you need toTACFastAPIServerto wire up routing. Voice/SMS/Chat are always created; RCS and WhatsApp are created only when their address is configured (rcs_sender_id/whatsapp_numberonTACConfig), and areNoneotherwise.
Conversation history:
-
The bridge passes an
AgentSessionto everyagent.run()call so that Agent Framework can load/save conversation history automatically. -
Voice: agent + session are cached in-memory for the duration of the WebSocket call. The same agent handles all utterances within a single call, and history accumulates naturally. The session is also persisted to the
AgentSessionStorein the background (fire-and-forget) after each utterance and on disconnect, enabling auditing and persistence of Foundry thread IDs without impacting voice latency. -
SMS/chat: an
AgentSessionStorepersists theAgentSessionbetween messages. Before eachagent.run(), the bridge loads the session from the store (or creates a new one); after the run it saves the session back. This enables conversation continuity across messages for all provider types:- Foundry Agent Service: the server-side
thread_id(stored assession.service_session_id) is preserved so subsequent messages reuse the same thread. - Responses API / Chat Completions: session state (including messages
from
InMemoryHistoryProvider) is preserved across messages. The defaultInMemoryAgentSessionStoreworks for single-instance deployments. For horizontal scaling, supply a persistent store (Redis, CosmosDB, etc.) via thesession_storeparameter.
- Foundry Agent Service: the server-side
AgentFrameworkConnector ¶
AgentFrameworkConnector(
tac: Any,
create_agent: Callable[[ConversationSession], Agent],
on_message: Callable[
[
str,
ConversationSession,
TACMemoryResponse | None,
],
str,
]
| None = None,
on_error: Callable[
[Exception, ConversationSession], str
]
| None = None,
voice_config: VoiceChannelConfig
| dict[str, Any]
| None = None,
sms_config: SMSChannelConfig
| dict[str, Any]
| None = None,
chat_config: ChatChannelConfig
| dict[str, Any]
| None = None,
rcs_config: RCSChannelConfig
| dict[str, Any]
| None = None,
whatsapp_config: WhatsAppChannelConfig
| dict[str, Any]
| None = None,
session_store: AgentSessionStore | None = None,
)
Connector for Twilio channels (Voice, SMS, Chat, RCS, WhatsApp) with Agent Framework agents.
All channel flows are fully managed internally. The developer
supplies a create_agent factory and, optionally, hooks for message
augmentation and error handling. HTTP/WebSocket routing is handled
by TACFastAPIServer — pass voice_channel and/or messaging channels
(sms_channel / chat_channel / rcs_channel / whatsapp_channel)
to it to control which channels are active. RCS and WhatsApp are opt-in
(see rcs_config / whatsapp_config below); when not configured, the
corresponding attribute is None.
Conversation history is managed via Agent Framework's AgentSession.
For voice, the agent and session persist in-memory for the duration of
the WebSocket call, with background saves to the AgentSessionStore after
each utterance for persistence/auditing. For SMS and chat, the session
is loaded from and saved to the AgentSessionStore on every message.
Lifecycle callbacks (on_conversation_ended, on_interrupt) are
wired automatically to handle voice agent cleanup and logging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tac
|
Any
|
TAC instance. |
required |
create_agent
|
Callable[[ConversationSession], Agent]
|
|
required |
on_message
|
Callable[[str, ConversationSession, TACMemoryResponse | None], str] | None
|
Optional hook called before |
None
|
on_error
|
Callable[[Exception, ConversationSession], str] | None
|
Optional hook to customize error responses.
Signature: |
None
|
voice_config
|
VoiceChannelConfig | dict[str, Any] | None
|
Optional Voice channel configuration
( |
None
|
sms_config
|
SMSChannelConfig | dict[str, Any] | None
|
Optional SMS channel configuration
( |
None
|
chat_config
|
ChatChannelConfig | dict[str, Any] | None
|
Optional Chat channel configuration
( |
None
|
rcs_config
|
RCSChannelConfig | dict[str, Any] | None
|
Optional RCS channel configuration
( |
None
|
whatsapp_config
|
WhatsAppChannelConfig | dict[str, Any] | None
|
Optional WhatsApp channel configuration
( |
None
|
session_store
|
AgentSessionStore | None
|
Persistence layer for |
None
|
Voice Live¶
tac_microsoft.voice_live_connector ¶
Voice Live connector for TAC.
Connector logic for Azure AI Foundry Voice Live. Parallel to
AgentFrameworkConnector but uses Voice Live's WebSocket API for LLM
inference instead of Microsoft Agent Framework's agent.run().
Voice Live is used in text-only mode (modalities: ["text"]) because
Conversation Relay handles STT/TTS. The connector sends text in and
streams text deltas back.
Key design:
-
VoiceLiveConfigholds connection parameters, instructions, tools, and tool executors -
A
voice_channelinstance is exposed — pass it toTACFastAPIServer
Conversation history:
- A single
VoiceLiveSession(WebSocket) is kept open for the duration of the call. Voice Live manages conversation state server-side, so all utterances within a call share context.
VoiceLiveConnector ¶
VoiceLiveConnector(
tac: Any,
config: VoiceLiveConfig,
on_message: Callable[
[
str,
ConversationSession,
TACMemoryResponse | None,
],
str,
]
| None = None,
on_error: Callable[
[Exception, ConversationSession], str
]
| None = None,
voice_config: VoiceChannelConfig
| dict[str, Any]
| None = None,
)
Connector for Twilio voice using Azure Voice Live for LLM inference.
Parallel to AgentFrameworkConnector but uses Voice Live's WebSocket
API instead of Agent Framework. Voice Live manages conversation state
server-side, so no AgentSession or session store is needed.
This connector is voice-only. For SMS/messaging, use
AgentFrameworkConnector or a separate connector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tac
|
Any
|
TAC instance. |
required |
config
|
VoiceLiveConfig
|
|
required |
on_message
|
Callable[[str, ConversationSession, TACMemoryResponse | None], str] | None
|
Optional hook called before sending to Voice Live.
Signature: |
None
|
on_error
|
Callable[[Exception, ConversationSession], str] | None
|
Optional hook to customize error responses.
Signature: |
None
|
voice_config
|
VoiceChannelConfig | dict[str, Any] | None
|
Optional Voice channel configuration
( |
None
|
Voice Live configuration and errors¶
tac_microsoft.voice_live_types ¶
Type definitions for the Voice Live connector.
VoiceLiveError ¶
Bases: Exception
Raised when a Voice Live API error occurs.
VoiceLiveConfig
dataclass
¶
VoiceLiveConfig(
endpoint: str,
model: str,
api_key: str | None = None,
credential: Any = None,
api_version: str = "2025-10-01",
instructions: str = "",
tools: list[Any] = list(),
tool_executors: dict[
str, Callable[..., Awaitable[Any]]
] = dict(),
modalities: list[str] = (lambda: ["text"])(),
temperature: float | None = None,
max_response_output_tokens: int | str | None = None,
)
Configuration for connecting to Azure AI Foundry Voice Live.
Voice Live is used in text-only mode (modalities: ["text"]) because
Conversation Relay handles STT/TTS. The connector sends text in and
streams text deltas back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint
|
str
|
Azure resource hostname, e.g.
|
required |
model
|
str
|
Voice Live model name, e.g. |
required |
api_key
|
str | None
|
API key for authentication (mutually exclusive with credential). |
None
|
credential
|
Any
|
Azure identity credential for Entra token auth (mutually exclusive with api_key). |
None
|
api_version
|
str
|
Voice Live API version. |
'2025-10-01'
|
instructions
|
str
|
System instructions for the model. |
''
|
tools
|
list[Any]
|
Tool list — accepts |
list()
|
tool_executors
|
dict[str, Callable[..., Awaitable[Any]]]
|
Map of tool name to async callable that executes
the tool. Auto-populated from any |
dict()
|
modalities
|
list[str]
|
Session modalities. Defaults to |
(lambda: ['text'])()
|
temperature
|
float | None
|
Sampling temperature (0.6 – 1.2). |
None
|
max_response_output_tokens
|
int | str | None
|
Max output tokens per response. |
None
|