/learnings REST endpoints for CRUD over the agno_learnings table, the table that backs every learning store (user_profile, user_memory, session_context, entity_memory, decision_log). Enable learning on an agent and serve it with AgentOS, and the endpoints are available automatically.
Prerequisites
- A supported database: PostgreSQL, SQLite, or MongoDB. Other databases return
501. - An agent with learning enabled (see the Learning quickstart).
Example
learnings_with_agentos.py
http://localhost:7777/docs.
Endpoints
Every endpoint accepts
db_id and table query parameters to target a specific database or table. table requires db_id.
Listing and filtering
GET /learnings returns a paginated envelope: data holds the records and meta holds the pagination info (page, limit, total_pages, total_count).
For a per-user view, list users with
GET /learnings/users, then drill into one with GET /learnings?user_id=....
Creating records
POST computes the same ID for the identity-keyed types, so a record created through the API reconciles with what the agent reads and writes. No orphan, no duplicate.
- Provide the required identity field(s), or the request returns
422. - Include the same identity fields inside
contentso the agent’s store can deserialize the record. - An existing record for that identity returns
409. UsePATCHto update it. - Other types (for example,
decision_log) get a generated ID, so a user can have many.
Updating records
PATCH replaces content and/or metadata. Identity fields are immutable.
Deleting records
204, and never touch records with no owner.
Authorization and isolation
Scoping follows the framework’s opt-in user isolation contract (AuthorizationConfig(user_isolation=True)). Admins, requests with isolation disabled, and requests without a JWT are unscoped and have full access. For a scoped (non-admin) caller:
When RBAC is enabled, the routes require the
learnings:read, learnings:write, or learnings:delete scopes.