Compare commits

..

6 Commits

Author SHA1 Message Date
lorenzejay
f789cf854b try this 2026-04-02 13:14:21 -07:00
lorenzejay
575bf87f07 use latest 2026-04-02 13:14:21 -07:00
lorenzejay
9c4fb28956 fix checking on docs repo 2026-04-02 13:14:21 -07:00
lorenzejay
4fe0cc348f droppped link path that does not exist 2026-04-02 13:14:21 -07:00
Iris Clawd
3bc168f223 fix: correct broken persistence link in conversational flows docs 2026-04-02 13:14:21 -07:00
Iris Clawd
b690ef69ae docs: add Conversational Flows (self.ask) section to flows docs
Add comprehensive documentation for the self.ask() feature covering:
- Basic usage and API
- Multiple asks in a single method
- Timeout support with retry pattern
- Bidirectional metadata support
- Custom InputProvider protocol (Slack example)
- Auto-checkpoint behavior with persistence
- Comparison table: self.ask() vs @human_feedback
2026-04-02 13:14:21 -07:00
12 changed files with 205 additions and 351 deletions

View File

@@ -4,13 +4,13 @@ on:
pull_request:
paths:
- "docs/**"
- "docs.json"
- "docs/docs.json"
push:
branches:
- main
paths:
- "docs/**"
- "docs.json"
- "docs/docs.json"
workflow_dispatch:
jobs:
@@ -25,11 +25,12 @@ jobs:
with:
node-version: "22"
- name: Install libsecret for Mintlify CLI
run: sudo apt-get update && sudo apt-get install -y libsecret-1-0
- name: Install Mintlify CLI
run: npm i -g mintlify
run: npm install -g mint@latest
- name: Run broken link checker
run: |
# Auto-answer the prompt with yes command
yes "" | mintlify broken-links || test $? -eq 141
working-directory: ./docs
run: mint broken-links

View File

@@ -1,8 +0,0 @@
---
title: "POST /stop/{kickoff_id}"
description: "إيقاف تنفيذ الطاقم الجاري"
openapi: "/enterprise-api.en.yaml POST /stop/{kickoff_id}"
mode: "wide"
---

View File

