System Prompts
Learn how to craft effective system prompts that define your agent's personality, behavior, and approach to tasks.
Quick Start
ConnectOnion offers three flexible ways to provide system prompts to your agents:
1
Direct String
Pass prompt text directly as a parameter. Perfect for simple, short prompts.
2
File Path
Auto-loads content from .md, .txt, .yaml, or .json files. Best for complex prompts.
3
Path Object
Use pathlib.Path for programmatic file handling with existence checking.
quick_start.py
from connectonion import Agent
# Method 1: Direct string
agent = Agent(
name="helper",
system_prompt="You are a helpful and friendly assistant.",
tools=[...]
)
# Method 2: Load from file
agent = Agent(
name="expert",
system_prompt="prompts/expert.md", # Auto-loads content
tools=[...]
)
# Method 3: Path object
from pathlib import Path
agent = Agent(
name="specialist",
system_prompt=Path("prompts/specialist.txt"),
tools=[...]
)
Supported File Formats
.md
Markdown
Human-readable, structured prompts
.yaml
YAML
Structured data with metadata
.json
JSON
Machine-readable with schemas
.txt
Plain Text
Simple text prompts
(none)
No Extension
Any text file works