Prompt
I'm building an agent that needs to use tools and memory, what stack should I use?
Latest observation
Oct 9, 2026
OpenAI APIWeb search: off
If you’re building an agent that needs tools + memory, I’d choose the stack based on whether you want to optimize for speed of prototyping or production reliability.
My default recommendation
Best general-purpose stack
- LLM orchestration: LangGraph or LlamaIndex Workflows
- Backend: Python + FastAPI
- Tool execution: native Python functions / API wrappers
- Short-term memory: conversation state in Postgres or Redis
- Long-term memory / retrieval: Postgres + pgvector or Pinecone
- Persistence / agent state: Postgres
- Observability: LangSmith, OpenTelemetry, or Helicone
- Queue/background jobs: Celery, RQ, or Temporal if workflows are complex
This gives you a clean separation:
- tools = actions the agent can take
- memory = what it can remember across turns and sessions
- state = the exact execution state of the agent
If you want to move fast
Use:
- OpenAI Responses / Assistants-style API
- LangChain or LlamaIndex
- Redis for session memory
- Postgres + pgvector for long-term memory
This is good for an MVP, especially if your agent is mostly:
- chat + retrieval
- function calling
- simple state persistence
If you want production-grade control
Use:
- LangGraph
- FastAPI
- Postgres
- Redis
- pgvector
- Temporal for durable workflows
- OpenTelemetry + Prometheus/Grafana for monitoring
This is better if your agent:
- has multi-step workflows
- needs retries / resumability
- uses many tools
- must survive crashes without losing state
- needs auditability
Memory stack recommendation
1) Short-term memory
Store:
- current conversation
- active plan
- recent tool outputs
- scratchpad/state
Best options:
- Redis if you want speed and TTL-based sessions
- Postgres JSONB if you want durable state and easier querying
2) Long-term memory
Store:
- user preferences
- facts extracted from conversations
- past tasks and outcomes
- embeddings for semantic retrieval
Best options:
- Postgres + pgvector if you want simplicity
- Pinecone / Weaviate / Milvus if you need higher-scale vector search
3) Episodic memory
If your agent should remember “what happened before,” store events as:
- timestamped records
- tool calls
- model decisions
- final outcomes
This is often best as an append-only event log in Postgres.
Tooling stack recommendation
If your agent has tools like:
- web search
- database queries
- calendar/email actions
- file operations
- internal APIs
Then define tools as:
- typed Python functions
- REST endpoints
- background jobs for slow tasks
Best practice:
- validate inputs with Pydantic
- make tools idempotent where possible
- log every call
- time out slow tools
- keep tool outputs structured
A strong practical stack
If I were building this today, I’d use:
- Python
- FastAPI
- LangGraph
- Postgres
- Redis
- pgvector
- OpenAI / Anthropic model API
- LangSmith for tracing
- Docker for deployment
That’s a very solid baseline.
When to use what
Use LangGraph if:
- you need branching workflows
- you need checkpoints
- you need durable state
- you want explicit control over agent flow
Use LlamaIndex if:
- your main challenge is retrieval / knowledge access
- memory is mostly document-centered
- you want a strong data ingestion pipeline
Use plain OpenAI function calling if:
- the agent is simple
- you don’t need complex control flow
- you want to avoid framework complexity
Avoid these early mistakes
- putting all memory in prompts only
- using a vector DB as your only memory store
- letting tools return unstructured text only
- skipping persistence of agent state
- building complex agent loops without retries/checkpoints
- storing everything forever without retention rules
My short answer
If you want the safest bet:
Python + FastAPI + LangGraph + Postgres + Redis + pgvector
That stack covers:
- tool use
- memory
- durable state
- production workflows
- easy scaling later
If you want, I can also give you:
- a minimal MVP stack,
- a production architecture diagram, or
- a recommended folder structure for the agent.