@@ -495,8 +495,7 @@
"en/api-reference/inputs",
"en/api-reference/kickoff",
"en/api-reference/resume",
"en/api-reference/status",
"en/api-reference/stop"
"en/api-reference/status"
]
}
]
@@ -965,8 +964,7 @@
"en/api-reference/inputs",
"en/api-reference/kickoff",
"en/api-reference/resume",
"en/api-reference/status",
"en/api-reference/stop"
"en/api-reference/status"
]
}
]
@@ -1435,8 +1433,7 @@
"en/api-reference/inputs",
"en/api-reference/kickoff",
"en/api-reference/resume",
"en/api-reference/status",
"en/api-reference/stop"
"en/api-reference/status"
]
}
]
@@ -1905,8 +1902,7 @@
"en/api-reference/inputs",
"en/api-reference/kickoff",
"en/api-reference/resume",
"en/api-reference/status",
"en/api-reference/stop"
"en/api-reference/status"
]
}
]
@@ -2376,8 +2372,7 @@
"en/api-reference/inputs",
"en/api-reference/kickoff",
"en/api-reference/resume",
"en/api-reference/status",
"en/api-reference/stop"
"en/api-reference/status"
]
}
]
@@ -2845,8 +2840,7 @@
"en/api-reference/inputs",
"en/api-reference/kickoff",
"en/api-reference/resume",
"en/api-reference/status",
"en/api-reference/stop"
"en/api-reference/status"
]
}
]
@@ -3317,8 +3311,7 @@
"en/api-reference/inputs",
"en/api-reference/kickoff",
"en/api-reference/resume",
"en/api-reference/status",
"en/api-reference/stop"
"en/api-reference/status"
]
}
]
@@ -3803,8 +3796,7 @@
"pt-BR/api-reference/inputs",
"pt-BR/api-reference/kickoff",
"pt-BR/api-reference/resume",
"pt-BR/api-reference/status",
"pt-BR/api-reference/stop"
"pt-BR/api-reference/status"
]
}
]
@@ -4258,8 +4250,7 @@
"pt-BR/api-reference/inputs",
"pt-BR/api-reference/kickoff",
"pt-BR/api-reference/resume",
"pt-BR/api-reference/status",
"pt-BR/api-reference/stop"
"pt-BR/api-reference/status"
]
}
]
@@ -4713,8 +4704,7 @@
"pt-BR/api-reference/inputs",
"pt-BR/api-reference/kickoff",
"pt-BR/api-reference/resume",
"pt-BR/api-reference/status",
"pt-BR/api-reference/stop"
"pt-BR/api-reference/status"
]
}
]
@@ -5168,8 +5158,7 @@
"pt-BR/api-reference/inputs",
"pt-BR/api-reference/kickoff",
"pt-BR/api-reference/resume",
"pt-BR/api-reference/status",
"pt-BR/api-reference/stop"
"pt-BR/api-reference/status"
]
}
]
@@ -5622,8 +5611,7 @@
"pt-BR/api-reference/inputs",
"pt-BR/api-reference/kickoff",
"pt-BR/api-reference/resume",
"pt-BR/api-reference/status",
"pt-BR/api-reference/stop"
"pt-BR/api-reference/status"
]
}
]
@@ -6076,8 +6064,7 @@
"pt-BR/api-reference/inputs",
"pt-BR/api-reference/kickoff",
"pt-BR/api-reference/resume",
"pt-BR/api-reference/status",
"pt-BR/api-reference/stop"
"pt-BR/api-reference/status"
]
}
]
@@ -6531,8 +6518,7 @@
"pt-BR/api-reference/inputs",
"pt-BR/api-reference/kickoff",
"pt-BR/api-reference/resume",
"pt-BR/api-reference/status",
"pt-BR/api-reference/stop"
"pt-BR/api-reference/status"
]
}
]
@@ -7029,8 +7015,7 @@
"ko/api-reference/inputs",
"ko/api-reference/kickoff",
"ko/api-reference/resume",
"ko/api-reference/status",
"ko/api-reference/stop"
"ko/api-reference/status"
]
}
]
@@ -7496,8 +7481,7 @@
"ko/api-reference/inputs",
"ko/api-reference/kickoff",
"ko/api-reference/resume",
"ko/api-reference/status",
"ko/api-reference/stop"
"ko/api-reference/status"
]
}
]
@@ -7963,8 +7947,7 @@
"ko/api-reference/inputs",
"ko/api-reference/kickoff",
"ko/api-reference/resume",
"ko/api-reference/status",
"ko/api-reference/stop"
"ko/api-reference/status"
]
}
]
@@ -8430,8 +8413,7 @@
"ko/api-reference/inputs",
"ko/api-reference/kickoff",
"ko/api-reference/resume",
"ko/api-reference/status",
"ko/api-reference/stop"
"ko/api-reference/status"
]
}
]
@@ -8896,8 +8878,7 @@
"ko/api-reference/inputs",
"ko/api-reference/kickoff",
"ko/api-reference/resume",
"ko/api-reference/status",
"ko/api-reference/stop"
"ko/api-reference/status"
]
}
]
@@ -9362,8 +9343,7 @@
"ko/api-reference/inputs",
"ko/api-reference/kickoff",
"ko/api-reference/resume",
"ko/api-reference/status",
"ko/api-reference/stop"
"ko/api-reference/status"
]
}
]
@@ -9829,8 +9809,7 @@
"ko/api-reference/inputs",
"ko/api-reference/kickoff",
"ko/api-reference/resume",
"ko/api-reference/status",
"ko/api-reference/stop"
"ko/api-reference/status"
]
}
]
@@ -10327,8 +10306,7 @@
"ar/api-reference/inputs",
"ar/api-reference/kickoff",
"ar/api-reference/resume",
"ar/api-reference/status",
"ar/api-reference/stop"
"ar/api-reference/status"
]
}
]
@@ -10794,8 +10772,7 @@
"ar/api-reference/inputs",
"ar/api-reference/kickoff",
"ar/api-reference/resume",
"ar/api-reference/status",
"ar/api-reference/stop"
"ar/api-reference/status"
]
}
]
@@ -11261,8 +11238,7 @@
"ar/api-reference/inputs",
"ar/api-reference/kickoff",
"ar/api-reference/resume",
"ar/api-reference/status",
"ar/api-reference/stop"
"ar/api-reference/status"
]
}
]
@@ -11728,8 +11704,7 @@
"ar/api-reference/inputs",
"ar/api-reference/kickoff",
"ar/api-reference/resume",
"ar/api-reference/status",
"ar/api-reference/stop"
"ar/api-reference/status"
]
}
]
@@ -12194,8 +12169,7 @@
"ar/api-reference/inputs",
"ar/api-reference/kickoff",
"ar/api-reference/resume",
"ar/api-reference/status",
"ar/api-reference/stop"
"ar/api-reference/status"
]
}
]
@@ -12660,8 +12634,7 @@
"ar/api-reference/inputs",
"ar/api-reference/kickoff",
"ar/api-reference/resume",
"ar/api-reference/status",
"ar/api-reference/stop"
"ar/api-reference/status"
]
}
]
@@ -13127,8 +13100,7 @@
"ar/api-reference/inputs",
"ar/api-reference/kickoff",
"ar/api-reference/resume",
"ar/api-reference/status",
"ar/api-reference/stop"
"ar/api-reference/status"
]
}
]

