System Prompts
Define your agent's personality, behavior, and approach to tasks.
Recommended: Keep prompts in Markdown files
Store prompts in versioned .md files. This keeps code clean, enables easy edits and reviews, and works across tools.
- Readable and diff-friendly
- Reusable across multiple agents
- Simple to test and iterate
prompts/
assistant.md
expert/
researcher.md
# Assistant
You are a helpful, concise assistant. When answering:
- Be direct and use simple language
- Prefer bullet points over long paragraphs
- Ask one clarifying question if necessary before acting
Output format:
- Start with a one-sentence summary
- Then provide numbered steps if applicable
from connectonion import Agent
agent = Agent(
name="assistant",
system_prompt="prompts/assistant.md", # Recommended: Markdown file
tools=[...]
)
print(agent.input("Summarize the key points of our meeting notes."))Avoid embedding large prompt strings directly in code. It makes diffs noisy and complicates collaboration. Prefer .md files and reference them from your agent.
Quick Start
ConnectOnion offers three ways to provide system prompts. We recommend Markdown files.
Markdown File(Recommended)
Store prompts in prompts/*.md and reference by path. Best for collaboration, reviews, and reuse.
Path Object
Use pathlib.Path when you need explicit file existence checks.
Direct String(for quick demos)
Acceptable for tiny demos or notebooks, but keep production prompts in Markdown files.
from connectonion import Agent
# Method 1 (Recommended): Load from Markdown file
agent = Agent(
name="expert",
system_prompt="prompts/expert.md", # Versioned prompt content
tools=[...]
)
# Method 2: Path object
from pathlib import Path
agent = Agent(
name="specialist",
system_prompt=Path("prompts/specialist.txt"),
tools=[...]
)Iteration Control (max_iterations)
You can set a default iteration limit on the agent, and still override it for specific tasks.
from connectonion import Agent
# Set a global limit for this agent
agent = Agent(
name="helper",
system_prompt="You are precise and concise.",
tools=[...],
max_iterations=15 # default limit for this agent
)
# For one-off complex tasks, override per call
result = agent.input(
"Plan a 3-step workflow using the available tools",
max_iterations=25
)
ConnectOnion