[Question] How should we build a durable agent with a long conversation and many tool calls per turn?
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Documentación
- Claridad
- Necesita aclaración
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend, distributed-systems
Línea de trabajo
Start with the temporalio.contrib.openai_agents integration and the External Storage setting, especially payload_size_threshold, using the reported history and payload limits as the investigation context. Review the documented limits and workflow patterns, then define what guidance is needed for long conversations, many tool calls, external storage, and one-workflow-per-turn designs.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What we're building
A chat app on temporalio.contrib.openai_agents. One user turn can make up to about 100 tool calls before the agent writes its final answer, and conversations grow to 100k–200k tokens.
We send our requests to LLM providers that don't support OpenAI's conversation chaining, so we can't use previous_response_id or conversation_id. Parallel tool calling also isn't reliable across the models we use.
We couldn't find guidance for this setup, and we'd rather ask than guess, because when it breaks the server kills the whole workflow partway through a turn.
What we saw
Because every model call sends the whole conversation again plus all the tool calls and results so far, and each of those is recorded as an activity input, history grows fast. On temporalio 1.33.0 and openai-agents 0.19.4, model call inputs were 99.8% of the workflow history in every run we did.
History grows roughly like N*B + G*N*(N-1)/2, where N is the number of model calls, B is the size of the conversation, and G is how much each tool call adds.
| conversation | tool output | model calls reached | history | what happened |
|---|---|---|---|---|
| ~209k tok | 5 KB | 53 of 100 | 50.48 MB | TerminatedError: Workflow history size exceeds limit. |
| ~105k tok | 5 KB | 82 of 100 | 50.33 MB | killed |
| ~105k tok | 4 KB | 86 of 100 | 50.15 MB | killed |
| ~105k tok | 1 KB | 101 | 47.49 MB | finished |
| ~209k tok | 5 KB + external storage | 101 | 0.12 MB | finished (108 MB went to the blob store) |
The numbers lined up with what we put in — for a 800 KB conversation we measured 842.2 KB per call, and for 5 KB tool outputs we measured 5.08 KB of growth per call. Our math said the first run would run out of room at call 53, and the server killed it at call 53.
If we push the conversation bigger, what breaks first changes. Above roughly 450k tokens it stops being the 50 MB history limit and becomes the 2 MiB limit on a single payload. Around 522k tokens a single model call's input is too big to send at all, so the turn fails on the first call.
Questions
-
How big can the conversation be, and how many tool calls can one turn make? We worked out our own numbers by measuring, but we don't know if we're measuring the right thing, or if there's a way to avoid sending the conversation again on every call that we've missed. This might be the agent version of what temporalio/ai-cookbook#32 is asking for.
-
Is External Storage the answer here? Turning it on fixed our case completely — history went from 50.48 MB to 0.12 MB. Is it the recommended fix for agents, and is there advice on what to set
payload_size_thresholdto? It's still marked experimental, so we'd like to know if it's considered ready for this. -
Should each user turn be its own workflow? We moved to one workflow per turn, keeping the conversation in our own database and passing it in as workflow input, because we couldn't see how to stop history growing if one workflow handles every turn. Is that the pattern you'd recommend, or have we misread it?
- Lenguaje dominante
- Python
- Estrellas
- 1.2k
- Forks
- 241
- Merge medio
- 3 d 2 h
- PR fusionados (30 d)
- 49
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de temporalio/sdk-python
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
temporalio/sdk-python#1517 · 10 comentarios ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
temporalio/sdk-python#496 ·
-
[Bug] Local activity resolutions regrouped on replay since 1.32.0, delivering the wrong payload Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
temporalio/sdk-python#1881 · 1 comentario ·
-
bug
temporalio/sdk-python#1817 · 1 comentario · 1 asignado ·
-
Cloud CI Skips Nexus Tests Abierto
temporalio/sdk-python#1704 · 1 asignado ·
Todos los issues de temporalio/sdk-python
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
use-agent-os/agent-os#3314 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
BasedHardware/omi#15662 · 1 comentario ·
-
documentation help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
AiursoftWeb/AnduinOS-2#19 ·