symfonic.agent.fastapi.memory_create_router¶
memory_create_router ¶
FastAPI router for memory-create endpoints (v6.1.4).
Five POST /memories/{layer} endpoints, one per memory layer,
exposing each SDK layer's write path over HTTP so external UIs can
create memory records without reaching into the Python SDK.
Design notes¶
- Each layer has a distinct payload shape (semantic = label+properties,
episodic = content+action_type, procedural = steps+trigger, working
= ttl, prospective = trigger+task), so we ship five layer-specific
endpoints rather than one generic
POST /memorieswith a discriminated union. That matches the existingPATCH /memories/{id}+DELETE /memories/{id}idiom and keeps OpenAPI readable. - Request models set
extra="forbid"so typos do not silently no-op, and straytenant_idfields in the body are rejected (422) — the tenant is always derived from theX-Tenant-IDheader. - Budget tracking for writes is deferred to a future v6.x release; writes are cheap and budget fan-out happens on LLM calls only.
- Every create emits an
AuditLogEntryvia the existingemit_audit_eventhook (memory.create.{layer}).
Request / response models live in memory_create_models.py. Per-
layer handler bodies live in memory_create_handlers.py. This
module is a thin APIRouter registration shim to keep routing concerns
isolated from business logic and stay under the 300-LOC cap.
create_memory_create_router ¶
Create the POST /memories/{layer} sub-router.
Mounted from create_agent_router with the same /api/v1 prefix.