Using CoreTex In An Agent
The agent lifecycle has four moments: before a model call, fetch cited context with prefetch and inject it; after the call, feed raw messages, tool calls, tool results, and documents into sync_turn; at session end, call flush_session; and periodically, resolve the newest public state and restart under the new verified authority if needed.
Python applications use AgentMemory directly or through the localhost sidecar. Keep unrelated users in separate scopes and always inject the exact rendered context the system returns.