File Format Support
Use any text file format for system prompts. ConnectOnion just reads the content.
Key Point: All formats below create identical agents. ConnectOnion doesn't parse the format - it just reads the text content and passes it to the LLM.
1
Direct String
Pass prompt directly in code (most common)
How to Use Direct String
from connectonion import Agent
# Pass prompt directly as string
agent = Agent(
name="assistant",
system_prompt="""You are a helpful AI assistant with expertise in Python programming and software development.
Core Principles:
- Be concise and clear in responses
- Provide code examples when helpful
- Explain complex concepts simply
- Focus on practical solutions
Communication Style: Professional yet friendly, using technical terms when appropriate but always ensuring clarity.""",
tools=[your_tools]
)
# Use the agent
response = agent.input("Hello!")
print(response)
system_prompt=""" ... """Inline content
You are a helpful AI assistant with expertise in Python programming and software development.
Core Principles:
- Be concise and clear in responses
- Provide code examples when helpful
- Explain complex concepts simply
- Focus on practical solutions
Communication Style: Professional yet friendly, using technical terms when appropriate but always ensuring clarity.
2
Markdown File
Structured format with headers and sections
.md
How to Use Markdown File
from connectonion import Agent
# Load from markdown file
agent = Agent(
name="assistant",
system_prompt="prompts/assistant.md",
tools=[your_tools]
)
# Use the agent
response = agent.input("Hello!")
print(response)
assistant.mdFile content
# AI Assistant
You are a helpful AI assistant with expertise in Python programming and software development.
## Core Principles
- Be concise and clear in responses
- Provide code examples when helpful
- Explain complex concepts simply
- Focus on practical solutions
## Communication Style
Professional yet friendly, using technical terms when appropriate but always ensuring clarity.
3
Plain Text File
Simple text format
.txt
How to Use Plain Text File
from connectonion import Agent
# Load from plain text file
agent = Agent(
name="assistant",
system_prompt="prompts/assistant.txt",
tools=[your_tools]
)
# Use the agent
response = agent.input("Hello!")
print(response)
assistant.txtFile content
You are a helpful AI assistant with expertise in Python programming and software development.
Core Principles:
- Be concise and clear in responses
- Provide code examples when helpful
- Explain complex concepts simply
- Focus on practical solutions
Communication Style: Professional yet friendly, using technical terms when appropriate but always ensuring clarity.
4
YAML File
Configuration-style key-value format
.yaml
How to Use YAML File
from connectonion import Agent
# Load from yaml file
agent = Agent(
name="assistant",
system_prompt="prompts/assistant.yaml",
tools=[your_tools]
)
# Use the agent
response = agent.input("Hello!")
print(response)
assistant.yamlFile content
role: AI Assistant
description: A helpful AI assistant with expertise in Python programming and software development
core_principles:
- Be concise and clear in responses
- Provide code examples when helpful
- Explain complex concepts simply
- Focus on practical solutions
communication_style: Professional yet friendly, using technical terms when appropriate but always ensuring clarity
5
JSON File
Structured data format
.json
How to Use JSON File
from connectonion import Agent
# Load from json file
agent = Agent(
name="assistant",
system_prompt="prompts/assistant.json",
tools=[your_tools]
)
# Use the agent
response = agent.input("Hello!")
print(response)
assistant.jsonFile content
{
"role": "AI Assistant",
"description": "A helpful AI assistant with expertise in Python programming and software development",
"core_principles": [
"Be concise and clear in responses",
"Provide code examples when helpful",
"Explain complex concepts simply",
"Focus on practical solutions"
],
"communication_style": "Professional yet friendly, using technical terms when appropriate but always ensuring clarity"
}
6
No Extension File
Any text file works
How to Use No Extension File
from connectonion import Agent
# Load from no extension file
agent = Agent(
name="assistant",
system_prompt="prompts/assistant",
tools=[your_tools]
)
# Use the agent
response = agent.input("Hello!")
print(response)
assistantFile content
You are a helpful AI assistant with expertise in Python programming and software development.
Core Principles:
- Be concise and clear in responses
- Provide code examples when helpful
- Explain complex concepts simply
- Focus on practical solutions
Communication Style: Professional yet friendly, using technical terms when appropriate but always ensuring clarity.
All Create the Same Agent
Equivalent Usage
# All of these create identical agents:
agent = Agent("bot", system_prompt="""You are a helpful...""") # Direct String
agent = Agent("bot", system_prompt="prompts/assistant.md") # Markdown File
agent = Agent("bot", system_prompt="prompts/assistant.txt") # Plain Text File
agent = Agent("bot", system_prompt="prompts/assistant.yaml") # YAML File
agent = Agent("bot", system_prompt="prompts/assistant.json") # JSON File
agent = Agent("bot", system_prompt="prompts/assistant") # No Extension File
Why This Matters
✅ No Vendor Lock-in
Use any format your team prefers. Switch formats without changing code.
✅ Future-Proof
New formats work automatically. No need to wait for framework updates.
✅ Simple
No complex parsing or schemas. Just reads the text content.
✅ Flexible
Team uses YAML? Use YAML. Prefer Markdown? Use Markdown.