Common Patterns
Production-ready patterns for conversation lifecycle, user enrichment, webhooks, and routing.
1. Conversation Lifecycle Management
from amigo_sdk import AsyncAmigoClient
from amigo_sdk.models import (
ConversationCreateConversationRequest,
CreateConversationParametersQuery,
InteractWithConversationParametersQuery,
Format,
)
async def run_conversation():
async with AsyncAmigoClient() as client:
# 1. Create conversation
params = CreateConversationParametersQuery(
service_id="your-service-id",
response_format="text",
)
body = ConversationCreateConversationRequest()
conversation_id = None
async for event in await client.conversations.create_conversation(body, params):
if hasattr(event, "conversation_id"):
conversation_id = event.conversation_id
# Handle greeting events...
# 2. Interact
interact_params = InteractWithConversationParametersQuery(
request_format=Format.text,
response_format="text",
)
async for event in await client.conversations.interact_with_conversation(
conversation_id,
interact_params,
text_message="Hello, I need help with my account",
):
print(event)
# 3. Finish
await client.conversations.finish_conversation(conversation_id)2. User Model Enrichment Pipeline
3. Webhook-Driven Memory Sync
4. Multi-Service Routing
5. Simulation-Driven Deployment
Last updated
Was this helpful?

