AI Agents with Memory

⏱️ Time to Complete: 15 minutes 🎯 Level: Intermediate 💻 Language: TypeScript

What You'll Build

An AI agent that:

  • ✅ Maintains conversation history across sessions

  • ✅ Searches your knowledge base semantically

  • ✅ Uses tools to accomplish tasks

  • ✅ Reasons across multiple data sources

  • ✅ Streams responses in real-time

📁 Tool calling examplesarrow-up-right | 🚀 Production example: Zine


Why Agents Need Memory

Traditional chatbots forget everything between sessions. AI agents with semantic memory:

  • ✅ Remember past conversations and decisions

  • ✅ Search across all your company's knowledge

  • ✅ Use tools to take actions (not just answer questions)

  • ✅ Reason across multiple data sources

  • ✅ Share context with other agents

Real-world example: Zinearrow-up-right uses this pattern to let agents search Slack threads, meeting transcripts, and GitHub discussions simultaneously.


Prerequisites

circle-info

Need Python or .NET versions? Open Ask Graphlit from the Developer Portal sidebar (or visit ask.graphlit.devarrow-up-right) for autogenerated samples in any SDK.


Pattern 1: Multi-Turn Conversations with Memory

First, create an agent that keeps track of everything you've asked it:

What's happening:

  • Agent automatically retrieves relevant context from its memory

  • Conversation state persists across turns (follow-up questions work)

  • You can inspect the full conversation history after each exchange


Pattern 2: Agentic Tool Calling

Let your agent call custom tools instead of just responding with text:

What's happening:

  • Agent sees the available tool definitions and selects the right one

  • Tool calls are recorded on the conversation so you can execute them

  • Responses combine tool outputs with natural language answers

Real-world example: Zine uses this pattern for questions like “Why are checkout timeouts spiking?” — the agent queries Sentry, Slack, GitHub, and meeting notes via tools.


Pattern 3: Multi-Agent Systems with Shared Knowledge

Point multiple agents at the same semantic memory but give each its own persona:

What's happening:

  • Two agents share the same knowledge base but have different prompts and temperatures

  • Retrieval strategy keeps both agents grounded in the same set of documents

  • You can orchestrate the agents together (sales → engineering handoff) without duplicating memory


Pattern 4: Streaming Responses

For real-time user experiences, stream agent output as it happens:

Use cases:

  • Real-time chat experiences (Graphlit + Next.js chat app)

  • Live meeting transcription with incremental summaries

  • Progressive document generation or approvals


Production Patterns

Error Handling

Rate Limiting

Context Management


Real-World Examples

1. Customer Support Agent

  • Searches past tickets, product docs, and conversations

  • Maintains conversation history per customer

  • Uses tools to create tickets, update CRM

2. Engineering Agent (like Zine)

  • Searches Slack, GitHub, Jira simultaneously

  • Reasons across code, discussions, and meeting notes

  • Uses tools to fetch error logs, run queries

3. Sales Agent

  • Searches customer conversations, contracts, meeting notes

  • Tracks deal status and objections

  • Uses tools to update CRM, send follow-ups


Next Steps


Full Example: Production Agent

See the complete Next.js agent in graphlit-samplesarrow-up-right:

  • Tool calling with streaming UI

  • Shared collections and semantic memory queries

  • Production-ready configuration (environment variables, error handling)


Build agents that actually remember. Build with Graphlit.

Last updated