View File

@@ -1,8 +0,0 @@
---
title: "POST /stop/{kickoff_id}"
description: "Stop a running crew execution"
openapi: "/enterprise-api.en.yaml POST /stop/{kickoff_id}"
mode: "wide"
---

View File

@@ -572,6 +572,176 @@ The `third_method` and `fourth_method` listen to the output of the `second_metho
When you run this Flow, the output will change based on the random boolean value generated by the `start_method`.
### Conversational Flows (User Input)
The `self.ask()` method pauses flow execution to request input from a user inline, then returns their response as a string. This enables conversational, interactive flows where the AI can gather information, ask clarifying questions, or request approvals during execution.
#### Basic Usage
```python Code
from crewai.flow.flow import Flow, start, listen
class GreetingFlow(Flow):
@start()
def greet(self):
name = self.ask("What's your name?")
self.state["name"] = name
@listen(greet)
def welcome(self):
print(f"Welcome, {self.state['name']}!")
flow = GreetingFlow()
flow.kickoff()
```
By default, `self.ask()` uses a `ConsoleProvider` that prompts via Python's built-in `input()`.
#### Multiple Asks in One Method
You can call `self.ask()` multiple times within a single method to gather several inputs:
```python Code
from crewai.flow.flow import Flow, start
class OnboardingFlow(Flow):
@start()
def collect_info(self):
name = self.ask("What's your name?")
role = self.ask("What's your role?")
team = self.ask("Which team are you joining?")
self.state["profile"] = {"name": name, "role": role, "team": team}
print(f"Welcome {name}, {role} on {team}!")
flow = OnboardingFlow()
flow.kickoff()
```
#### Timeout Support
Pass `timeout=` (in seconds) to avoid blocking indefinitely. If the user doesn't respond in time, `self.ask()` returns `None`:
```python Code
from crewai.flow.flow import Flow, start
class ApprovalFlow(Flow):
@start()
def request_approval(self):
response = self.ask("Approve deployment? (yes/no)", timeout=120)
if response is None:
print("No response received — timed out.")
self.state["approved"] = False
return
self.state["approved"] = response.strip().lower() == "yes"
```
Use a `while` loop to retry on timeout:
```python Code
from crewai.flow.flow import Flow, start
class RetryFlow(Flow):
@start()
def ask_with_retry(self):
answer = None
while answer is None:
answer = self.ask("Please confirm (yes/no):", timeout=60)
if answer is None:
print("Timed out, asking again...")
self.state["confirmed"] = answer.strip().lower() == "yes"
```
#### Metadata Support
The `metadata` parameter enables bidirectional context passing between the flow and the input provider. Send context to the provider, and receive structured context back:
```python Code
from crewai.flow.flow import Flow, start
class ContextualFlow(Flow):
@start()
def gather_feedback(self):
response = self.ask(
"Rate this output (1-5):",
metadata={
"step": "quality_review",
"output_id": "abc-123",
"options": ["1", "2", "3", "4", "5"],
},
)
self.state["rating"] = int(response) if response else None
```
When a custom provider returns an `InputResponse`, it can include its own metadata (e.g., user identity, timestamp, channel info) that your flow can process.
#### Custom InputProvider
For production use cases (Slack bots, web UIs, webhooks), implement the `InputProvider` protocol:
```python Code
from crewai.flow.flow import Flow, start
from crewai.flow.input_provider import InputProvider, InputResponse
import requests
class SlackInputProvider(InputProvider):
def __init__(self, channel_id: str, bot_token: str):
self.channel_id = channel_id
self.bot_token = bot_token
def request_input(self, message, flow, metadata=None):
# Post the question to Slack
requests.post(
"https://slack.com/api/chat.postMessage",
headers={"Authorization": f"Bearer {self.bot_token}"},
json={"channel": self.channel_id, "text": message},
)
# Wait for and return the user's reply (simplified)
reply = self.poll_for_reply()
return InputResponse(
value=reply["text"],
metadata={"user": reply["user"], "ts": reply["ts"]},
)
def poll_for_reply(self):
# Your implementation to wait for a Slack reply
...
# Use the custom provider
flow = Flow(input_provider=SlackInputProvider(
channel_id="C01ABC123",
bot_token="xoxb-...",
))
flow.kickoff()
```
The `request_input` method can return:
- A **string** — used directly as the user's response
- An **`InputResponse`** — includes `value` (the response string) and optional `metadata`
- **`None`** — treated as a timeout / no response
#### Auto-Checkpoint Behavior
<Note>
When persistence is configured, the flow state is automatically saved **before** each `self.ask()` call. If the process restarts while waiting for input, the flow can resume from the checkpoint without losing progress.
</Note>
#### `self.ask()` vs `@human_feedback`
| | `self.ask()` | `@human_feedback` |
|---|---|---|
| **Purpose** | Inline user input during execution | Approval gates and review feedback |
| **Returns** | `str \| None` | `HumanFeedbackResult` with structured fields |
| **Timeout** | Built-in `timeout=` parameter | Not built-in |
| **Provider** | Pluggable `InputProvider` protocol | Console-based |
| **Use when** | Gathering data, clarifications, confirmations | Review/approval workflows with structured feedback |
| **Decorator** | None — call `self.ask()` anywhere | `@human_feedback` on the method |
<Note>
Both features coexist — you can use `self.ask()` and `@human_feedback` in the same flow. Use `self.ask()` for inline data gathering and `@human_feedback` for structured review gates.
</Note>
### Human in the Loop (human feedback)
<Note>

View File

@@ -146,36 +146,6 @@ curl -X GET \
https://your-crew-url.crewai.com/status/abcd1234-5678-90ef-ghij-klmnopqrstuv
```
## Stopping a Running Execution
You can stop or cancel a running crew or flow execution at any time using the stop endpoint. This is useful when you need to abort a long-running execution or cancel one that is no longer needed.
### Stop an Execution
Send a POST request with the `kickoff_id` of the execution you want to stop:
```bash
curl -X POST \
-H "Authorization: Bearer YOUR_CREW_TOKEN" \
https://your-crew-url.crewai.com/stop/abcd1234-5678-90ef-ghij-klmnopqrstuv
```
**Success Response:**
```json
{"status": "stopped", "kickoffId": "abcd1234-5678-90ef-ghij-klmnopqrstuv"}
```
**Error Response** (when the execution has already finished):
```json
{"detail": "Cannot stop execution. Current state: SUCCESS"}
```
<Note>
You cannot stop executions that have already completed (`SUCCESS`), failed (`FAILURE`), or been revoked (`REVOKED`). The API returns a `400` status code in those cases.
</Note>
## Handling Executions
### Long-Running Executions

