@@ -12,24 +12,27 @@ The `Agent` class is a fluent builder for configuring AI agent properties. It co
1212
1313<!-- snippet: executable -->
1414``` python
15- from agora_agent import Agent
16-
17- agent = Agent(
18- name = ' support-assistant' ,
19- instructions = ' You are a helpful voice assistant.' ,
20- greeting = ' Hello! How can I help you?' ,
21- failure_message = ' Sorry, something went wrong.' ,
22- max_history = 20 ,
15+ from agora_agent import Agent, OpenAI
16+
17+ agent = Agent(name = ' support-assistant' ).with_llm(
18+ OpenAI(
19+ api_key = ' your-openai-key' ,
20+ model = ' gpt-4o-mini' ,
21+ system_messages = [{' role' : ' system' , ' content' : ' You are a helpful voice assistant.' }],
22+ greeting_message = ' Hello! How can I help you?' ,
23+ failure_message = ' Sorry, something went wrong.' ,
24+ max_history = 20 ,
25+ )
2326)
2427```
2528
2629| Parameter | Type | Required | Description |
2730| ---| ---| ---| ---|
2831| ` name ` | ` str ` | No | Agent display name (used as session name if not overridden) |
29- | ` instructions ` | ` str ` | No | System prompt for the LLM |
30- | ` greeting ` | ` str ` | No | Message spoken when the agent joins |
31- | ` failure_message ` | ` str ` | No | Message spoken on error |
32- | ` max_history ` | ` int ` | No | Maximum conversation history length |
32+ | ` instructions ` | ` str ` | No | Deprecated. Use LLM vendor ` system_messages ` instead. |
33+ | ` greeting ` | ` str ` | No | Deprecated. Use LLM/MLLM vendor ` greeting_message ` instead. |
34+ | ` failure_message ` | ` str ` | No | Deprecated. Use LLM/MLLM vendor ` failure_message ` instead. |
35+ | ` max_history ` | ` int ` | No | Deprecated. Use LLM vendor ` max_history ` instead. |
3336| ` turn_detection ` | ` TurnDetectionConfig ` | No | Turn detection settings |
3437| ` sal ` | ` SalConfig ` | No | SAL (Speech Activity Level) configuration |
3538| ` advanced_features ` | ` Dict[str, Any] ` | No | Advanced features (e.g., ` {'enable_rtm': True} ` ) |
@@ -57,15 +60,15 @@ Each `with_*` method returns a **new** `Agent` instance — the original is unch
5760
5861| Method | Accepts | Purpose |
5962| ---| ---| ---|
60- | ` with_instructions(text) ` | ` str ` | Override the system prompt |
61- | ` with_greeting(text) ` | ` str ` | Override the greeting message |
63+ | ` with_instructions(text) ` | ` str ` | Deprecated. Use LLM vendor ` system_messages ` instead. |
64+ | ` with_greeting(text) ` | ` str ` | Deprecated. Use LLM/MLLM vendor ` greeting_message ` instead. |
6265| ` with_name(name) ` | ` str ` | Override the agent name |
6366| ` with_turn_detection(config) ` | ` TurnDetectionConfig ` | Override cascading-flow SOS/EOS detection; use ` with_interruption() ` for interruption behavior |
6467| ` with_sal(config) ` | ` SalConfig ` | Set SAL configuration |
6568| ` with_advanced_features(features) ` | ` Dict[str, Any] ` | Set advanced features |
6669| ` with_parameters(parameters) ` | ` SessionParams ` | Set session parameters |
67- | ` with_failure_message(message) ` | ` str ` | Set failure message |
68- | ` with_max_history(max_history) ` | ` int ` | Set max history length |
70+ | ` with_failure_message(message) ` | ` str ` | Deprecated. Use LLM/MLLM vendor ` failure_message ` instead. |
71+ | ` with_max_history(max_history) ` | ` int ` | Deprecated. Use LLM vendor ` max_history ` instead. |
6972| ` with_geofence(geofence) ` | ` GeofenceConfig ` | Set geofence configuration |
7073| ` with_labels(labels) ` | ` Dict[str, str] ` | Set custom labels |
7174| ` with_rtc(rtc) ` | ` RtcConfig ` | Set RTC configuration |
@@ -79,8 +82,12 @@ from agora_agent import Agent
7982from agora_agent import OpenAI, ElevenLabsTTS, DeepgramSTT
8083
8184agent = (
82- Agent(name = ' my-agent' , instructions = ' You are a helpful assistant.' )
83- .with_llm(OpenAI(api_key = ' your-openai-key' , model = ' gpt-4o-mini' ))
85+ Agent(name = ' my-agent' )
86+ .with_llm(OpenAI(
87+ api_key = ' your-openai-key' ,
88+ model = ' gpt-4o-mini' ,
89+ system_messages = [{' role' : ' system' , ' content' : ' You are a helpful assistant.' }],
90+ ))
8491 .with_tts(ElevenLabsTTS(key = ' your-elevenlabs-key' , model_id = ' eleven_flash_v2_5' , voice_id = ' your-voice-id' ))
8592 .with_stt(DeepgramSTT(api_key = ' your-deepgram-key' , language = ' en-US' ))
8693)
@@ -97,8 +104,12 @@ from agora_agent import Agent, Agora, Area, OpenAI, ElevenLabsTTS, DeepgramSTT
97104client = Agora(area = Area.US , app_id = ' your-app-id' , app_certificate = ' your-app-certificate' )
98105
99106base = (
100- Agent(instructions = ' You are a helpful assistant.' )
101- .with_llm(OpenAI(api_key = ' your-openai-key' , model = ' gpt-4o-mini' ))
107+ Agent()
108+ .with_llm(OpenAI(
109+ api_key = ' your-openai-key' ,
110+ model = ' gpt-4o-mini' ,
111+ system_messages = [{' role' : ' system' , ' content' : ' You are a helpful assistant.' }],
112+ ))
102113 .with_tts(ElevenLabsTTS(key = ' your-elevenlabs-key' , model_id = ' eleven_flash_v2_5' , voice_id = ' your-voice-id' ))
103114 .with_stt(DeepgramSTT(api_key = ' your-deepgram-key' , language = ' en-US' ))
104115)
0 commit comments