Skip to main content

Data Flow

This document describes the data processing flow of OpenHuman.

Request Lifecycle

1. User Input → 2. Context Assembly → 3. Agent Reasoning → 4. Tool Execution → 5. Response Return

6. Memory Storage (if important)

Detailed Flow

1. User Input

Supports multiple input forms:

  • Text messages
  • Voice (STT conversion)
  • File uploads
  • Images

2. Context Assembly

Current Message
+ Historical Conversation (compressed)
+ Retrieved Memories
+ Relevant Tool Descriptions
+ User Preferences
= Assembled Context

3. Agent Reasoning

Agent analyzes the context and decides:

  • Whether to call a tool
  • Which tool to call
  • How to organize the response

4. Tool Execution

Tool execution may involve:

  • Local operations (files, shell)
  • API calls (search, web scraping)
  • Third-party services (email, calendar)

5. Response Return

Response is returned as a stream:

for await (const chunk of stream) {
process.stdout.write(chunk.delta);
}

6. Memory Storage

Agent judges whether it is worth storing:

await client.memory.store({
content: 'User mentioned his birthday is December 25',
importance: 0.8,
tags: ['personal', 'birthday'],
});

Asynchronous Event Flow

Third-party Service → Webhook → Trigger Classification → Agent Response

Memory Storage

Next Steps