Documentation Index
Fetch the complete documentation index at: https://docs.ivory.finance/llms.txt
Use this file to discover all available pages before exploring further.
How it works
Unlike the simpler/answer endpoint which does a single vector search, the agent runs a two-phase loop:
Phase 1 — Tool loop (up to 4 turns)
The LLM decides autonomously which tools to call and in what order. Every tool call emits an
agent_step SSE event so your UI can show live progress.Example reasoning chain for “AWS Revenue Q4 2025”:news_search→ finds Amazon reported Q4 2025 earnings on Feb 5, 2026search_filings→ locates the 10-K filed 2026-02-07retrieve_from_filing→ semantic search inside that specific 10-K for AWS revenue
Temporal reasoning
This is the core advantage over/answer. Pure KNN vector search cannot tell “Q4 2025 10-K” from “Q3 2025 10-Q” — the text is nearly identical. The agent solves this by:
- Using
news_searchto find the actual earnings report date - Using
search_filingswith a preciseafter_dateto locate the right filing - Using
retrieve_from_filingscoped to that one accession number
Conversation history
The agent supports stateless (tenant-owned) chat persistence. Your system stores messages; you replay them on every request. The server never stores end-user messages.| Field | Type | Description |
|---|---|---|
chat_id | string | null | Opaque ID echoed back in conversation_state. Use to route the updated history to the right record. |
conversation_history | ConversationTurn[] | null | Prior user/assistant turns injected as context before the current query. Supersedes session_id when both are provided. |
conversation_state event is emitted containing all user-facing turns (including the current one). Persist this as your new history for the next request.
conversation_history and session_id are independent mechanisms. conversation_history is for tenant-managed cross-session persistence (Model B). session_id is a server-side Valkey cache with a 24-hour TTL, useful for within-session continuity without replaying history. If both are provided, conversation_history takes precedence.SSE stream — code examples
Connect withAccept: text/event-stream. Each line: data: <JSON>\n\n.
Multi-tenant configuration
Pass an optionalconfig object to choose any supported LLM or connect the agent to your own database. All fields are optional — omit config entirely to use server defaults (GPT-4o + server Postgres).
LLM Providers
OpenAI (GPT-4o) or Anthropic (Claude). Switch per request with no redeployment.
Database Connections
Connect PostgreSQL, MySQL, MariaDB, MongoDB, or Oracle. The agent queries your data alongside SEC filings.
Citation scheme
| Bracket | Source | List in response |
|---|---|---|
[S1], [S2], … | SEC filing chunks from retrieve_from_filing | sources[] |
[W1], [W2], … | Web results from web_search | web_sources[] source_type: "web" |
[N1], [N2], … | News results from news_search | web_sources[] source_type: "news" |
[S1] and [S2] from two different retrieve_from_filing calls on different filings both appear in sources[] in order.
