Skip to content

Durable Agent conversation history bound to agent creation session ID #222

@bibryam

Description

@bibryam

Description:
Currently, the session ID for conversation history is fixed at agent creation. This prevents Durable Agents from starting multiple new sessions without creating a new agent instance.

Durable Agents are intended to support starting multiple sessions with the same agent definition. For example, when using ConversationDaprStateMemory, the session ID should be assignable at runtime for each new workflow execution.

Expected Behavior:

  • Durable Agent should allow providing a new session ID at runtime (per workflow run).
  • Memory should be tied to the session provided when invoking run, not only at agent creation.

Example:

# Initialize TravelBuddy agent
travel_planner = DurableAgent(
    name="TravelBuddy",
    role="Travel Planner",
    goal="Help users find flights and remember preferences",
    instructions=[
        "Find flights to destinations",
        "Remember user preferences",
        "Provide clear flight info",
    ],
    tools=[search_flights],
    message_bus_name="messagepubsub",
    state_store_name="workflowstatestore",
    state_key="workflow_state",
    agents_registry_store_name="registrystatestore",
    agents_registry_key="agents_registry",
    memory=ConversationDaprStateMemory(
        store_name="conversationstore", session_id="my-unique-id" // used when no sessionId is provided at prompting
    ),
    llm=OpenAIChatClient(model="gpt-3.5-turbo"),
)

# Current behaviour, all prompts use the same sessionId
travel_planner.run("a prompt using default session")

# Additiona behavior: ability to start a new session dynamically
travel_planner.run("some other prompt", session_id="new-session-id")

Proposed Enhancement:

  • Add a mechanism to override the session ID per workflow run.
  • Support dynamic session keys whether triggered via REST, pub/sub, or SDK calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Researching

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions