autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Implement python side of GetState/SaveState Orleans persistence

Open rysweet opened this issue 1 year ago • 1 comments

What feature would you like to be added?

neither, but agent state could be used to achieve both. this is in particular to just implement

    async def GetState(  # type: ignore
        self,
        request: agent_worker_pb2.AgentId,
        context: grpc.aio.ServicerContext[agent_worker_pb2.AgentId, agent_worker_pb2.GetStateResponse],
    ) -> agent_worker_pb2.GetStateResponse:  # type: ignore
        raise NotImplementedError("Method not implemented!")
    async def SaveState(  # type: ignore
        self,
        request: agent_worker_pb2.AgentState,
        context: grpc.aio.ServicerContext[agent_worker_pb2.AgentId, agent_worker_pb2.SaveStateResponse],
    ) -> agent_worker_pb2.SaveStateResponse:  # type: ignore
        raise NotImplementedError("Method not implemented!")

https://github.com/microsoft/autogen/blob/ryswee-xlang-aspire/python/packages/autogen-core/src/autogen_core/application/_worker_runtime_host_servicer.py#L263-L264 autogen/python/packages/autogen-core/src/autogen_core/application/_worker_runtime_host_servicer.py at ryswee-xlang-aspire · microsoft/autogen A programming framework for agentic AI 🤖. Contribute to microsoft/autogen development by creating an account on GitHub.

Its not a general purpose memory, just a way to plumb through Orleans persistence.

this lets you write stateless agents that still can resiliently carry out a stateful workflow.

eg here: https://github.com/microsoft/autogen/blob/ryswee-xlang-aspire/dotnet/samples/Hello/HelloAgentState/Program.cs#L80-L81 we have an example where the agent relies on the agent state to determine the state of the workflow. Program.cs microsoft/autogen

Why is this needed?

enables using the persistence apis in Orleans

rysweet avatar Nov 26 '24 17:11 rysweet

@ekzhu , it might be worth discussing how we address this (or not) in #4436 . Current implementation uses the runtime to load_state/save team state.

 runtime_state = await self._runtime.save_state()

Now this is currently tested (AgentChat) with a SingleThreadedRuntime so it might be good to discuss where we are with being able to do this with Orleans.

victordibia avatar Dec 05 '24 18:12 victordibia