Skip to content

[Feat]: Pick explicit LongTermMemory backend in evaluation setup #1476

Description

@junttang

Is your feature request related to a problem?

evaluation/utils/agent_utils.py constructs LongTermMemory by calling LongTermMemoryParams(...). However, since #1395 , LongTermMemoryParams is no longer a class. It is an Annotated discriminated union.

LongTermMemoryParams = Annotated[
    DeclarativeBackendParams | EventBackendParams,
    Field(discriminator="backend"),
]

Calling this type alias as a constructor raises TypeError: 'types.UnionType' object is not callable under Python 3.12, so the evaluation entry point crashes at startup.

Describe the solution you'd like

Use the concrete backend params class directly when constructing LongTermMemory in init_memmachine_params. For the declarative backend, replace:

from memmachine_server.episodic_memory.long_term_memory import (
    LongTermMemory,
    LongTermMemoryParams,
)
...
long_term_memory = LongTermMemory(
    LongTermMemoryParams(...)
)

with:

from memmachine_server.episodic_memory.long_term_memory import (
    DeclarativeBackendParams,
    LongTermMemory,
)
...
long_term_memory = LongTermMemory(
    DeclarativeBackendParams(...)
)

Describe alternatives you've considered

Making LongTermMemoryParams callable (e.g. a factory/dispatch over the union based on the backend discriminator) so existing call sites keep working. This would require upstream changes in the long_term_memory module rather than a one-line fix in agent_utils.py.

Additional context

No response

Activity

  1. added theissue type on Jul 13, 2026
  2. changed the title [-][Feat]:[/-] [+][Feat]: init_memmachine_params fails with "UnionType object is not callable" when constructing LongTermMemory[/+] on Jul 13, 2026
  3. changed the title [-][Feat]: init_memmachine_params fails with "UnionType object is not callable" when constructing LongTermMemory[/-] [+][Feat]: Pick explicit LongTermMemory backend in evaluation setup[/+] on Jul 13, 2026
  4. github-actions commented on Sep 12, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this issue is still relevant, please comment to keep it open, or add the keep-open label if it should remain open indefinitely (e.g., a roadmap item awaiting a champion). Thank you for your contributions.

  5. added a commit that references this issue on Sep 24, 2026
    0e1882d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions