Building Production-Ready LLM Agents with State Management and Workflow Engineering

renovai · Tech · 2023 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.5 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Production LLM agents with state, tools, and workflow orchestration

Renovai's session addresses how to move beyond standalone LLM calls into production agent systems that can use tools, maintain multi-turn state, be debugged with traces, and balance autonomy against human-designed workflows.

Constraints:

Architecture

The architecture starts with an agent that decides tool actions and an agent executor that runs them. Tools are defined with names, descriptions, parameters, and output formats, then bound to the LLM through either ReAct prompting or OpenAI function/tool calling. LangSmith traces expose decisions and prompt failures. LangGraph state graphs add persisted conversation state through checkpointing and thread IDs. Workflow engineering constrains autonomy through router-plus-code, plan-and-execute, state machines, or autonomous loops. A multi-agent example uses a supervisor, researcher, and blogger with explicit state fields and routing limits; a multimodal web-navigation example combines GPT-4V, Playwright, screenshots, DOM segmentation, and prompt-based actions.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  user[User] --> agent[Agent]
  agent --> strategy-layer[Strategy layer]
  strategy-layer --> tool-registry[Tool registry]
  agent --> agent-executor[Agent executor]
  agent-executor --> tool-registry
  agent --> langsmith-tracing[LangSmith tracing]
  langsmith-tracing --> prompt-debugging-loop[Prompt debugging loop]
  agent --> langgraph-state-graph[LangGraph state graph]
  langgraph-state-graph --> conversation-state[Conversation state]
  conversation-state --> checkpoint-store[Checkpoint store]
  checkpoint-store --> thread-id[Thread ID]
  workflow-engineering-controller[Workflow engineering controller] --> supervisor-agent[Supervisor agent]
  supervisor-agent --> researcher-agent[Researcher agent]
  supervisor-agent --> blogger-agent[Blogger agent]
  supervisor-agent --> multi-agent-state[Multi-agent state]
  researcher-agent --> multi-agent-state
  blogger-agent --> multi-agent-state
  gpt-4v-web-navigator[GPT-4V web navigator] --> playwright-browser[Playwright browser]
  playwright-browser --> dom-segmentation[DOM segmentation]
  dom-segmentation --> gpt-4v-web-navigator
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
User Person asking questions or assigning tasks to the agent system. Agent
Agent LLM-driven decision component that chooses what tool or routing action to take and with what input. User, Strategy layer, Agent executor, Conversation state
Agent executor Execution component that invokes tools selected by the agent and returns outputs for further reasoning. Agent, Tool registry
Tool registry Collection of functions and external tools such as word counting, character counting, DuckDuckGo search, and Playwright browser actions. Agent executor, Strategy layer
Strategy layer Decision strategy for tool use, either prompt-based ReAct or fine-tuned OpenAI function/tool calling. Agent, Tool registry
LangSmith tracing Tracing and playground system used to inspect tool decisions and iterate on prompts. Agent, Prompt debugging loop
Prompt debugging loop Prompt iteration path used to fix failures such as relying on stale model knowledge instead of searching. LangSmith tracing, Agent
LangGraph state graph Graph abstraction that connects agent, action, and continuation nodes while carrying typed state. Agent, Agent executor, Conversation state, Checkpoint store
Conversation state Message history and other state fields needed for multi-turn interactions such as follow-up stock questions. Agent, LangGraph state graph, Checkpoint store
Checkpoint store Persistence layer such as SQLite or a remote database that stores conversation state by thread ID. Conversation state, Thread ID
Thread ID Unique conversation identifier used to retrieve persisted state across turns. Checkpoint store
Workflow engineering controller Human-designed control layer that decides how much autonomy the agent gets through router-plus-code, plan-and-execute, state machine, or autonomous patterns. Agent, Supervisor agent
Supervisor agent Routing and critique agent that sends work to researcher or blogger agents and decides when the workflow is finished. Researcher agent, Blogger agent, Multi-agent state
Researcher agent Agent executor that uses search tools to gather findings for the supervisor. Supervisor agent, Tool registry, Multi-agent state
Blogger agent Writing agent that produces drafts from researcher findings and supervisor instructions. Supervisor agent, Multi-agent state
Multi-agent state Shared state for turn, topic, researcher findings, blogger drafts, and agent-specific tasks. Supervisor agent, Researcher agent, Blogger agent
GPT-4V web navigator Multimodal agent that reads segmented screenshots and decides browser actions through prompt-based routing. Playwright browser, DOM segmentation
Playwright browser Browser automation tool for clicking, typing, scrolling, waiting, navigating, and screenshot capture. GPT-4V web navigator, DOM segmentation
DOM segmentation Bounding-box layer that labels HTML elements in screenshots so GPT-4V has a shared visual vocabulary. GPT-4V web navigator, Playwright browser

