1- # Simplified OpenAI Agent Chat - Agent Platform Integration
1+ # OpenAI Temporal Integration Tutorial
22
3- This tutorial demonstrates the new ** Agent Platform Integration** for Agentex that dramatically simplifies agent development while preserving all Agentex infrastructure benefits .
3+ This tutorial demonstrates the ** Agent Platform Integration** for Agentex that provides a streamlined approach to agent development while maintaining full Agentex infrastructure compatibility .
44
55## Before vs After Comparison
66
@@ -13,31 +13,30 @@ This tutorial demonstrates the new **Agent Platform Integration** for Agentex th
1313| ** Error handling** | Manual try/catch and retry logic | Built-in recovery |
1414| ** ACP integration** | Manual message creation/sending | Automatic via bridge |
1515
16- ## Key Benefits
16+ ## Key Features
1717
18- ### 🚀 ** Dramatically Reduced Complexity**
19- - ** 90% reduction in code ** - from 277 lines to ~ 30 lines
20- - ** No manual orchestration ** - agent execution is automatically durable
21- - ** No activity definitions ** - tool calls are automatically temporal activities
18+ ### ** Reduced Complexity**
19+ - Simplified codebase: from 277 lines to ~ 30 lines
20+ - Automatic agent execution durability
21+ - Built-in tool call orchestration
2222
23- ### 🔧 ** Preserved Agentex Infrastructure**
24- - ** ACP protocol compatibility** - external clients unchanged
25- - ** Kubernetes deployment** - same Helm charts and configs
26- - ** Multi-tenant hosting ** - same agent discovery and routing
27- - ** Authentication & monitoring ** - same observability stack
23+ ### ** Infrastructure Compatibility **
24+ - Full ACP protocol compatibility
25+ - Existing deployment configurations work unchanged
26+ - Same authentication and monitoring systems
27+ - Multi-tenant hosting support maintained
2828
29- ### 🎯 ** Platform Agnostic Design**
30- - ** OpenAI Agents SDK** - this tutorial (implemented)
31- - ** LangChain** - future extension point
32- - ** CrewAI** - future extension point
33- - ** Custom frameworks** - extensible via strategy pattern
29+ ### ** Platform Extensibility**
30+ - OpenAI Agents SDK integration (implemented)
31+ - Extensible architecture for LangChain, CrewAI
32+ - Strategy pattern for custom frameworks
3433
3534## Implementation Details
3635
3736### Workflow Definition
3837``` python
3938@workflow.defn (name = environment_variables.WORKFLOW_NAME )
40- class SimplifiedOpenAIChatAgent (OpenAIAgentWorkflow ):
39+ class At040OpenAITemporalIntegration (OpenAIAgentWorkflow ):
4140 async def create_agent (self ) -> Agent:
4241 return Agent(
4342 name = " Tool-Enabled Assistant" ,
@@ -51,41 +50,41 @@ class SimplifiedOpenAIChatAgent(OpenAIAgentWorkflow):
5150``` python
5251worker = AgentexWorker(
5352 task_queue = environment_variables.WORKFLOW_TASK_QUEUE ,
54- agent_platform = " openai" , # Automatic optimization
53+ agent_platform = " openai" , # Platform optimization
5554)
56- await worker.run(activities = [], workflow = SimplifiedOpenAIChatAgent )
55+ await worker.run(activities = [], workflow = At040OpenAITemporalIntegration )
5756```
5857
59- ## Architecture Benefits
58+ ## Technical Architecture
6059
61- ### Automatic Durability
62- - ** Agent executions** become Temporal activities automatically
63- - ** Tool calls** are durable with automatic retries
64- - ** Conversation state** persists across workflow restarts
60+ ### Durability Features
61+ - Agent executions are automatically temporal activities
62+ - Tool calls include built-in retry mechanisms
63+ - Conversation state persists across workflow restarts
6564
66- ### Performance Optimizations
67- - ** Activity exclusion** - OpenAI provider activities automatically excluded
68- - ** Direct SDK integration** - bypasses activity overhead for simple cases
69- - ** Platform-specific configuration ** - optimized worker settings per platform
65+ ### Performance Features
66+ - Automatic exclusion of unused provider activities
67+ - Direct SDK integration reduces overhead
68+ - Platform-specific worker configuration
7069
71- ### Future Extensibility
72- - ** Strategy pattern** - easy to add new agent platforms
73- - ** Unified interface ** - same workflow pattern across all platforms
74- - ** Agentex compatibility** - seamless integration with existing infrastructure
70+ ### Extensibility
71+ - Strategy pattern for adding new agent platforms
72+ - Consistent workflow interface across platforms
73+ - Full compatibility with existing Agentex infrastructure
7574
7675## Running the Tutorial
7776
78771 . ** Set environment variables:**
7978 ``` bash
80- export WORKFLOW_NAME=" simplified -openai-chat "
81- export WORKFLOW_TASK_QUEUE=" simplified_openai_chat_queue "
82- export AGENT_NAME=" simplified -openai-chat "
79+ export WORKFLOW_NAME=" at040 -openai-temporal-integration "
80+ export WORKFLOW_TASK_QUEUE=" 040_openai_temporal_integration_queue "
81+ export AGENT_NAME=" at040 -openai-temporal-integration "
8382 export OPENAI_API_KEY=" your-openai-api-key"
8483 ```
8584
86- 2 . ** Start the worker :**
85+ 2 . ** Run the agent :**
8786 ``` bash
88- python project/run_worker.py
87+ uv run agentex agents run --manifest manifest.yaml
8988 ```
9089
91903 . ** Test via ACP API:**
@@ -95,29 +94,29 @@ await worker.run(activities=[], workflow=SimplifiedOpenAIChatAgent)
9594 -d ' {
9695 "method": "task/create",
9796 "params": {
98- "agent_name": "simplified -openai-chat "
97+ "agent_name": "at040 -openai-temporal-integration "
9998 }
10099 }'
101100 ```
102101
103- ## Migration Guide
102+ ## Migration from Manual Approach
104103
105- To migrate from the complex manual approach to this simplified approach :
104+ To migrate from the manual orchestration pattern (010_agent_chat) :
106105
107- 1 . ** Replace workflow inheritance:**
108- - From : ` BaseWorkflow `
109- - To : ` OpenAIAgentWorkflow ` (or other platform workflow)
106+ 1 . ** Update workflow inheritance:**
107+ - Change from : ` BaseWorkflow `
108+ - Change to : ` OpenAIAgentWorkflow `
110109
111- 2 . ** Replace manual orchestration:**
112- - From : Manual ` adk.providers.openai.run_agent_streamed_auto_send() `
113- - To: Simple ` create_agent() ` implementation
110+ 2 . ** Replace orchestration code :**
111+ - Remove : Manual ` adk.providers.openai.run_agent_streamed_auto_send() ` calls
112+ - Add: ` create_agent() ` method implementation
114113
1151143 . ** Update worker configuration:**
116- - Add: ` agent_platform="openai" ` parameter
117- - Remove: Manual activity registration
115+ - Add: ` agent_platform="openai" ` parameter to ` AgentexWorker `
116+ - Activities: Use empty list ` [] ` for automatic optimization
118117
119- 4 . ** Remove manual activities :**
120- - Delete : Custom ` @activity.defn ` wrappers
121- - Keep : Core business logic in simple functions
118+ 4 . ** Simplify activity management :**
119+ - Remove : Custom ` @activity.defn ` wrapper functions
120+ - Retain : Core business logic as regular functions
122121
123- This approach maintains 100% compatibility with existing Agentex infrastructure while dramatically simplifying development .
122+ This maintains full compatibility with existing Agentex infrastructure.
0 commit comments