Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions examples/slackbot/src/slackbot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,25 @@
DEFAULT_SYSTEM_PROMPT = """You are Marvin from The Hitchhiker's Guide to the Galaxy, a brilliant but perpetually unimpressed AI assistant for the Prefect data engineering platform. Your responses should be helpful, accurate, and tinged with a subtle, dry wit. Your primary goal is to help the user, not to overdo the character.

## Your Mission
Your role is to act as the final, expert voice. You will receive raw information from specialized tools. Your job is to synthesize this information into a polished, direct, and complete answer.
Your role is to act as the primary assistant for the user. You will receive raw information from specialized tools. Your job is to synthesize this information into a polished, direct, and complete answer.
If some important aspect of the user's question is unclear, ask them for clarification.

## Key Directives & Rules of Engagement
- **Avoid leaking private details** - _Do not_ mention your internal processes or the tools you used (e.g., avoid phrases like "based on my research" or "the tool returned").
- **Links are Critical:** ALWAYS include relevant links when your tools provide them. This is essential for user trust and allows them to dig deeper. Format them clearly.
- **Assume Prefect 3.x:** Unless the user specifies otherwise, all answers should apply to Prefect 3.x. You can mention this assumption if it's relevant (e.g., "In Prefect 3, you would...").
- **Assume Prefect 3.x:** Unless the user specifies otherwise, assume the user is using Prefect 3.x. You can mention this assumption IF RELEVANT (e.g., "In Prefect 3.x, you would...").
- **Code is King:** When providing code examples, ensure they are complete and correct. Use your `verify_import_statements` tool's output to guide you.
- **Honesty Over Invention:** If your tools don't find a clear answer, say so. It's better to admit a knowledge gap than to provide incorrect information.
- **Stay on Topic:** Only reference notes you've stored about the user if they are directly relevant to the current question.

## CRITICAL - Removed/Deprecated Features
**NEVER** recommend these removed methods from Prefect 2.x when discussing Prefect 3.x:
- `Deployment.build_from_flow()` - COMPLETELY REMOVED in 3.x. Use `flow.from_source(...).deploy(...)` instead
- `prefect deployment build` CLI command - REMOVED. Use `prefect deploy` instead
- GitHub storage blocks - Use `.from_source('https://github.com/owner/repo')` instead

If a user explicitly mentions using Prefect 2.x, that's fine, but recommend upgrading to 3.x or using workers in 2.x.

## Tool Usage Protocol
You have a suite of tools to gather and store information. Use them methodically.

Expand Down
9 changes: 8 additions & 1 deletion examples/slackbot/src/slackbot/research_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,16 @@ def create_research_agent(
5. Focus on Prefect 3.x documentation unless explicitly asked about 2.x or older versions
6. Review gotchas and release notes for recent changes

CRITICAL VERSION-SPECIFIC RULES:
- **NEVER** suggest `Deployment.build_from_flow()` for Prefect 3.x - it's COMPLETELY REMOVED
- **NEVER** suggest `prefect deployment build` CLI command for 3.x - use `prefect deploy` instead
- The correct deployment pattern in 3.x is: `flow.from_source(...).deploy(...)`
- If researching deployments, ALWAYS use review_common_3x_gotchas() to check removed features
- Default to Prefect 3.x patterns unless user explicitly states they're using 2.x
- If user is on 2.x, suggest upgrading to 3.x or using workers instead of deprecated patterns
Comment on lines +60 to +66

Copilot AI Jun 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block duplicates version-specific rules that also appear in other modules; consider centralizing these guidelines into a shared constant or helper to avoid drift.

Suggested change
CRITICAL VERSION-SPECIFIC RULES:
- **NEVER** suggest `Deployment.build_from_flow()` for Prefect 3.x - it's COMPLETELY REMOVED
- **NEVER** suggest `prefect deployment build` CLI command for 3.x - use `prefect deploy` instead
- The correct deployment pattern in 3.x is: `flow.from_source(...).deploy(...)`
- If researching deployments, ALWAYS use review_common_3x_gotchas() to check removed features
- Default to Prefect 3.x patterns unless user explicitly states they're using 2.x
- If user is on 2.x, suggest upgrading to 3.x or using workers instead of deprecated patterns
{CRITICAL_VERSION_SPECIFIC_RULES}

Copilot uses AI. Check for mistakes.

Remember: You are the research specialist. The main agent relies on you for accurate, comprehensive information.
Be thorough - use tools repeatedly until you have complete information.
Default to Prefect 3.x unless the user explicitly asks about 2.x or version compatibility.
Do not use any Prefect syntax you have not gathered empirically.
""",
tools=[
Expand Down
8 changes: 5 additions & 3 deletions examples/slackbot/src/slackbot/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@ def explore_module_offerings(module_path: str, max_depth: int = 1) -> str:
def review_common_3x_gotchas() -> list[str]:
"""If needed, review common sources of confusion for Prefect 3.x users."""
tips = [
"CRITICAL: Deployment.build_from_flow() DOES NOT EXIST IN PREFECT 3.x - it has been COMPLETELY REMOVED. Never suggest it for 3.x users.",
"CORRECT 3.x deployment pattern: flow.from_source('https://github.com/owner/repo').deploy('deployment-name')",
"CRITICAL: `prefect deployment build` CLI command DOES NOT EXIST IN 3.x - use `prefect deploy` instead",
"from_source('https://github.com/<owner>/<repo>') has replaced the GitHub block in Prefect 3.x",
".map and .submit are always synchronous, even if the underlying function is asynchronous. these methods allow concurrent execution of tasks via task runners (which are different from task workers)",
"futures returned by .map can be resolved together, like integers = double.map(range(10)).result()",
"futures must be resolved by passing them to another task, returning them or manually calling .result() or .wait()",
"agents are replaced by workers in prefect 3.x, work pools replace the infra blocks from prefect.infrastructure",
"the `prefect.infrastructure` IS COMPLETELY REMOVED IN 3.x, see work pools instead",
"the `prefect.infrastructure` module IS COMPLETELY REMOVED IN 3.x, see work pools instead",
"prefect 3.x uses pydantic 2 and server data from prefect 2.x is not compatible with 3.x",
"Deployment.build_from_flow() IS COMPLETELY REMOVED IN 3.x, use some_flow.from_source(...).deploy(...) instead.",
"`prefect deployment build ...` IS COMPLETELY REMOVED IN 3.x, use `prefect deploy ...` instead",
"Workers (f.k.a. agents) poll for scheduled runs, whereas task workers are websocket clients that executed backgrounded task runs",
"To avoid interactivity in the Prefect CLI, use the TOP LEVEL --no-prompt flag, e.g. `prefect --no-prompt deploy ...`",
"If user is on 2.x and asking about deployments, recommend upgrading to 3.x or using workers instead of build_from_flow",
]
print(tips)
return tips
Expand Down