View File

@@ -36,7 +36,6 @@ info:
1. **Discover inputs** using `GET /inputs`
2. **Start execution** using `POST /kickoff`
3. **Monitor progress** using `GET /{kickoff_id}/status`
4. **Stop execution** (if needed) using `POST /stop/{kickoff_id}`
version: 1.0.0
contact:
name: CrewAI Support
@@ -285,56 +284,6 @@ paths:
"500":
$ref: "#/components/responses/ServerError"
/stop/{kickoff_id}:
post:
summary: Stop Crew Execution
description: |
**📋 Reference Example Only** - *This shows the request format. To test with your actual crew, copy the cURL example and replace the URL + token with your real values.*
Stops or cancels a running crew or flow execution. The execution must be in an active state
(not SUCCESS, FAILURE, or REVOKED).
operationId: stopCrewExecution
parameters:
- name: kickoff_id
in: path
required: true
description: The kickoff ID of the execution to stop
schema:
type: string
format: uuid
example: "abcd1234-5678-90ef-ghij-klmnopqrstuv"
responses:
"200":
description: Successfully stopped the execution
content:
application/json:
schema:
$ref: "#/components/schemas/StopExecutionResponse"
example:
status: "stopped"
kickoffId: "abcd1234-5678-90ef-ghij-klmnopqrstuv"
"400":
description: Execution is already in a terminal state (SUCCESS, FAILURE, or REVOKED)
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
example:
detail: "Cannot stop execution. Current state: SUCCESS"
"401":
$ref: "#/components/responses/UnauthorizedError"
"404":
description: Kickoff ID not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
example:
error: "Execution not found"
message: "No execution found with ID: abcd1234-5678-90ef-ghij-klmnopqrstuv"
"500":
$ref: "#/components/responses/ServerError"
/resume:
post:
summary: Resume Crew Execution with Human Feedback
@@ -559,19 +508,6 @@ components:
description: Time taken to execute this task in seconds
example: 45.2
StopExecutionResponse:
type: object
properties:
status:
type: string
enum: ["stopped"]
description: Indicates the execution was successfully stopped
example: "stopped"
kickoffId:
type: string
description: The kickoff ID of the stopped execution
example: "abcd1234-5678-90ef-ghij-klmnopqrstuv"
Error:
type: object
properties:

