How Agents Works
3 min
A Agent talks with users through messages and gives responses using AI.
When a user sends a message, the agent understands the request and generates a reply.
Sometimes the agent may also fetch data using workflows or APIs.
%%{init: {'theme': 'base', 'themeVariables': {
'primaryColor': '#ffe5e5',
'primaryBorderColor': '#d97b7b',
'primaryTextColor': '#333333',
'lineColor': '#d97b7b',
'arrowheadColor': '#d97b7b',
'background': '#fff5f5',
'edgeLabelBackground': '#fff5f5'
}}}%%
graph LR
A[User Message] --> B[Agent]
B --> C[Workflow]
C -- Input Attributes --> D[Path]
D -- Output Attributes --> E[Agent]
E --> F[Response]Explanation
- User Message – The user asks a question.
- Agent – Receives the message and processes it.
- System Prompt – Tells the agent how it should behave and respond.
- Workflow (optional) – Used when the agent needs to fetch or save data.
- Path / API – Retrieves information from external systems.
- Response – The agent sends the final answer to the user.
Note
If the information is small or fixed, it can be added directly in the System Prompt.
If the agent needs to fetch external data (APIs, database, search results), then Workflows and Paths should be used.
Example
If a user asks to book a doctor appointment:
- The agent understands the request.
- It triggers a workflow to fetch available doctors.
- The system returns doctor details and available slots.
- The agent shows the available appointment times to the user.