How frappe/flow_client works
Flow embeds a configurable AI assistant in Frappe, with a Python agent framework behind the Desk chat. A user sends a prompt through the chat panel; a persisted session runs the configured agent, which can call tools, use knowledge retrieval and memory, and records each turn as a Flow Run. Knowledge ingestion and scheduled or DocType-triggered agents are major product capabilities documented by the repository, though their complete wiring is not shown in the excerpts. Edges below are limited to documented or indexed references; dashed links mark unverified integration points.
Main entry points: flow_session.py Session runtime · agent.py Agent execution · retriever.py Knowledge retrieval · session.py Session creation
Components 20
Desk chat
- Chat panel
frontend/src/App.vue - Chat state
frontend/src/store.js - Chat API
flow/api/api.py
Agent runtime
- Session runtime
flow/flow/doctype/flow_session/flow_session.py - Session creation
flow/lib/session.py - Agent execution
flow/lib/agent.py - Model client
flow/lib/model.py - Run history
flow/flow/doctype/flow_run/flow_run.py
Knowledge retrieval
- Knowledge ingestion
flow/knowledge/ingest.py - Content extraction
flow/knowledge/extract.py - Knowledge retrieval
flow/knowledge/retriever.py - Knowledge index
flow/knowledge/store.py - Chat attachments
flow/flow/doctype/flow_session_attachment/flow_session_attachment.py
Tools and memory
- Built-in tools
flow/tools/builtins.py - Agent memory
flow/memory/memory.py - Memory search index
flow/memory/store.py
Configuration and automation
- Agent configuration
flow/flow/doctype/flow_agent/flow_agent.py - Provider and model settings
flow/flow/doctype/flow_model/flow_model.py - Agent triggers
flow/triggers/triggers.py
Other components
- Frappe user
Connections 21
- Frappe user → Chat panel: opens chat
- Chat panel → Chat state: loads state
frontend/src/App.vue - Chat state → Chat API: calls API
- Chat API → Session creation: creates or loads
flow/api/api.py - Session creation → Agent configuration: assembles agent
flow/lib/session.py - Session creation → Session runtime: creates session
flow/lib/session.py - Session runtime → Agent execution: runs runtime
flow/flow/doctype/flow_session/flow_session.py - Agent execution → Model client: requests completions
flow/lib/agent.py - Agent execution → Built-in tools: invokes tools
flow/lib/agent.py - Agent execution → Knowledge retrieval: retrieves knowledge
flow/lib/agent.py - Session runtime → Run history: persists run
flow/flow/doctype/flow_session/flow_session.py - Session runtime → Chat attachments: indexes attachments
flow/flow/doctype/flow_session/flow_session.py - Session runtime → Knowledge retrieval: retrieves attachment chunks
flow/flow/doctype/flow_session/flow_session.py - Session runtime → Agent memory: builds memory context
flow/flow/doctype/flow_session/flow_session.py - Knowledge ingestion → Content extraction: extracts content
flow/knowledge/ingest.py - Knowledge ingestion → Knowledge index: writes index
flow/knowledge/ingest.py - Knowledge retrieval → Knowledge index: searches index
flow/knowledge/retriever.py - Knowledge retrieval → Knowledge ingestion: embeds query
- Agent memory → Memory search index: searches memories
flow/memory/memory.py - Agent configuration → Provider and model settings: selects model
- Agent triggers → Agent execution: starts agent