actrone_memory.integrations.claude_agent_sdk module

Claude Agent SDK memory adapter for actrone-memory (Tier 1).

The Claude Agent SDK’s query(prompt, options=ClaudeAgentOptions(system_prompt=...)) accepts a system prompt. This adapter returns the system prompt for a turn, the developer’s base system prompt with governed Actrone memory appended, and persists the completed turn. The SDK has no formal memory interface, so the system-prompt path is the idiomatic integration.

Framework-free: nothing from claude-agent-sdk is imported, this runs against a local, service-free MemoryManager. Mirrors the TypeScript claudeAgentMemory adapter.

class actrone_memory.integrations.claude_agent_sdk.ActroneClaudeAgentMemory(agent_id, session_id, *, token_budget=4096, config=None, memory_manager=None)[source]

Bases: BaseActroneMemory

Governed memory for the Claude Agent SDK query loop.

Usage:

from claude_agent_sdk import query, ClaudeAgentOptions
from actrone_memory.integrations.claude_agent_sdk import ActroneClaudeAgentMemory

memory = ActroneClaudeAgentMemory(agent_id="support-bot", session_id="s1")
sys_prompt = await memory.append_to_system_prompt("You are support.", user_input)
options = ClaudeAgentOptions(system_prompt=sys_prompt)
async for msg in query(prompt=user_input, options=options):
    ...  # collect the reply into `answer`
await memory.remember(user_input, answer)
Parameters:
async append_to_system_prompt(base_system_prompt, query, *, token_budget=None)[source]

Return the turn’s system prompt: governed memory appended to base_system_prompt (or just the memory when there is no base system prompt).

Parameters:
  • base_system_prompt (str)

  • query (str)

  • token_budget (int | None)

Return type:

str