Skip to content

Request for clarification: How granular is Event persistence (in VertexAIServiceSession/DatabaseServiceSession) for long tasks #2098

Description

@strentom

Hello, I looked at source and in Docs, but couldn't find a definite answer. I'm looking at the Session Lifecycle. Is the session restored from last Event or User message? I'd think Event but the docs suggest from user Message? Or last "finished" event? Can you clarify which one?

Consider this scenario:
I'm using VertexAIServiceSession for persistence. I have a complex custom agent. The agent sends multiple assistant msgs before the next user msg. It has following code:

async for event in self.subagent.run_async(ctx):
    await long_function() # takes a minute to return
    yield event

For the sake of the argument, long_function takes a minute to finish and produces no Events.

What happens if the application is restarted while Code execution is happening in long_function? Is the session restored from last user message? Or from last Yielded event? If from Event, is this event re-processed (that is, long_function is executed twice)? Thank you very much.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question[Component] This issue is asking a question or clarification

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions