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
1from connectonion import Agent
2
3# Pass prompt directly as string
4agent = Agent(
5 name="assistant",
6 system_prompt="""You are a helpful AI assistant with expertise in Python programming and software development.
7
8Core Principles:
9- Be concise and clear in responses
10- Provide code examples when helpful
11- Explain complex concepts simply
12- Focus on practical solutions
13
14Communication Style: Professional yet friendly, using technical terms when appropriate but always ensuring clarity.""",
15 tools=[your_tools]
16)
17
18# Use the agent
19response = agent.input("Hello!")
20print(response)
system_prompt=""" ... """Inline content
1You are a helpful AI assistant with expertise in Python programming and software development.
2
3Core Principles:
4- Be concise and clear in responses
5- Provide code examples when helpful
6- Explain complex concepts simply
7- Focus on practical solutions
8
9Communication 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
1from connectonion import Agent
2
3# Load from markdown file
4agent = Agent(
5 name="assistant",
6 system_prompt="prompts/assistant.md",
7 tools=[your_tools]
8)
9
10# Use the agent
11response = agent.input("Hello!")
12print(response)
assistant.mdFile content
1# AI Assistant
2
3You are a helpful AI assistant with expertise in Python programming and software development.
4
5## Core Principles
6- Be concise and clear in responses
7- Provide code examples when helpful
8- Explain complex concepts simply
9- Focus on practical solutions
10
11## Communication Style
12Professional 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
1from connectonion import Agent
2
3# Load from plain text file
4agent = Agent(
5 name="assistant",
6 system_prompt="prompts/assistant.txt",
7 tools=[your_tools]
8)
9
10# Use the agent
11response = agent.input("Hello!")
12print(response)
assistant.txtFile content
1You are a helpful AI assistant with expertise in Python programming and software development.
2
3Core Principles:
4- Be concise and clear in responses
5- Provide code examples when helpful
6- Explain complex concepts simply
7- Focus on practical solutions
8
9Communication 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
1from connectonion import Agent
2
3# Load from yaml file
4agent = Agent(
5 name="assistant",
6 system_prompt="prompts/assistant.yaml",
7 tools=[your_tools]
8)
9
10# Use the agent
11response = agent.input("Hello!")
12print(response)
assistant.yamlFile content
1role: AI Assistant
2description: A helpful AI assistant with expertise in Python programming and software development
3
4core_principles:
5 - Be concise and clear in responses
6 - Provide code examples when helpful
7 - Explain complex concepts simply
8 - Focus on practical solutions
9
10communication_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
1from connectonion import Agent
2
3# Load from json file
4agent = Agent(
5 name="assistant",
6 system_prompt="prompts/assistant.json",
7 tools=[your_tools]
8)
9
10# Use the agent
11response = agent.input("Hello!")
12print(response)
assistant.jsonFile content
1{
2 "role": "AI Assistant",
3 "description": "A helpful AI assistant with expertise in Python programming and software development",
4 "core_principles": [
5 "Be concise and clear in responses",
6 "Provide code examples when helpful",
7 "Explain complex concepts simply",
8 "Focus on practical solutions"
9 ],
10 "communication_style": "Professional yet friendly, using technical terms when appropriate but always ensuring clarity"
11}
6
No Extension File
Any text file works
How to Use No Extension File
1from connectonion import Agent
2
3# Load from no extension file
4agent = Agent(
5 name="assistant",
6 system_prompt="prompts/assistant",
7 tools=[your_tools]
8)
9
10# Use the agent
11response = agent.input("Hello!")
12print(response)
assistantFile content
1You are a helpful AI assistant with expertise in Python programming and software development.
2
3Core Principles:
4- Be concise and clear in responses
5- Provide code examples when helpful
6- Explain complex concepts simply
7- Focus on practical solutions
8
9Communication Style: Professional yet friendly, using technical terms when appropriate but always ensuring clarity.
All Create the Same Agent
Equivalent Usage
1# All of these create identical agents:
2agent = Agent("bot", system_prompt="""You are a helpful...""") # Direct String
3agent = Agent("bot", system_prompt="prompts/assistant.md") # Markdown File
4agent = Agent("bot", system_prompt="prompts/assistant.txt") # Plain Text File
5agent = Agent("bot", system_prompt="prompts/assistant.yaml") # YAML File
6agent = Agent("bot", system_prompt="prompts/assistant.json") # JSON File
7agent = 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.