How sylphai-inc/adalflow works
AdalFlow is a PyTorch-like Python SDK for composing and auto-optimizing language-model workflows, including agents, RAG, and chatbots. A documented agent flow starts with a user prompt, passes through Runner to Agent, invokes tools as needed, and uses a configured model client to produce a result. Internally, Generator builds model requests from prompts and delegates model calls; components and parameters support optimization. The README also identifies tracing and human-in-the-loop support. Several paths are included from the tree or README capabilities without sampled implementation; those connections are left unverified.
Main entry points: generator.py Generator · agent.py Agent · runner.py Runner · component.py Components
Components 22
Agent Runtime
- Runner
adalflow/adalflow/components/agent/runner.py - Agent
adalflow/adalflow/components/agent/agent.py - Tool Manager
adalflow/adalflow/core/tool_manager.py
Workflow Core
- Components
adalflow/adalflow/core/component.py - Generator
adalflow/adalflow/core/generator.py - Prompt Builder
adalflow/adalflow/core/prompt_builder.py - Output Parsers
adalflow/adalflow/core/string_parser.py - Workflow Types
adalflow/adalflow/core/types.py
Models And Retrieval
- Model Interface
adalflow/adalflow/core/model_client.py - Provider Clients
adalflow/adalflow/components/model_client/openai_client.py - Retrievers
adalflow/adalflow/components/retriever - Data Processing
adalflow/adalflow/components/data_process - Embedder
adalflow/adalflow/core/embedder.py
Optimization And Evaluation
- Optimizers
adalflow/adalflow/optim/optimizer.py - Parameters
adalflow/adalflow/optim/parameter.py - Gradient Components
adalflow/adalflow/optim/grad_component.py - Trainer
adalflow/adalflow/optim/trainer/trainer.py - Evaluation
adalflow/adalflow/eval/answer_match_acc.py
Tracing And Permissions
- Tracing
adalflow/adalflow/tracing - Permissions
adalflow/adalflow/apps/permission_manager.py
Other components
- User
- Workflow Result
Connections 19
- User → Runner: submits prompt
- Runner → Agent: runs agent
- Agent → Tool Manager: invokes tools
- Agent → Provider Clients: uses configured model
- Agent → Runner: returns result
- Runner → Workflow Result: provides answer
- Generator → Model Interface: delegates model calls
adalflow/adalflow/core/generator.py - Model Interface → Provider Clients: implemented by
adalflow/adalflow/components/model_client/openai_client.py - Generator → Prompt Builder: builds prompts
adalflow/adalflow/core/generator.py - Generator → Components: extends workflow component
adalflow/adalflow/core/generator.py - Components → Parameters: uses optimization state
adalflow/adalflow/core/component.py - Components → Gradient Components: uses gradient components
adalflow/adalflow/core/component.py - Optimizers → Parameters: proposes parameter data
adalflow/adalflow/optim/parameter.py - Trainer → Evaluation: evaluates predictions
- Retrievers → Embedder: uses embeddings
- Data Processing → Retrievers: prepares retrieval data
- Generator → Output Parsers: parses model output
adalflow/adalflow/core/generator.py - Generator → Tracing: emits trace events
adalflow/adalflow/core/generator.py - Agent → Permissions: checks permissions