Python · Gemini · v0.2.1

Agents with memory

Build emotion-aware agents that appraise experience, preserve what mattered, revise their identity safely, and bring generative intelligence directly into SQL workflows.

Iₜ
emotion memory
agentic-ai-kit / 0.2.1

An event is not an emotion. Identity decides what it means.

Identity ledgerpositive + contrastive facts
Appraisal enginealignment · valence · salience
SQL AIgenerate · classify · extract
Scroll to enter the system
01 / The thesis

The future agent does not only retrieve history. It learns which history became part of the self.

The emotion-memory architecture models experience through identity alignment, outcome evidence, expectation violation, recurrence, salience, and retention. Success, failure, wound, and trauma become operational states rather than decorative labels.

The rest of the kit keeps that research practical: Gemini agents, tools, RAG, structured output, multi-agent patterns, MCP-style integrations, dataframe analysis, machine-learning automation, and local SQL AI enrichment.

02 / Emotion-aware episodic memory

Experience becomes architecture.

A deterministic pipeline converts event and outcome evidence into appraisal, affective state, identity pressure, retention, retrieval, and policy evidence. Corrections rebuild derived state from the active journal so invalid evidence cannot haunt future decisions.

01 · APPRAISAL ENGINE

The same event can mean something different to a different identity.

Identity alignment, valence, expectation violation, salience, recurrence, success confidence, failure confidence, and evidence quality are computed explicitly before an affective state is produced.

Aₜ = [ alignment, valence, expectation_violation, salience, recurrence ]
AppraisalEngine IdentityState OutcomeEvidence
02 · AFFECTIVE STATE

Memory changes action.

Appraisal produces repeat pressure, avoidance pressure, identity-update pressure, retention floors, expectation updates, and operational outcome regions.

SUCCESS FAILURE WOUND TRAUMA
03 · REPLAY

Correction-safe memory

Ingest, correct, delete, and expire operations remain auditable. Derived state is rebuilt from active evidence.

EpisodeJournalEntryAuditEntry
04 · RETRIEVAL

Relevance first

Candidate memories pass relevance gates before emotional retention and trajectory deduplication influence the final selection.

RetrievalTraceRetentionMode
05 · RESEARCH

Tree attention + RL

Experimental primitives explore event-tree attention, state encoding, temporal-difference updates, and memory-shaped action selection.

TreeAttentionEngineLinearQLearner
03 / SQL AI

Put intelligence inside the query.

Parse SQL pseudo-functions, execute the relational query locally, enrich the resulting rows with Gemini in parallel batches, and merge the generated columns back into a dataframe or replacement table.

-- Add an AI-generated customer insight to every selected row
SELECT
    customer_id,
    feedback,
    ai_generate(
        prompt='Write one sharp customer-experience insight',
        model='gemini-2.5-flash'
    ) AS customer_insight
FROM feedback;
-- Summarize long support transcripts inside a normal SQL workflow
SELECT
    ticket_id,
    transcript,
    ai_summarize(
        prompt='Summarize the issue in twenty words or fewer',
        model='gemini-2.5-flash'
    ) AS summary
FROM support_tickets;
-- Classify each row into one constrained business taxonomy
SELECT
    article_id,
    body,
    ai_classify(
        prompt='Classify the business topic',
        labels='Retail | Supply Chain | Pricing | Marketing'
    ) AS topic
FROM articles;
-- Create a new table containing extracted retrieval signals
CREATE OR REPLACE TABLE enriched_browse AS SELECT
    session_id,
    page_text,
    ai_extract(
        prompt='Extract high-signal shopping-intent keywords',
        count=5
    ) AS retrieval_keywords
FROM browse_logs;
04 / The broader kit

One core. Multiple agent surfaces.

The project moves from general agent foundations to specialized workflows without forcing every use case into one orchestration abstraction.

01

Tool agents

Register Python functions, generate Gemini tool schemas, and let the model invoke capabilities when needed.

02

Structured output

Use JSON agents when downstream systems need parsed objects rather than prose.

03

RAG

Chunk, embed, store, retrieve, and answer from private knowledge with grounded context.

04

Data science

Profile dataframes, train baseline models, detect leakage, compare metrics, and automate modelling workflows.

05

Multi-agent patterns

Run orchestrator, parallel, supervisor, conversation, and debate-style coordination patterns.

06

MCP

Expose and consume tools using lightweight Model Context Protocol style server and client components.

05 / Begin

Make the first agent remember.

Install from PyPI, set your Gemini API key, and start with the simple agent core. The emotion-memory architecture and SQL AI modules are available when the system needs to become more ambitious.

# Install
pip install agentic-ai-kit

# Configure
export GEMINI_API_KEY="your-key-here"

# Build
from agentic_ai.agents import BaseAgent

agent = BaseAgent(
    name="Sage",
    sys_prompt="Be useful and concise.",
)

print(agent.think("What matters here?"))