View File

@@ -36,7 +36,6 @@ info:
1. **Discover inputs** using `GET /inputs`
2. **Start execution** using `POST /kickoff`
3. **Monitor progress** using `GET /{kickoff_id}/status`
4. **Stop execution** (if needed) using `POST /stop/{kickoff_id}`
version: 1.0.0
contact:
name: CrewAI Support
@@ -285,56 +284,6 @@ paths:
"500":
$ref: "#/components/responses/ServerError"
/stop/{kickoff_id}:
post:
summary: Stop Crew Execution
description: |
**📋 Reference Example Only** - *This shows the request format. To test with your actual crew, copy the cURL example and replace the URL + token with your real values.*
Stops or cancels a running crew or flow execution. The execution must be in an active state
(not SUCCESS, FAILURE, or REVOKED).
operationId: stopCrewExecution
parameters:
- name: kickoff_id
in: path
required: true
description: The kickoff ID of the execution to stop
schema:
type: string
format: uuid
example: "abcd1234-5678-90ef-ghij-klmnopqrstuv"
responses:
"200":
description: Successfully stopped the execution
content:
application/json:
schema:
$ref: "#/components/schemas/StopExecutionResponse"
example:
status: "stopped"
kickoffId: "abcd1234-5678-90ef-ghij-klmnopqrstuv"
"400":
description: Execution is already in a terminal state (SUCCESS, FAILURE, or REVOKED)
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
example:
detail: "Cannot stop execution. Current state: SUCCESS"
"401":
$ref: "#/components/responses/UnauthorizedError"
"404":
description: Kickoff ID not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
example:
error: "Execution not found"
message: "No execution found with ID: abcd1234-5678-90ef-ghij-klmnopqrstuv"
"500":
$ref: "#/components/responses/ServerError"
/resume:
post:
summary: Resume Crew Execution with Human Feedback
@@ -559,19 +508,6 @@ components:
description: Time taken to execute this task in seconds
example: 45.2
StopExecutionResponse:
type: object
properties:
status:
type: string
enum: ["stopped"]
description: Indicates the execution was successfully stopped
example: "stopped"
kickoffId:
type: string
description: The kickoff ID of the stopped execution
example: "abcd1234-5678-90ef-ghij-klmnopqrstuv"
Error:
type: object
properties:

