Skip to main content
AgentOS exposes /learnings REST endpoints for CRUD over the agno_learnings table, the table that backs the user_profile, user_memory, session_context, entity_memory, and decision_log stores (learned_knowledge lives in the knowledge base instead). 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
Browse the interactive OpenAPI docs at 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

Identity-keyed learning types use deterministic IDs derived from their identity fields. POST computes the same ID, so a record created through the API reconciles with what the agent reads and writes without creating orphaned or duplicate rows.
  • Provide the required identity field(s), or the request returns 422.
  • Include the same identity fields inside content so the agent’s store can deserialize the record.
  • An existing record for that identity returns 409. Use PATCH to 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

Both return 204. The user-level delete never touches records with no owner.

Authorization and isolation

Scoping follows the framework’s opt-in user isolation contract (AuthorizationConfig(user_isolation=True)). Admins and requests with isolation disabled are unscoped. Anonymous requests are unscoped only on an open instance. JWT-enabled instances reject missing tokens with 401, static security-key callers are unscoped, and service-account PATs always self-scope unless they carry the admin scope. For a scoped non-admin caller: When RBAC is enabled, the routes require the learnings:read, learnings:write, or learnings:delete scopes.

Developer Resources