Skip to content

Python public API index

Every name exported from astrocyte (astrocyte.__all__) — the import surface covered by the stability policy. Import from the package root, not submodules:

from astrocyte import Astrocyte, RecallRequest, AccessDenied

This page is generated by docs/scripts/generate-api-index.py; regenerate after changing the public surface. CI fails if a public name is missing from the docs, and the surface itself is pinned by astrocyte-py/tests/test_public_api_surface.py plus a griffe breaking-change gate. For usage-oriented documentation see the Memory API reference.

NameSummary
AccessGrantAccessGrant(bank_id: ‘str’, principal: ‘str’, permissions: ‘list[str]‘)
ActorIdentityStructured actor for access control and bank resolution (ADR-002)
AstrocyteThe Astrocyte memory framework — unified API for AI agent memory
AstrocyteContextCaller identity for access control
AuditEventAuditEvent(event_type: ‘str’, bank_id: ‘str’, actor: ‘str’, timestamp: ‘datetime’, memory_ids: ‘list[str] | None’ = None, reason: ‘str | None’ = None, metadata: ‘Metadata | None’ = None)
BankHealthBankHealth(bank_id: ‘str’, score: ‘float’, status: “Literal[‘healthy’, ‘warning’, ‘unhealthy’]”, issues: ‘list[HealthIssue]’, metrics: ‘dict[str, float]’, assessed_at: ‘datetime’)
BankResolverConvention-based default bank id from a resolved :class:ActorIdentity
CompletionCompletion(text: ‘str’, model: ‘str’, usage: ‘TokenUsage | None’ = None, tool_calls: ‘list[ToolCall] | None’ = None)
ContentPartTagged union for multimodal content
DataClassificationDataClassification(level: ‘int’, label: ‘str’, categories: ‘list[str] | None’ = None, classified_by: ‘str’ = ‘rules’, classified_at: ‘datetime | None’ = None)
DispositionsPersonality modifiers for synthesis
DocumentDocument(id: ‘str’, text: ‘str’, metadata: ‘Metadata | None’ = None, tags: ‘list[str] | None’ = None)
DocumentFiltersDocumentFilters(tags: ‘list[str] | None’ = None, metadata_filters: ‘Metadata | None’ = None)
DocumentHitDocumentHit(document_id: ‘str’, text: ‘str’, score: ‘float’, metadata: ‘Metadata | None’ = None)
DocumentStoreSPI for document storage with full-text search. Optional for Tier 1
EngineCapabilitiesEngineCapabilities(supports_reflect: ‘bool’ = False, supports_forget: ‘bool’ = False, supports_semantic_search: ‘bool’ = True, supports_keyword_search: ‘bool’ = False, supports_graph_search: ‘bool’ = False, supports_temporal_search: ‘bool’ = False, supports_dispositions: ‘bool’ = False, supports_consolidation: ‘bool’ = False, supports_entities: ‘bool’ = False, supports_tags: ‘bool’ = False, supports_metadata: ‘bool’ = True, supports_compile: ‘bool’ = False, max_retain_bytes: ‘int | None’ = None, max_recall_results: ‘int | None’ = None, max_embedding_dims: ‘int | None’ = None)
EngineProviderSPI for full-stack memory engines
EntityEntity(id: ‘str’, name: ‘str’, entity_type: ‘str’, aliases: ‘list[str] | None’ = None, metadata: ‘Metadata | None’ = None, embedding: ‘list[float] | None’ = None, mention_count: ‘int’ = 1)
EntityLinkA typed relationship between two entities in the knowledge graph
EvalMetricsEvalMetrics(recall_precision: ‘float’, recall_hit_rate: ‘float’, recall_mrr: ‘float’, recall_ndcg: ‘float’, retain_latency_p50_ms: ‘float’, retain_latency_p95_ms: ‘float’, recall_latency_p50_ms: ‘float’, recall_latency_p95_ms: ‘float’, total_tokens_used: ‘int’, total_duration_seconds: ‘float’, reflect_accuracy: ‘float | None’ = None, reflect_completeness: ‘float | None’ = None, reflect_hallucination_rate: ‘float | None’ = None, reflect_latency_p50_ms: ‘float | None’ = None, reflect_latency_p95_ms: ‘float | None’ = None, recall_coverage: ‘float | None’ = None, recall_reflect_gap: ‘dict[str, int] | None’ = None, abstention_rate_adversarial: ‘float | None’ = None, tokens_by_phase: ‘dict[str, int] | None’ = None, api_calls_total: ‘int | None’ = None, api_calls_by_endpoint: ‘dict[str, int] | None’ = None, cost_total_usd: ‘float | None’ = None, cost_per_question_usd: ‘float | None’ = None, retain_latency_p99_ms: ‘float | None’ = None, recall_latency_p99_ms: ‘float | None’ = None, reflect_latency_p99_ms: ‘float | None’ = None, e2e_per_question_p50_ms: ‘float | None’ = None, e2e_per_question_p95_ms: ‘float | None’ = None, error_count_by_type: ‘dict[str, int] | None’ = None, openai_retry_count: ‘int | None’ = None, failed_retain_count: ‘int | None’ = None, cascade_decisions: ‘dict[str, int] | None’ = None, entities_resolved_count: ‘int | None’ = None, entities_created_count: ‘int | None’ = None, composite_score_distribution: ‘dict[str, int] | None’ = None, wiki_pages_total: ‘int | None’ = None, wiki_pages_per_persona: ‘float | None’ = None)
EvalResultEvalResult(suite: ‘str’, provider: ‘str’, provider_tier: ‘str’, timestamp: ‘datetime’, metrics: ‘EvalMetrics’, per_query_results: ‘list[QueryResult]’, config_snapshot: ‘Metadata | None’ = None)
ForgetRequestForgetRequest(bank_id: ‘str’, memory_ids: ‘list[str] | None’ = None, tags: ‘list[str] | None’ = None, before_date: ‘datetime | None’ = None, scope: ‘str | None’ = None)
ForgetResultForgetResult(deleted_count: ‘int’, archived_count: ‘int’ = 0)
ForgetSelectorForgetSelector(bank_ids: ‘list[str]’, scope: ‘str | None’ = None, tags: ‘list[str] | None’ = None, before_date: ‘datetime | None’ = None, memory_ids: ‘list[str] | None’ = None)
GraphHitGraphHit(memory_id: ‘str’, text: ‘str’, connected_entities: ‘list[str]’, depth: ‘int’, score: ‘float’)
GraphStoreSPI for graph database adapters. Optional for Tier 1
HealthIssueHealthIssue(severity: “Literal[‘info’, ‘warning’, ‘critical’]”, code: ‘str’, message: ‘str’, recommendation: ‘str’)
HealthStatusHealthStatus(healthy: ‘bool’, message: ‘str | None’ = None, latency_ms: ‘float | None’ = None, last_check_at: ‘datetime | None’ = None)
HookEventHookEvent(event_id: ‘str’, type: ‘str’, timestamp: ‘datetime’, bank_id: ‘str | None’ = None, data: ‘Metadata | None’ = None, trace_id: ‘str | None’ = None)
HttpClientContextHttpClientContext(proxy: ‘str | None’ = None, ca_bundle: ‘str | None’ = None, headers: ‘dict[str, str] | None’ = None, timeouts: ‘dict[str, float] | None’ = None)
HybridEngineProviderMerges recall from an EngineProvider and a PipelineOrchestrator
IdentityConfigIdentity-driven bank resolution and ACL helpers (M1–M2 / v0.5.0)
LegalHoldLegalHold(hold_id: ‘str’, bank_id: ‘str’, reason: ‘str’, set_at: ‘datetime’, set_by: ‘str’)
LifecycleActionResult of a lifecycle TTL evaluation on a single memory
LifecycleRunResultLifecycleRunResult(archived_count: ‘int’, deleted_count: ‘int’, skipped_count: ‘int’, actions: ‘list[LifecycleAction]‘)
LLMCapabilitiesLLMCapabilities(supports_multimodal_completion: ‘bool’ = False, modalities_supported: ‘tuple[str, …] | None’ = None, supports_multimodal_embedding: ‘bool’ = False, supports_batch_embed: ‘bool’ = True)
LLMProviderSPI for LLM access needed by the Astrocyte core pipeline
MemoryEntityAssociationMemoryEntityAssociation(memory_id: ‘str’, entity_id: ‘str’)
MemoryHitMemoryHit(text: ‘str’, score: ‘float’, fact_type: ‘str | None’ = None, metadata: ‘Metadata | None’ = None, tags: ‘list[str] | None’ = None, occurred_at: ‘datetime | None’ = None, source: ‘str | None’ = None, memory_id: ‘str | None’ = None, bank_id: ‘str | None’ = None, memory_layer: ‘str | None’ = None, utility_score: ‘float | None’ = None, retained_at: ‘datetime | None’ = None, chunk_id: ‘str | None’ = None)
MemoryUsageMemoryUsage(memory_id: ‘str’, text: ‘str’, recall_count: ‘int’, last_recalled_at: ‘datetime’)
MessageMessage(role: ‘str’, content: ‘str | list[ContentPart]’ = ”, tool_calls: ‘list[ToolCall] | None’ = None, tool_call_id: ‘str | None’ = None, name: ‘str | None’ = None)
MultiBankStrategyMulti-bank recall behavior. Default parallel matches legacy banks=[...] without an explicit strategy
OutboundTransportProviderSPI for credential gateways and enterprise HTTP/TLS proxies
PiiMatchPiiMatch(pii_type: ‘str’, start: ‘int’, end: ‘int’, matched_text: ‘str’, replacement: ‘str | None’ = None)
PreparedRetainInputResult of Raw → normalizer → metadata/tags merge (before chunk/embed in orchestrator)
QualityDataPointQualityDataPoint(date: ‘date’, retain_count: ‘int’, recall_count: ‘int’, recall_hit_rate: ‘float’, avg_recall_score: ‘float’, dedup_rate: ‘float’, reflect_success_rate: ‘float’)
QueryResultQueryResult(query: ‘str’, expected: ‘list[str]’, actual: ‘list[MemoryHit]’, relevant_found: ‘int’, precision: ‘float’, reciprocal_rank: ‘float’, latency_ms: ‘float’)
RecallRequestRecallRequest(query: ‘str’, bank_id: ‘str’, max_results: ‘int’ = 10, max_tokens: ‘int | None’ = None, fact_types: ‘list[str] | None’ = None, tags: ‘list[str] | None’ = None, time_range: ‘tuple[datetime, datetime] | None’ = None, include_sources: ‘bool’ = False, layer_weights: ‘dict[str, float] | None’ = None, detail_level: ‘str | None’ = None, external_context: ‘list[MemoryHit] | None’ = None, as_of: ‘datetime | None’ = None, query_reference_date: ‘datetime | None’ = None, dispositions: “‘Dispositions | None’” = None, session_id: ‘str | None’ = None)
RecallResultRecallResult(hits: ‘list[MemoryHit]’, total_available: ‘int’, truncated: ‘bool’, trace: ‘RecallTrace | None’ = None, authority_context: ‘str | None’ = None, top_semantic_score: ‘float’ = 0.0)
RecallTraceRecallTrace(strategies_used: ‘list[str] | None’ = None, total_candidates: ‘int | None’ = None, fusion_method: ‘str | None’ = None, latency_ms: ‘float | None’ = None, strategy_timings_ms: ‘dict[str, float] | None’ = None, strategy_candidate_counts: ‘dict[str, int] | None’ = None, tier_used: ‘int | None’ = None, layer_distribution: ‘dict[str, int] | None’ = None, cache_hit: ‘bool | None’ = None, wiki_tier_used: ‘bool | None’ = None)
ReflectRequestReflectRequest(query: ‘str’, bank_id: ‘str’, max_tokens: ‘int | None’ = None, include_sources: ‘bool’ = True, dispositions: ‘Dispositions | None’ = None, tags: ‘list[str] | None’ = None, as_of: ‘datetime | None’ = None, query_reference_date: ‘datetime | None’ = None)
ReflectResultReflectResult(answer: ‘str’, confidence: ‘float | None’ = None, sources: ‘list[MemoryHit] | None’ = None, observations: ‘list[str] | None’ = None, authority_context: ‘str | None’ = None)
RegressionAlertRegressionAlert(metric: ‘str’, current_value: ‘float’, baseline_value: ‘float’, delta: ‘float’, delta_percent: ‘float’, severity: “Literal[‘warning’, ‘critical’]“)
RetainRequestRetainRequest(content: ‘str’, bank_id: ‘str’, metadata: ‘Metadata | None’ = None, tags: ‘list[str] | None’ = None, occurred_at: ‘datetime | None’ = None, source: ‘str | None’ = None, content_type: ‘str’ = ‘text’, extraction_profile: ‘str | None’ = None, mip_pipeline: ‘PipelineSpec | None’ = None, mip_rule_name: ‘str | None’ = None)
RetainResultRetainResult(stored: ‘bool’, memory_id: ‘str | None’ = None, deduplicated: ‘bool’ = False, error: ‘str | None’ = None, retention_action: ‘str | None’ = None, curated: ‘bool’ = False, memory_layer: ‘str | None’ = None)
RoutingDecisionOutput of MIP routing — tells Astrocyte where/how to store
TokenUsageTokenUsage(input_tokens: ‘int’, output_tokens: ‘int’)
TransportCapabilitiesTransportCapabilities(supports_proxy: ‘bool’ = False, supports_custom_ca: ‘bool’ = False, supports_client_cert: ‘bool’ = False, supports_headers: ‘bool’ = False)
VectorFiltersVectorFilters(bank_id: ‘str | None’ = None, tags: ‘list[str] | None’ = None, fact_types: ‘list[str] | None’ = None, time_range: ‘tuple[datetime, datetime] | None’ = None, metadata_filters: ‘Metadata | None’ = None, as_of: ‘datetime | None’ = None, session_id: ‘str | None’ = None)
VectorHitVectorHit(id: ‘str’, text: ‘str’, score: ‘float’, metadata: ‘Metadata | None’ = None, tags: ‘list[str] | None’ = None, fact_type: ‘str | None’ = None, occurred_at: ‘datetime | None’ = None, memory_layer: ‘str | None’ = None, retained_at: ‘datetime | None’ = None, chunk_id: ‘str | None’ = None)
VectorItemVectorItem(id: ‘str’, bank_id: ‘str’, vector: ‘list[float]’, text: ‘str’, metadata: ‘Metadata | None’ = None, tags: ‘list[str] | None’ = None, fact_type: ‘str | None’ = None, occurred_at: ‘datetime | None’ = None, memory_layer: ‘str | None’ = None, retained_at: ‘datetime | None’ = None, chunk_id: ‘str | None’ = None)
VectorStoreSPI for vector database adapters. Required for Tier 1
NameSummary
accessible_read_banksBank IDs where context has effective read after OBO intersection
auth_with_oauth_cache_namespaceAttach _oauth_cache_id so OAuth token caches do not collide across proxy sources
build_proxy_headersBuild HTTP headers (Bearer, API key, OAuth2 client_credentials / refresh, optional static headers)
clear_oauth2_token_cache_for_testsTest helper — clear in-memory OAuth token cache
effective_permissionsEffective permission set for bank_id, including OBO intersection
exchange_oauth2_authorization_codeExchange an authorization code for tokens (RFC 6749 §4.1.3)
extraction_profile_for_sourceResolve sources.*.extraction_profile for ingest callers (full webhook wiring is M4)
fetch_oauth2_client_credentials_tokenObtain an access token (RFC 6749 client_credentials). Cached until shortly before expiry
fetch_oauth2_refresh_access_tokenObtain an access token via grant_type=refresh_token (RFC 6749)
fetch_proxy_recall_hitsCall source.url (GET or POST) and parse JSON hits / results arrays
format_principalSerialize actor to the grant-matching principal form \{type\}:\{id\}
gather_proxy_hits_for_bankFetch hits from all type: proxy sources whose target_bank matches bank_id
log_safeReturn a log-safe string representation of value
merge_external_into_recall_resultCombine external hits with result.hits by score, dedupe by text, trim to max_results
merge_manual_and_proxy_hitsCombine caller external_context with configured proxy sources for this bank
merged_extraction_profilesReturn builtins plus config.extraction_profiles (user definitions override same-named builtins)
Metadatadict() -> new empty dictionary
parse_principalParse principal string into :class:ActorIdentity (ADR-002)
post_oauth2_token_endpointPOST application/x-www-form-urlencoded to the token endpoint
prepare_retain_inputSingle entrypoint for the pre-chunk extraction chain (normalizer + profile fields)
resolve_actorResolved actor: explicit context.actor, else parse context.principal
resolve_providerResolve a single provider by name from entry points, or by import path
validate_proxy_recall_dnsAsync-safe DNS check: resolve host in a worker thread, then validate all addresses
validate_proxy_recall_urlReject URLs that enable SSRF (private/loopback/metadata-ranged IPs, non-HTTP(S), no host)
NameSummary
AccessDeniedPrincipal lacks required permission on bank
AstrocyteErrorBase exception for all Astrocyte errors
CapabilityNotSupportedThe provider does not support the requested capability
ConfigErrorConfiguration is invalid or missing
CrossBorderViolationOperation would violate data residency policy
IngestErrorInbound ingest (webhook, stream, …) rejected a payload or configuration
LegalHoldActiveOperation blocked because bank is under legal hold
MipRoutingErrorMIP routing configuration or evaluation error
PiiRejectedContent rejected due to PII detection policy
ProviderUnavailableProvider is unreachable or circuit breaker is open
RateLimitedRequest exceeds rate limit
NameSummary
MetadataValueRepresent a PEP 604 union type
PLACE_BANKstr(object=”) -> str
PLACE_QUERYstr(object=”) -> str