Data flow

The user sends a task to the agent. The strategy layer decides whether to use a tool; the agent emits an action and the executor invokes the selected tool. Tool outputs return to the agent until it can answer. LangSmith traces each decision. For multi-turn conversations, LangGraph state stores messages and a checkpointer persists them by thread ID. For multi-agent workflows, supervisor, researcher, and blogger agents exchange shared state. For web navigation, Playwright screenshots are segmented, passed to GPT-4V, and converted into browser actions.

4 supporting quotes
“that that you miss um in term of information right so the llm decide what to do I want to run some tool then he tell the agent executor which is another component it may be an llm or may not and then the agent executor just execute the tool for example it can exe execute some python code and then”transcript, stated
“the agent executor just execute the tool for example it can exe execute some python code and then get the output”transcript, stated
“we will use something called checkpoint that will checkpoint this state the conversation with the user and it's pretty straightforward you just construct the conect the connector which is for for example for me is a SQL light we will construct it using a”transcript, stated
“we will have the researcher that his only job is to research about the topic and uh report to the supervisor the supervisor then critique the researcher job and can and can say this is not enough you are missing this point and this point do the research”transcript, stated

Why this architecture

The architecture exists because raw LLM calls cannot reliably perform external actions, count or retrieve facts, maintain state across replicated services, or provide enough control for production workflows. Separating agent decisions from execution, persisting state through checkpoints, and using state-machine-style workflow engineering gives engineers control where needed while leaving dynamic routing decisions to the LLM.

4 supporting quotes
“he got the wrong answer right so this is exactly the spot that you want to first uh stop and understand or the llm want to stop and understand okay I'm not good at this task of counting words I need to use a tool so let's try that let's define the agent”transcript, stated
“he is not executing the function this is the important point is not executing the function the role of the agent is only to decide what to do and what is the input okay now the executor will execute the D the go search and then will get the output the output will send to the agent again”transcript, stated
“the State ofth art really a paradigm right now in serverless and and also micros Services is not to save state”transcript, stated
“the fully autonomous one is super Dynamic but it it's not really give us the ability to control the system as good as we as we want”transcript, stated

Models used: OpenAI function/tool-calling models · ReAct prompting · LangChain · LangGraph · LangSmith · DuckDuckGo search · GPT-4 Vision · Playwright · SQLite checkpointing

Scale

Alternatives considered (roads not taken)

Use a standalone LLM without tools

Rejected because: The LLM relies on prior training and can hallucinate or fail exact operations such as counting words.

3 supporting quotes
“it's Che GPT or you using the API it doesn't M really matter what it really matter is that the llm count on his previous knowledge to understand what you want and just output the response right and if in the training phase in the data set of the training”transcript, stated
“he missed some information because time time has passed from the last training so of course then start the hallucination right so this is like interaction with an llm but the difference between llm and llm based agent is that we are using the llm”transcript, stated
“misunderstanding of the llm how it tokenize words and how it represent words in his in his like input so he got the wrong answer right so this is exactly the spot that you want to first uh stop and understand or the llm want to stop and understand okay”transcript, stated

Use prompt-based ReAct for all tool use

Rejected because: OpenAI function/tool calling can reduce prompt engineering because the model is fine-tuned for deciding when and how to call functions.

3 supporting quotes
“even more but th those are the the common ones the first one is prompt based strategy what is prompt based strategy the most common one in this category called react and what we are doing in this in this Cate category of strategy is basically prompt engineering the llm and guide it to”transcript, stated
“and then we are asking him to follow this example right the other type of category is called open AI tools or open a function they changing their name right now to tools because in function you can execute just one function and in this openi tools”transcript, stated
“you don't need to prompt engineering the llm because it's already fine tune to understand if you want to execute a f function”transcript, stated

Keep conversation state only in server memory

Rejected because: Serverless and microservice deployments use multiple stateless replicas, so state must be persisted elsewhere.

