Skip to content

feat(memory): Add inject_memories config fields to AgentConfig #3014

@hamza-jeddad

Description

@hamza-jeddad

Background

Sub-issue of #3011. The inject_memories builtin needs new configuration fields exposed in the agent YAML so users can opt in per agent.

Scope

Add the following fields to AgentConfig and the JSON schema, with sensible defaults and no migration required (false by default preserves existing behaviour).

Fields

YAML key Go type Default Description
inject_memories *bool nil (off) Master toggle for the proactive memory injection builtin
max_inject_memories *int 20 Cap on the number of memories injected per turn
inject_memories_strategy string "local" Keyword extraction strategy: local (BM25) or llm (defined in #3013)

YAML example

agents:
  my_agent:
    tools:
      - type: memory
    inject_memories: true
    max_inject_memories: 20
    inject_memories_strategy: local

Implementation Checklist

  • pkg/config/latest/types.go — add the three fields to AgentConfig
  • agent-schema.json — extend the schema with the new properties + descriptions + enum for inject_memories_strategy
  • Validation: reject inject_memories: true when no memory toolset is configured (return a clear config error)
  • Validation: reject max_inject_memories <= 0
  • Validation: reject unknown inject_memories_strategy values
  • No config migration needed — older configs continue to work unchanged
  • Unit tests for parsing + validation rules

Acceptance Criteria

  • Parsing an agent YAML with the three new fields succeeds and round-trips correctly
  • Omitting all three fields preserves today's behaviour exactly
  • inject_memories: true without a memory toolset returns a clear validation error
  • agent-schema.json validates new configs and is consistent with AgentConfig
  • No changes required to existing version migrations

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/agentFor work that has to do with the general agent loop/agentic features of the apparea/configFor configuration parsing, YAML, environment variables
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions