-
Notifications
You must be signed in to change notification settings - Fork 167
Self Learning
weego edited this page May 28, 2026
·
1 revision
Self-learning lets an agent write useful learned information into the configured memory backend. It is only meaningful when memory is configured.
agent = LightAgent(
name="PolicyAgent",
instructions="You are a helpful agent.",
model="gpt-4.1",
api_key="your_api_key",
base_url="https://api.openai.com/v1",
memory=memory_backend,
self_learning=True,
)Use a stable user_id:
agent.run("Remember that approvals require the finance manager.", user_id="user_01")
agent.run("What is the approval process?", user_id="user_01")Use self-learning for:
- user preferences
- team-specific procedures
- repeated operational context
- internal knowledge captured from conversation
Avoid it for:
- untrusted public traffic without review
- high-impact domains without provenance
- facts that require external verification
- secrets, credentials, and sensitive personal data
- Combine self-learning with
MemoryPolicy. - Store provenance metadata in the backend.
- Allow users or administrators to delete or correct learned memories.
- Review memory writes for high-impact workflows.
- Separate user memory from tenant-wide knowledge.
LightAgent Wiki - see the repository, releases, and issues.
- Home
- Quick Start
- Core Concepts
- API Reference
- Examples Cookbook
- Migration Guide
- Tools
- Tool Generator
- Memory
- MCP
- Skills
- LightFlow
- Tree of Thought
- Self-Learning
- Multi-Agent
- Tracing and Debugging
- Langfuse Observability
- Model Providers
- browser-use Integration
- Testing and CI
- Deployment Guide
- Architecture
- Security
- Known Limitations
- FAQ
- FAQ 中文
- Roadmap
- Release Process
- Contributing