3 supporting quotes
“idea here is that where where do we save this state right where do we save this conversation do we save it in the client side do we save it in the in the server side if we save it in the server side how do we save it because the the State ofth art really a paradigm right now in serverless”transcript, stated
“Services is not to save state right we need like microservices with that they are state because if we we want like a lot of replicas we cannot save state so what is the best solution to save State the the conversation itself so let's go back to the code and let's add some state”transcript, stated
“understand the flow of the conversation but then if we will drop that he won't understand so we need a way to dump to dump the the memory the state somewhere where in the middle of the the first question of the user to the second question we can get some other conversation in between”transcript, stated

Use fully autonomous agent-executor loops in production

Rejected because: They are maximally dynamic but provide less control and make bugs hard to spot in production.

3 supporting quotes
“what we already saw is the fully autonomous we just have a loop of agent and agent executor we give the the agent the tool and it just execute and as we saw there are bugs that is pretty hard to to spot in a real production environment um in my opinion the”transcript, stated
“agent and agent executor we give the the agent the tool and it just execute and as we saw there are bugs that is pretty hard to to spot in a real production environment um in my opinion the most popular one in production right now is router plus code to be honest but in the future I think”transcript, stated
“it's not really give us the ability to control the system as good as we as we want so the state machine is the combination of giving the agent the the Aton that he needs to to make the application dynamic in certain points but then like workflow engineering”transcript, stated

Use only search-result snippets for research agents

Rejected because: Search snippets may be stale or shallow, so multimodal web navigation can inspect pages directly.

3 supporting quotes
“Achilles here is is basically the researcher okay the researcher have a tool that you go to go to explore with search engine right a Google search engine but then if you imagine the result that he's seeing is basically only the paragraphs of the of the web search right we have the topics”transcript, stated
“it's pretty small it's not really up to dat it's not really up to up to date because it's it depends on the Google indexing”transcript, stated
“a number and then it can super improve the the accuracy okay what we will do is basically we will have a agent that will have a tool which is called playright this play playright tool can execute some like for example it can execute a Chrome browser it can click some stuff it can”transcript, stated

Patterns

tool-use-orchestration (agent-control)

The agent decides which tool to use and the executor runs it, enabling reliable code/search/browser operations when the LLM alone is weak.

3 supporting quotes
“we are giving some autonomy to this llm to decide what to do so he can decide to run some tool”transcript, stated
“the role of the agent is only to decide what to do and what is the input”transcript, stated
“run some tool then he tell the agent executor which is another component it may be an llm or may not and then the agent executor just execute the tool for example it can exe execute some python code and then get the output and give the llm as a context the llm then understand if you need to run”transcript, stated

structured-output-contract (tool-interface)

Tools are exposed to the model as structured functions with name, description, parameters, and expected output, and OpenAI function/tool calling parses actions.

“the description that you give to the the the tool or the function this is the the description that the llm will use”transcript, stated
“function with a name what is the description when when do I I need to use it and what are the parameters and what should I output”transcript, stated

observability-tracing (production-operations)

LangSmith traces agent decisions so developers can see where the agent chose the wrong tool strategy and iterate in the playground.

3 supporting quotes
“when do we when do we want to integrate some some tracing system”transcript, stated
“we can see the execution we can spot the right the right point that the agent decide to act with the tool”transcript, stated
“the right point that the agent decide to act with the tool this is the spot okay so this is the the error and we can go to playground and we can change the prompt so we can say for to him ex explicitly don't count on your previous knowledge search the web instead okay okay so start and now”transcript, stated

agent-memory (state)

LangGraph state and checkpointing persist conversation messages by thread ID so stateless compute can support multi-turn conversations.

3 supporting quotes
“is workflow engineering and then if we want to expand a little bit further we can in real production use case we need another thing we need a state right we have the agent we can ask question he can execute the tools but then in real production user is not really asking one question and”transcript, stated
“this checkpoint there we have a configuration and we have a trade ID if we will construct it with a trade ID this can be the unique conversation of the user so imagine that you have a conversation and when you are done with the user it's dump all the state to the this SQL light now we will run”transcript, stated
“with this checkpoint there we have a configuration and we have a trade ID”transcript, stated

multi-agent-orchestration (architecture)

The blogger example uses a supervisor to route and critique researcher and blogger agents through shared state.

3 supporting quotes
“the supervisor then critique the researcher job and can and can say this is not enough”transcript, stated
“the supervisor will can understand okay this draft is accepted or not he will act as the editor”transcript, stated
“the state is the the turn the res are finding and the Blogger draft”transcript, stated

workflow-decomposition (architecture)

