Q&A from Learn How to Build AI Agents with Temporal webinar

Here are the Q&A questions that were answered during our Webinar: Learn How to Build AI Agents with Temporal today! Thank you to over 500 people who attended! :exploding_head: We’d love to continue the conversation with you in #topic-ai on our Temporal Community Slack!

(Much thanks to @Josh_Smith and @Steve_Androulakis for answering most of these!)


General

Will we receive a recording of this session and slide deck afterward via email if we registered for the event?
Yes, you will!

Where can I find the code that was demoed today?
You can find it in Temporal’s Code Exchange: Code Exchange - AI Agent execution using Temporal | Temporal

Temporal Capabilities

Can Temporal be self-hosted?
You always self-host your workers and workflows. You can also self-host the Temporal Service (persistence and visibility stores) or use Temporal Cloud to host the Service.

Temporal is open source software GitHub - temporalio/temporal: Temporal service (MIT license)

Whats the memory usage of Temporal Workflows when they wait for human approval over long times (e.g. days)?

Temporal Workflows can last indefinitely and while they are not active, don’t require any worker (application) memory. So your workers can handle many many parallel long running workflows.
The state is stored in the Temporal service. To manage the workflow size, you can use proven techniques to preserve state and stay below memory limits like continue-as-new into a new workflow with the existing chat state.

How large can the persisted workflow variables be? Can I keep a 100MB zip file in such a variable?
Temporal workflow variables can’t be unlimited in size for performance reasons. So no, a 100MB zip file would make the workflow very slow to process - so we don’t allow it. In this case i would keep a reference to the zip file in the workflow, and work with it in an activity.

Is Temporal scheduling fast enough for near realtime processing of tool calls?
Yes. Alex will demo human interaction with a workflow. Latency is quite good for human interaction.

Are loops supported? I thought it had to be DAG?
Temporal’s workflows are defined as code - so you can use loops just like you would in Python or Go or Java. Alex’s demo has a core interaction loop that manages the LLM, Human, Tool, and orchestration process.

Doesn’t the LLM’s nature contradict the Temporals idempotency requirements? Eg you can never get idempotent result from an LLM?

Great question. Alex will show how you can use Activities to manage non-deterministic processing. The workflow loops and gets input via Activities and Signals, which means the workflow can deterministically process a highly variable interaction.

** Is “update” a thing for 2 way communication?**
An ‘update’ in Temporal is sending a message to a Workflow, waiting for it to complete, then returning a result or error back.

** Can Temporal handle a stream from an LLM?**
Temporal can’t handle streams (..yet :wink: )

In this demo, activities are executing asynchronously. How are activity outputs pushed/returned to the chat UI?
In this demo, the app polls the workflow (via workflow query) that’s how the UI is populated.

Use cases

How can Temporal handle Big-Data ETLs? Example: Video transfer between steps of a Workflow?
Yes! This is very common. See for example here: https://temporal.io/resources/case-studies/descript Temporal Workflows are great for ETLs, inference pipelines, and data processing pipelines.

Wouldn’t we hit memory limits doing ETL? I haven’t looked through the data pipeline example, but I was wondering how we would do something like processing a large PDF that might exceed the 2 MB blob limit. Any thoughts?
We recommend passing references to data in ETL use cases. That’s a very common way to manage data of any size orchestrated by Temporal.

Will the agent-backed Technology be useful for workflows without human interaction?

Yes Temporal is also great for agents that don’t have a chat interface.

Is it possible to integrate multiple AI agents to single workflow?
Workflow is code, so you can have many agents running in a single workflow.

Do we have any multi-agent use cases?
An underwriting workflow for either the financial or healthcare sector.

Implementation Approaches

What is the lifecycle of the workflow in itself? does it get initiated when a new chat session is started and finished/excited when the session is closed?
This demo is 1 workflow per chat session. Temporal workflows can run forever though, so it’s your choice how you slice and dice.

Would we simply pass the chat history between different activities via a data class in a loop until the chat ends?
Yes! You can see how it is done here: GitHub - temporal-community/temporal-ai-agent: This demo shows a multi-turn conversation with an AI agent running inside a Temporal workflow.
But the short answer is yes, user interaction, goals, and prompts are sent via data classes to activities.

Is each user query a Temporal Workflow?
Each signal and query goes to a workflow that maintains state. One main workflow per conversation in the app Alex is showing. (You can use other workflows for specific tool execution.)

Do you create another new workflow for every user interaction?
In the app Alex is demoing, it’s one workflow per user chat session. User interactions to and from the application are sent to one workflow with Signals and Queries. So all chat state is kept in one workflow for a user.

Does each prompt result in a separate Temporal activity?
Yes

How are you making LLM provide, structured JSON output consistently? Are we limited to a particular LLM model?
To get the LLM to provide structured output, I asked it nicely in the prompt haha. Claude / OpenAI’s models are smart enough to behave (and if they don’t Temporal will automatically retry).

I ran this code locally and it kept polling. Wouldn’t that be too much traffic if I had 1000 users and each user’s browser is polling the api call every 5 seconds? What is a better way to optimize this implementation?
At scale you’d write chat histories to a 3rd party store and poll that instead (or use server side events) We’re also doing work in this area though :slightly_smiling_face: The Activity would write LLM output to 3rd party store which your UI polls.

How would you match user intent to a workflow action/activity?

you would have to try to classify the intent first early in the workflow or by preprocessing if you want different activities per intent

check out the Code Exchange | Temporal though for some projects that might try. There is one specifically solving Advent of Code Code Exchange - AgentOfCode | Temporal that might classify.

Integrations

Hi all! Do you have an example of integrating a graph agentic framework like PydanticAI or Langraph with Temporal?
You don’t need a graph with Temporal. Durable Execution gives you more flexibility than a graph. Temporal would replace LangGraph.

Pydantic Temporal example here (note this is not Pydantic AI specifically): sdk-python/temporalio/contrib/pydantic.py at main · temporalio/sdk-python · GitHub

Where can I find the recording?
This is now up on our YouTube channel at:

Where might I find other examples of using Temporal + AI? together?

Temporal’s Code Exchange is a great source of these, for example:

  • AI Agent execution using Temporal — the demo from this very webinar!
  • Rojak — Rojak is an open-source library designed for orchestrating multi-agent workflows with reliability and scalability. Built on Temporal, Rojak ensures fault-tolerant, durable agent interactions, allowing AI-driven workflows to persist through failures, long-running tasks, and interruptions.
  • Agent of Code — AgentOfCode is an “agentic” LLM solution that leverages various Gemini models & Sonnet 3.5 to iteratively work through Advent of Code problems, committing its incremental progress to Github along the way.