|
2 | 2 |
|
3 | 3 | Integration of Claude Agents SDK with AgentEx's Temporal-based orchestration platform. Claude agents run in durable workflows with real-time streaming to the AgentEx UI. |
4 | 4 |
|
| 5 | +> ⚠️ **Note**: This integration is designed for local agent development and single-worker deployments. For distributed multi-worker Kubernetes deployments, additional infrastructure is required (see [Deployment Considerations](#deployment-considerations) below). |
| 6 | +
|
5 | 7 | ## Features |
6 | 8 |
|
7 | | -- **Durable Execution** - Workflows survive restarts via Temporal's event sourcing |
| 9 | +- **Durable Execution** - Workflows survive restarts via Temporal's event sourcing (single-worker) |
8 | 10 | - **Session Resume** - Conversation context maintained across turns via `session_id` |
9 | 11 | - **Workspace Isolation** - Each task gets dedicated directory for file operations |
10 | 12 | - **Real-time Streaming** - Text and tool calls stream to UI via Redis |
@@ -117,6 +119,61 @@ claude_agents/ |
117 | 119 | └── post_tool_use |
118 | 120 | ``` |
119 | 121 |
|
| 122 | +## Deployment Considerations |
| 123 | + |
| 124 | +This integration works well for local development and single-worker deployments. For distributed multi-worker production deployments, consider the following: |
| 125 | + |
| 126 | +### ⚠️ Session Persistence (Multi-Worker) |
| 127 | + |
| 128 | +**Current behavior**: Claude SDK sessions are tied to the worker process. |
| 129 | + |
| 130 | +- **Local dev**: ✅ Works - session persists within single worker |
| 131 | +- **K8s multi-pod**: ⚠️ Session ID stored in Temporal state, but session itself lives in Claude CLI process |
| 132 | +- **Impact**: If task moves to different pod, session becomes invalid |
| 133 | +- **Infrastructure needed**: Session persistence layer or sticky routing to same pod |
| 134 | + |
| 135 | +### ⚠️ Workspace Storage (Multi-Worker) |
| 136 | + |
| 137 | +**Current behavior**: Workspaces are local directories (`./workspace/{task_id}`). |
| 138 | + |
| 139 | +- **Local dev**: ✅ Works - single worker accesses all files |
| 140 | +- **K8s multi-pod**: ⚠️ Each pod has isolated filesystem |
| 141 | +- **Impact**: Files created by one pod are invisible to other pods |
| 142 | +- **Infrastructure needed**: Shared storage (NFS, EFS, GCS Fuse) via `CLAUDE_WORKSPACE_ROOT` env var |
| 143 | + |
| 144 | +**Solution for production**: |
| 145 | +```bash |
| 146 | +# Mount shared filesystem (NFS, EFS, etc.) to all pods |
| 147 | +export CLAUDE_WORKSPACE_ROOT=/mnt/shared/workspaces |
| 148 | + |
| 149 | +# All workers will now share workspace access |
| 150 | +``` |
| 151 | + |
| 152 | +### ℹ️ Filesystem-Based Configuration |
| 153 | + |
| 154 | +**Current approach**: Agents and configuration are defined programmatically in code. |
| 155 | + |
| 156 | +- **Not used**: `.claude/agents/`, `.claude/skills/`, `CLAUDE.md` files |
| 157 | +- **Why**: Aligns with AgentEx's code-as-configuration philosophy |
| 158 | +- **Trade-off**: More explicit and version-controlled, but can't leverage existing Claude configs |
| 159 | +- **To enable**: Would need to add `setting_sources=["project"]` to `ClaudeAgentOptions` |
| 160 | + |
| 161 | +**Current approach** (programmatic config in workflow.py): |
| 162 | +```python |
| 163 | +subagents = { |
| 164 | + 'code-reviewer': AgentDefinition( |
| 165 | + description='...', |
| 166 | + prompt='...', |
| 167 | + tools=['Read', 'Grep', 'Glob'], |
| 168 | + model='sonnet', |
| 169 | + ), |
| 170 | +} |
| 171 | +``` |
| 172 | + |
| 173 | +--- |
| 174 | + |
| 175 | +**Summary**: The integration is production-ready for **single-worker deployments**. Multi-worker deployments require additional infrastructure for session persistence and workspace sharing. |
| 176 | + |
120 | 177 | ## Quick Start |
121 | 178 |
|
122 | 179 | ### Prerequisites |
|
0 commit comments