Workflow engineering decomposes production control into router-plus-code, plan-and-execute, state-machine, or autonomous patterns depending on how much structure is needed.

3 supporting quotes
“in workflows engineering we decide what the human design and which kind of autonomy do we get to give to the agent itself”transcript, stated
“router Plus Code what we do is basically give the llm the the ability to decide what to do”transcript, stated
“back to the first to the first uh step and plan it again the next step of autonomy we we we will give the the the human uh design the the graph the state machine okay we have a state machine here which each node is pretty much an agent the agents communicate with each other but we will”transcript, stated

guardrails-io-filtering (control)

The multi-agent workflow includes explicit restrictions, such as limiting how often the supervisor can return work to the researcher.

“time we will have what you need and you go to the Blogger but anyway and this is a good point that you can like Define your restriction so for example I didn't cover it but in this logic i i i defined that the supervisor can go to the research only three time if the next time that you want to”transcript, stated
“that you can like Define your restriction so for example I didn't cover it but in this logic i i i defined that the supervisor can go to the research only three time if the next time that you want to go to the resar and we already have like three findings already in the in the array of findings”transcript, stated

prompt-chaining (prompt-architecture)

The ReAct-style and GPT-4V browser examples use prompts to specify action formats and route through thought/action/observation or visual action loops.

“guide it to pause and understand if you want to act with the tool and then afterwards to to execute this tool and then to observe the output”transcript, stated
“understand what to do so we are telling the agent or the llm what what he need to do he need to act with an action so we will use prompt engineer to design the the strategy construct this gp4 Vision preview okay we give the agent a tool and okay we can see that it opened Google okay it's straight”transcript, stated

Tradeoffs

Use OpenAI function/tool calling for common production agents

Chose Fine-tuned tool-calling strategy over Pure prompt-based ReAct.

Rationale: Function/tool calling needs less prompt engineering because tool-call behavior is baked into the model, though ReAct remains useful where function calling is unavailable.

“you don't need to prompt engineering the llm because it's already fine tune”transcript, stated
“in my opinion the common one and the popular one is open AI function right now”transcript, stated

Persist state with checkpoints

Chose SQLite or remote checkpoint storage keyed by thread ID over Concatenating prior turns manually or keeping state in RAM.

Rationale: Checkpointing lets stateless deployments support conversation continuity without passing the entire prior state manually on each request.

3 supporting quotes
“we don't need to concut the the previous input to the to the next input”transcript, stated
“you just construct the conect the connector which is for for example for me is a SQL light”transcript, stated
“light we will construct it using a connection string we right now we will use a memory connection string but it can be a remote connection string of course and we just when we compile the graph with the state we will just get give a a checkpoint checkpointing with with a memory and now with”transcript, stated

Use state machines for production control

Chose Human-designed graph with agentic nodes and restrictions over Fully autonomous agent loops.

Rationale: State machines balance dynamic routing with explicit edges, conditions, and restrictions for production systems.

“state machine is the combination of giving the agent the the Aton that he needs”transcript, stated
“workflow engineering the the the other points the other system that and and just give a restriction in the in the right in the right places”transcript, stated

Use supervisor-worker multi-agent roles

Chose Supervisor, researcher, and blogger agents with shared state over One general-purpose agent for the whole blog task.

Rationale: Role separation gives each agent a narrow responsibility and lets the supervisor critique or request more work.

“division of separation of responsibility each agent can be responsible for specific task can get a specific tools and be the best in his job”transcript, stated
“the supervisor will do this like separating the task between the researcher and blogger”transcript, stated

Use GPT-4V with Playwright for web tasks

Chose Multimodal screenshot segmentation plus browser actions over Search-engine snippets only.

Rationale: Browser interaction can reach fresh pages and UI content that search snippets may miss, but requires prompt-based actions because GPT-4V lacks the same function-calling path.

3 supporting quotes
“execute some like for example it can execute a Chrome browser it can click some stuff it can scroll but then the the brain itself will be the GPT 4V for so we will start with open Google okay and then we will screenshot the screen we will segment everything we will send it to gp4 Vision to”transcript, stated
“is called playright this play playright tool can execute some like for example it can execute a Chrome browser it can click some stuff it can scroll but then the the brain itself will be the GPT 4V for so we will start with open Google okay and then we will screenshot the screen we will segment”transcript, stated
“gp4 V doesn't have the the ability to use function as a object as the openi function tools”transcript, stated

Gotchas (what bit them)

A tool-capable agent may still rely on stale prior knowledge.