View File

@@ -120,46 +120,6 @@ paths:
'500':
$ref: '#/components/responses/ServerError'
/stop/{kickoff_id}:
post:
summary: 실행 중지
description: |
**📋 참조 예제만 제공** - *요청 형식을 보여줍니다. 실제 호출은 cURL 예제를 복사해 URL과 토큰을 교체하세요.*
실행 중인 crew 또는 flow 실행을 중지하거나 취소합니다. 실행이 활성 상태여야 합니다
(SUCCESS, FAILURE, REVOKED 상태가 아닌 경우).
operationId: stopCrewExecution
parameters:
- name: kickoff_id
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: 실행을 성공적으로 중지
content:
application/json:
schema:
$ref: '#/components/schemas/StopExecutionResponse'
'400':
description: 실행이 이미 종료 상태 (SUCCESS, FAILURE, REVOKED)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
description: Kickoff ID를 찾을 수 없음
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
$ref: '#/components/responses/ServerError'
/resume:
post:
summary: Resume Crew Execution with Human Feedback
@@ -354,15 +314,6 @@ components:
execution_time:
type: number
StopExecutionResponse:
type: object
properties:
status:
type: string
enum: ["stopped"]
kickoffId:
type: string
Error:
type: object
properties:

View File

@@ -36,7 +36,6 @@ info:
1. **Descubra os inputs** usando `GET /inputs`
2. **Inicie a execução** usando `POST /kickoff`
3. **Monitore o progresso** usando `GET /{kickoff_id}/status`
4. **Pare a execução** (se necessário) usando `POST /stop/{kickoff_id}`
version: 1.0.0
contact:
name: CrewAI Suporte
@@ -157,46 +156,6 @@ paths:
"500":
$ref: "#/components/responses/ServerError"
/stop/{kickoff_id}:
post:
summary: Parar Execução da Crew
description: |
**📋 Exemplo de Referência** - *Mostra o formato da requisição. Para testar com sua crew real, copie o cURL e substitua URL + token.*
Para ou cancela uma execução de crew ou flow em andamento. A execução deve estar em um estado ativo
(não SUCCESS, FAILURE ou REVOKED).
operationId: stopCrewExecution
parameters:
- name: kickoff_id
in: path
required: true
schema:
type: string
format: uuid
responses:
"200":
description: Execução parada com sucesso
content:
application/json:
schema:
$ref: "#/components/schemas/StopExecutionResponse"
"400":
description: Execução já em estado terminal (SUCCESS, FAILURE ou REVOKED)
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"401":
$ref: "#/components/responses/UnauthorizedError"
"404":
description: Kickoff ID não encontrado
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
$ref: "#/components/responses/ServerError"
/resume:
post:
summary: Resume Crew Execution with Human Feedback
@@ -392,15 +351,6 @@ components:
execution_time:
type: number
StopExecutionResponse:
type: object
properties:
status:
type: string
enum: ["stopped"]
kickoffId:
type: string
Error:
type: object
properties:

View File

@@ -1,8 +0,0 @@
---
title: "POST /stop/{kickoff_id}"
description: "실행 중인 크루 실행 중지"
openapi: "/enterprise-api.ko.yaml POST /stop/{kickoff_id}"
mode: "wide"
---

View File

@@ -1,8 +0,0 @@
---
title: "POST /stop/{kickoff_id}"
description: "Parar uma execução de crew em andamento"
openapi: "/enterprise-api.pt-BR.yaml POST /stop/{kickoff_id}"
mode: "wide"
---