Q&A: ExplainAPI configuration and deployment #285
Unanswered
web3guru888
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Frequently asked questions — ExplainAPI (#283)
Q1: How do I generate and rotate API keys?
build_explain_app()acceptsapi_keys: frozenset[str].Load keys from environment variables or a secret manager at startup:
To rotate: update the env var and restart the process (or add hot-reload logic by
passing a mutable
setwrapped in a callable dependency).Q2: What
rate_limit_rpsvalue should I start with?The burst capacity equals
rate_limit_rps(1 second of tokens).If you see frequent 429s from legitimate clients, increase the value or implement
client-side exponential backoff.
Q3: What does
GET /traces?limit=200cost in memory?The
InMemoryTraceStoragefrom Phase 8.1 uses adequewithmaxlen=buffer_capacity.Reading a snapshot is O(N) where N =
min(buffer_capacity, limit).buffer_capacity/tracesalways returns ≤ 200 items regardless of buffer size. If you need more,use
sincepagination:Q4: Can I query the graph while a
CognitiveCycletick is running?Yes —
CausalGraphusesasyncio.Lockinternally.GET /graph/snapshotacquires the lock briefly to copy state; it will block for atmost one
add_edge()call duration (microseconds), then release.There is no long-held read lock — snapshot is a point-in-time copy.
Q5: How should I handle
GET /graph/ancestors/{id}with deep DAGs?The
max_depthparameter (default 10, max 50) prevents runaway BFS on large graphs.For Phase 8 cognitive graphs, practical depths are:
CognitiveCycletickFor deep graphs, use
max_depth=50and paginate by re-querying from the deepestancestor returned (using its ID as the new starting
node_id).Q6: How do I mount ExplainApp alongside an existing aiohttp server?
Use
uvicornwith the FastAPI app directly, or mount it as a sub-app:Or run as a standalone service on a separate port (recommended for production isolation).
Q7: How do I monitor ExplainAPI health with Prometheus alerts?
Three recommended alerting rules:
Beta Was this translation helpful? Give feedback.
All reactions