Data Flow in Atlas
This document describes how data flows through the Atlas system in different usage scenarios.
Basic Query Flow
The simplest interaction with Atlas involves a text query and response:
- User Query: The user submits a text query
- Agent Processing: The AtlasAgent processes the query
- Knowledge Retrieval: Relevant documents are retrieved from the knowledge base
- Context Formation: Documents are formatted as context for the model
- Prompt Creation: The query, context, and system prompt are combined
- Model Generation: The model provider generates a response
- Response Delivery: The response is returned to the user
Multi-Agent Flow
In multi-agent mode, the flow becomes more complex:
- User Query: The user submits a text query
- Controller Processing: The ControllerAgent analyzes the query
- Task Distribution: The controller divides work among specialized workers
- Analysis Worker: Analyzes the query to identify information needs
- Retrieval Worker: Retrieves relevant documents based on analysis
- Draft Worker: Generates initial response drafts
- Parallel Execution: Workers process their tasks concurrently
- Result Collection: The controller collects results from all workers
- Response Synthesis: The controller synthesizes a final response
- Response Delivery: The response is returned to the user
Document Ingestion Flow
When adding documents to the knowledge base:
- Document Input: Documents are provided (files, text, URLs)
- Document Processing: Documents are parsed and processed
- Chunking: Documents are split into smaller pieces
- Metadata Extraction: Information about source, date, etc. is captured
- Embedding Generation: Chunks are converted to vector embeddings
- Storage: Chunks and embeddings are stored in ChromaDB
Streaming Response Flow
When using streaming responses:
- User Query: The user submits a text query
- Knowledge Retrieval: Similar to basic query flow
- Stream Initialization: The model provider starts a streaming response
- Token Delivery: Tokens are delivered as they’re generated
- Callback Execution: A callback function is called for each token
- UI Update: The user interface is updated in real-time
Query-Only Client Flow
When using Atlas as a lightweight query client:
- External Request: Another application calls Atlas functions
- Client Processing: The AtlasQuery client handles the request
- Core Function Use: The client uses Atlas core functions but with minimal overhead
- Response Return: Results are returned to the external application
Error Handling Flow
When errors occur during processing:
- Error Detection: An error is detected during processing
- Error Classification: The error is classified by type and severity
- Recovery Attempt: The system attempts to recover if possible
- Fallback Execution: If recovery fails, fallback mechanisms are used
- User Notification: The user is informed of the error and outcome
Next Steps
- See Examples in the repository for code examples of different flows: https://github.com/inherent-design/atlas/tree/main/examples