Root cause: The model answered Will Smith's middle-name task from internal knowledge instead of searching first.

Resolution: Use tracing to locate the decision and prompt the agent not to rely on previous knowledge when current facts are needed.

“see that he use character count and then count for the name of Will Smith and the middle name of Will Smith he he got it from his previous knowledge right so this is a bug because what we want is basically that the llm one count on his previous knowledge to to say something so he needed to search”transcript, stated
“the the error and we can go to playground and we can change the prompt so we can say for to him ex explicitly don't count on your previous knowledge search the web instead okay okay so start and now we can see that this is the right this is the right response right it go to DCT go with Will”transcript, stated

Conversation state cannot just live in process memory.

Root cause: Production systems often use stateless microservices or serverless replicas, so local RAM state disappears or fragments across instances.

Resolution: Persist state with a checkpoint store and retrieve it by conversation/thread ID.

3 supporting quotes
“we need to State not to save as a as a ram in the in the memory itself of the of the Pod or the the server”transcript, stated
“we need like microservices with that they are state because if we we want like a lot of replicas we cannot save state”transcript, stated
“we will use something called checkpoint that will checkpoint this state”transcript, stated

Autonomous loops are hard to control.

Root cause: A fully autonomous agent-executor loop can choose any available path, making production behavior less predictable and debugging harder.

Resolution: Use workflow engineering and state-machine restrictions where production control matters.

“right now is router plus code to be honest but in the future I think the most popular one will be State machine the fully autonomous one is super Dynamic but it it's not really give us the ability to control the system as good as we as we want so the state machine is the combination of giving”transcript, stated
“not really give us the ability to control the system as good as we as we want”transcript, stated

LLM application failures are not as reproducible as traditional software failures.

Root cause: A flow can work for one input but fail on another, especially with agents and routing decisions.

Resolution: Use tracing, graph design, breakpoints, and prompt iteration to inspect routing failures and failure patterns.

3 supporting quotes
“when something is working with a specific flow is not going to say that it's going to work every time”transcript, stated
“there are tons of that the the the system can go to especially with agents”transcript, stated
“know where to go so this I think this a great point to stop and understand where do we need to go and look so we need to have a good tracing system that can that we can explore and we need a good designing system or graph system to construct our multi-agent system and to debug for example what it”transcript, stated

Search-result snippets can be too shallow or stale for research agents.

Root cause: Search depends on indexing and exposes only small snippets rather than current page content.

Resolution: Use multimodal web navigation with screenshots, DOM segmentation, and browser actions when direct interface interaction is needed.

3 supporting quotes
“the result that he's seeing is basically only the paragraphs of the of the web search”transcript, stated
“it's not really up to dat it's not really up to up to date because it's it depends on the Google indexing”transcript, stated
“looks like so defining some environment viable this is how what we are going to see okay we are having Google we will segment everything with the bounding box the idea here is that we can use the HTML of the page the Dom elements to understand where are the Buton and where are the text types the”transcript, stated

Evaluation

The session emphasizes tracing and interactive debugging rather than formal metrics: inspect agent/tool decisions in LangSmith, use playground prompt edits, set breakpoints in routing logic, inspect state graphs, and test varied inputs because an LLM flow working once does not prove it works consistently.

Metrics: Tool invocation correctness · Trace inspection · Prompt fix effectiveness · Conversation state retrieval · Routing decision correctness · Research iteration count · Loop termination · Web navigation success · Search freshness · Failure pattern coverage across varied inputs

3 supporting quotes
“we can see the execution we can spot the right the right point that the agent decide to act with the tool”transcript, stated
“we can use the the length Smith and we can understand why he decided”transcript, stated
“I will put a debugger here and understand what is the the logic that I need to change”transcript, stated

Outcomes

The source is a tutorial rather than a deployed case study with production metrics. Its concrete figures include a 12-word counting example, seven-character Will Smith answer, a three-iteration researcher cap, thread IDs for conversation state, and a 2024/2025 prediction for agent adoption.

4 supporting quotes
“suggest we are running the words count tool with this sentence this is the input for the tool and you can see that the tool output 12 and this is the right response okay so I hope this showcase why do we need agents right why why can't we just use nlm directly and fill in the Gap directly with with”transcript, stated
“the response is seven Okay cool so we improved the the llm using prompt engineering”transcript, stated
“you can see that he go first to D the go understand that the middle name of Will Smith is Carl”transcript, stated
“transition from rting routing to code solution in production to State machine production”transcript, stated