Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

Context files allow you to automatically inject markdown content into your agent’s instructions using AGENTS.md-style files.

Quick Start

1

Create Context Files

Create markdown files with context information:
# AGENTS.md
## Company Guidelines
- Always be professional and helpful
- Focus on customer satisfaction
- Use clear, concise language

## Product Information
Our main products include:
- AI Assistant Platform
- Workflow Automation Tools
- Data Analytics Dashboard
2

Configure Context Injection

Use context_paths to inject the content:
from praisonaiagents import Agent
from praisonai.integration import configure_host

agent = Agent(
    name="Customer Support",
    instructions="Help customers with their questions"
)

configure_host(
    agents=[agent],
    context_paths=["AGENTS.md", "STYLE.md"],
    style="dashboard"
)

How It Works

Context files are merged into agent instructions during host configuration: The content is merged using this pattern:
{original_instructions}

Context:
{context_file_content}

Configuration Options

Default File Discovery

If no context_paths specified, these files are automatically checked:
PathDescription
AGENTS.mdPrimary agent context file
agents.mdAlternative naming
.agents/AGENTS.mdHidden directory structure

Custom Context Paths

Specify your own context files:
configure_host(
    context_paths=[
        "docs/guidelines.md",
        "config/style-guide.md", 
        "knowledge/product-info.md"
    ]
)

Context Loading Behavior

# Silent fallback when module unavailable
try:
    from praisonai.integration.context_files import load_context_files
    context = load_context_files(paths)
except ImportError:
    # No-op when context_files not available
    context = ""

File Structure Examples

Basic AGENTS.md

# Agent Context

## Role Definition
You are a customer support specialist with deep knowledge of our products.

## Communication Style
- Be friendly and professional
- Use active voice
- Keep responses under 150 words unless detailed explanation needed

## Knowledge Areas
- Product features and pricing
- Technical troubleshooting
- Account management procedures

Multi-File Setup

project/
├── AGENTS.md          # Primary context
├── STYLE.md           # Communication guidelines  
├── docs/
│   └── products.md    # Product information
└── .agents/
    └── internal.md    # Internal guidelines
configure_host(
    context_paths=[
        "AGENTS.md",
        "STYLE.md", 
        "docs/products.md",
        ".agents/internal.md"
    ]
)

Common Patterns

Environment-Specific Context

import os

context_files = ["AGENTS.md"]

# Add environment-specific context
env = os.getenv("ENVIRONMENT", "development")
if env == "production":
    context_files.append("production-guidelines.md")
else:
    context_files.append("dev-guidelines.md")

configure_host(context_paths=context_files)

Conditional Context Loading

def get_context_files(agent_type):
    base_files = ["AGENTS.md"]
    
    if agent_type == "support":
        base_files.append("support-protocols.md")
    elif agent_type == "sales":
        base_files.append("sales-playbook.md")
    
    return base_files

configure_host(
    context_paths=get_context_files("support")
)

Hierarchical Context

# base-context.md
## Universal Guidelines
All agents should follow these principles...

# specialized-context.md
## Support-Specific Guidelines
When handling support tickets...

# team-context.md  
## Team Information
Our support team includes...

Best Practices

Structure your context files for maintainability:
context/
├── base/
│   ├── guidelines.md     # Universal principles
│   └── style.md         # Communication style
├── roles/
│   ├── support.md       # Role-specific context
│   └── sales.md         # Role-specific context  
└── knowledge/
    ├── products.md      # Product information
    └── policies.md      # Company policies
Keep context files focused and well-organized:
# Context File Template

## Core Role
Brief description of the agent's primary function

## Guidelines  
- Key behavioral guidelines
- Communication principles
- Quality standards

## Knowledge Areas
Relevant domain knowledge the agent should reference

## Examples
Sample interactions or responses when helpful
Version control your context files:
# Track context changes
git add AGENTS.md STYLE.md
git commit -m "Update agent communication guidelines"

# Review context impact
git diff HEAD~1 context/
Validate context injection in development:
# Test context loading
from praisonai.integration.context_files import load_context_files

context = load_context_files(["AGENTS.md", "STYLE.md"])
print("Loaded context length:", len(context))
print("Preview:", context[:200])

Host Integration

Configure context injection

Integration Patterns

Deployment patterns