Agentic AI Kit includes multiple memory systems for conversational context, persistent storage, shared state, and adaptive episodic memory. It also allows ordinary Python functions to be exposed as tools that agents can select and call.
Memory
File: agentic_ai/memory/short_term.py
ShortTermMemory stores a fixed number of recent (user_input, agent_output) conversation pairs.
It is useful for maintaining local conversational context without retaining an unlimited history.
Fixed-size conversation window
User and agent turn storage
Iterable memory entries
Text-formatted context
Manual memory clearing
File: agentic_ai/memory/long_term.py
LongTermMemory provides SQLite-backed persistent storage for agent observations, facts, decisions, and other durable entries. Unlike short-term memory, entries remain available across Python sessions.
SQLite-backed persistence
Agent-specific memory entries
Recent-entry retrieval
Keyword search
Durable storage across sessions
File: agentic_ai/memory/shared.py
SharedMemory is a thread-safe, in-process key-value store that can be accessed by multiple agents or workers. It is useful for shared plans, task status, intermediate results, and coordination state.
Thread-safe shared state
Key-value storage
Multi-agent access
Entry deletion
Complete state clearing
Package: agentic_ai.memory.emotion
The emotion-memory package implements deterministic, operational affective state for artificial agents. It does not claim that an agent experiences subjective human emotion. Instead, it provides inspectable computational mechanisms through which events can influence retention, identity, retrieval, and future action.
The system uses five operational labels:
Ordinary
Success
Failure
Wound
Trauma
These labels are derived from continuous appraisal values and state transitions rather than being assigned arbitrarily.
Identity-conditioned appraisal and forgetting
Linked timestep memory with rooted event trees
Separate identity and action-policy ledgers
Outcome-dependent retention floors
Relevance-first retrieval
Trajectory deduplication
Relevance-gated NumPy tree attention
Correction, expiry, and deletion
Deterministic replay
Auditable memory-state reconstruction
Reinforcement-learning state encoding
Linear Q-learning with environmental reward
Outcome salience can protect the survival and fidelity of a memory, but it never bypasses the semantic relevance gate. Operational emotion labels are also not used directly as reinforcement-learning rewards.
Event → Appraisal → Operational State → Retention → Retrieval → Policy
EmotionMemorySystem
Ingestion, correction, replay, retrieval, and audit
AppraisalEngine
Identity-sensitive appraisal and operational state
EpisodicTimeline
Linked timesteps and rooted event trees
IdentityLedger
Positive and negative contrastive self-facts
PolicyLedger
Repeat and avoidance evidence
RetentionEngine
Identity decay and outcome-dependent retention floors
RelevanceFirstRetriever
Eligibility, deduplication, and bounded ranking
TreeAttentionEngine
Attention within an eligible event tree
RLStateEncoder
Environment, identity, memory, and policy features
LinearQLearner
Deterministic Q-learning with external reward
The full example does not require a Gemini API key.
python agentic_ai/examples/12_emotion_memory.pyThe demonstration:
Ingests three recurring failures
Shows the failure → wound → trauma transition
Performs tree-attention retrieval
Constructs a reinforcement-learning state
Applies an environment-reward Q update
Deletes one event
Deterministically replays the remaining history
The mathematical contract, assumptions, and falsification criteria are documented in:
docs/emotion_architecture.mdFrozen default parameters are stored in:
configs/emotion_architecture_v0.1.yamlShortTermMemory
Recent conversational turns
Current process
LongTermMemory
Durable facts and historical entries
SQLite database
SharedMemory
Coordination across agents and workers
Current process
EmotionMemorySystem
Adaptive episodic memory and policy evidence
Journal and replay architecture
Tools
ToolAgent can expose ordinary Python functions to Gemini through register_tool().
The model can then determine when a tool is required, select the appropriate function, generate its arguments, and use the returned result in its response.
Parameter descriptions can also be supplied explicitly.
agent.register_tool( convert_celsius_to_fahrenheit, description=( "Convert a temperature from Celsius " "to Fahrenheit." ), params={ "celsius": "NUMBER", }, required=["celsius"],)Functions exposed to an agent should have:
Clear and descriptive names
Type hints for every parameter
Concise docstrings
Predictable return values
Limited side effects
Explicit validation where necessary
Gemini uses the function name, parameter types, description, and docstring to decide when and how the tool should be called.
Memory allows an agent to retain relevant context and experience.
Tools allow the same agent to act on the world, perform calculations, retrieve information, or invoke external systems.
Together, they support agents that can:
Remember recent conversations
Retrieve persistent facts
Coordinate through shared state
Learn from operational experience
Select appropriate Python functions
Use tool results in subsequent reasoning
Maintain continuity across multi-step workflows