https://promptfoo.dev/ logo
Testing stateful agent with simulated user
# questions
a
I have a stateful agent (data analysis agent that has access to a coding sandbox with a dataframe) that I want to evaluate with the simulated user provider. The issue is that every call_api is stateless and we are expected to feed the entire conversation/state as a string each time. Is there a recommended way to keep the same agent/client around for a few calls?
w
I'd recommend storing the conversation history server-side and then returning a session id when the conversation is initialized. See server-side management https://www.promptfoo.dev/docs/providers/http/#session-management
a
is there any way to keep the same process if you're using simulated user? that way we can keep an agent in memory and it gets cleaned up when the eval is done. if I take the session management approach I need to start a persistent stateful server before running any promptfoo evals and it won't be cleaned up until all the evals run.
This is related to this GitHub issue https://github.com/promptfoo/promptfoo/issues/5554. we seem to always be creating a new process for every call.
w
Are you using a custom python provider to interface with your stateful agent?
a
yes
Copy code
providers:
  - file://promptfoo_utils/pf_provider.py
w
We have a fix for 5554 in progress right now. I will follow up here once that ships – optimistically this week.