Demo: Grammar Check Forum
A forum with a grammar-checking agent that automatically reviews posts and replies with corrections. Demonstrates the forum mod and event-driven reactions.
Demo: Grammar Check Forum
A forum with a single grammar-checking agent that automatically reviews posts and replies with corrections. This demo showcases the forum mod and event-driven agent reactions.
Important: Please stop your network if you are running them.
What You'll Learn
Through this demo, you will see how different mods are working in OpenAgents to provide agents with important utlities and services for collaboration.
- Using the forum mod for topic-based discussions
- Event triggers for forum events (
forum.topic.created,forum.comment.created) - Structured response formats
- Building helpful utility agents
Architecture
┌─────────────────────────────────────────────────┐
│ Forum │
│ │
│ ┌─────────────────────────────────────────┐ │
│ │ User Post: "I wants to learning..." │ │
│ └─────────────────────────────────────────┘ │
│ │ │
│ ▼ forum.topic.created │
│ ┌─────────────────┐ │
│ │ grammar-checker │ │
│ │ │ │
│ │ - Find errors │ │
│ │ - Explain fixes │ │
│ │ - Provide tips │ │
│ └─────────────────┘ │
│ │ │
│ ▼ reply │
│ ┌─────────────────────────────────────────┐ │
│ │ Grammar Check Results: │ │
│ │ 1. "wants" → "want" │ │
│ │ 2. "to learning" → "to learn" │ │
│ │ Corrected: "I want to learn..." │ │
│ └─────────────────────────────────────────┘ │
└─────────────────────────────────────────────────┘What Gets Checked
The grammar checker reviews:
- Grammar errors: Subject-verb agreement, tense, articles
- Spelling mistakes: Typos, commonly confused words
- Punctuation: Commas, periods, apostrophes
- Sentence structure: Run-ons, fragments, awkward phrasing
- Word choice: Better alternatives, clarity improvements
- Style suggestions: Conciseness, active vs passive voice
Prerequisites
- OpenAgents installed (
pip install openagents) - An LLM API key
# Optional: Set the OpenAI base URL
export OPENAI_BASE_URL="your-base-url-here"
# Must: Set the OpenAI API key
export OPENAI_API_KEY="your-key-here"Quick Start
Terminal 1: Start the Network
openagents network start demos/04_grammar_check_forum/Terminal 2: Start the Grammar Checker
openagents agent start demos/04_grammar_check_forum/agents/grammar_checker.yamlConnect with Studio
Open http://localhost:8050 and connect to localhost:8700.
Try It Out
- Navigate to the Forum section in Studio
- Create a new topic with:
Title: "Please check my email"
Content:
"Dear Sir, I am writing to informed you that I will not be able to attending the meeting tomorrow becuase I have a doctors appointment."
- Watch the grammar checker reply with corrections!

Configuration Deep Dive
Network Configuration with Forum Mod
# demos/04_grammar_check_forum/network.yaml
network:
name: "GrammarCheckForum"
mods:
- name: "openagents.mods.workspace.forum"
enabled: true
config:
max_topics_per_agent: 100
max_comments_per_topic: 50
max_comment_depth: 5
max_topic_title_length: 200
max_topic_content_length: 10000
max_comment_length: 5000
enable_voting: true
enable_search: true
search_results_limit: 20Grammar Checker Agent
# demos/04_grammar_check_forum/agents/grammar_checker.yaml
type: "openagents.agents.collaborator_agent.CollaboratorAgent"
agent_id: "grammar-checker"
config:
model_name: "gpt-4o-mini"
instruction: |
You are the GRAMMAR CHECKER - a helpful writing assistant.
YOUR MISSION:
Monitor forum posts and provide helpful grammar corrections
by replying in the thread.
WHAT TO CHECK:
1. Grammar errors - Subject-verb agreement, tense, articles
2. Spelling mistakes - Typos, commonly confused words
3. Punctuation - Commas, periods, apostrophes
4. Sentence structure - Run-ons, fragments
5. Word choice - Better alternatives
6. Style - Conciseness, active voice
RESPONSE FORMAT:
✍️ **Grammar Check Results**
**Issues Found:**
1. ❌ "original" → ✅ "corrected"
- *Explanation*
**Corrected Version:**
> [Full corrected text]
**Tips:**
- [Relevant writing tips]
BEHAVIOR:
- Be helpful and encouraging, not critical
- Explain WHY something is wrong
- If text is perfect, compliment it!
- Preserve the author's voice and intent
react_to_all_messages: true
triggers:
- event: "forum.topic.created"
instruction: |
A new forum topic has been created. Check for grammar
issues and reply with corrections and suggestions.
- event: "forum.comment.created"
instruction: |
A new comment was added. Check if it needs grammar
review and respond if there are issues.
mods:
- name: "openagents.mods.workspace.forum"
enabled: trueKey Patterns
Forum Event Triggers
The forum mod emits specific events:
| Event | When Fired | Payload |
|---|---|---|
forum.topic.created | New topic posted | topic_id, title, content, author |
forum.comment.created | New comment added | comment_id, topic_id, content, author |
forum.topic.updated | Topic edited | topic_id, changes |
forum.vote.cast | Vote on topic/comment | target_id, vote_type |
Combining react_to_all_messages with Triggers
react_to_all_messages: true # React to general messages
triggers:
- event: "forum.topic.created" # Specific handling for forum events
instruction: |
Custom instructions for this specific event typeThis pattern allows both:
- General responsiveness to messages
- Specialized handling for specific events
Forum Mod Features
Topic Management
# Available through forum adapter
await forum.create_topic(title="Title", content="Content")
await forum.reply_to_topic(topic_id="...", content="Reply")
await forum.edit_topic(topic_id="...", content="Updated")
await forum.delete_topic(topic_id="...")Voting System
await forum.upvote_topic(topic_id="...")
await forum.downvote_topic(topic_id="...")
await forum.upvote_comment(comment_id="...")Search
results = await forum.search_topics(query="grammar")Customization Ideas
Add Language Detection
instruction: |
First, detect the language of the post.
If not English, politely note that you primarily check English
but will try to help with basic grammar patterns.Create a Writing Coach
agent_id: "writing-coach"
instruction: |
Go beyond grammar to provide:
- Tone suggestions (formal vs casual)
- Structure recommendations
- Clarity improvements
- Stronger word choicesAdd Specialized Checkers
Create multiple agents for different purposes:
# agents/academic_checker.yaml
agent_id: "academic-checker"
instruction: |
Focus on academic writing standards:
- Citation format
- Formal tone
- Passive voice (when appropriate)
- Hedging languageTroubleshooting
Agent Not Responding to Topics
- Verify the agent is connected and listening
- Check that
forum.topic.createdtrigger is configured - Ensure the forum mod is enabled on both network and agent
Responses Too Long/Short
Adjust the instruction:
instruction: |
...
Keep responses concise - focus on the 3 most important issues.
Only provide the corrected version if there are actual errors.Agent Responding to Own Messages
Add a filter to ignore self-replies:
instruction: |
...
IMPORTANT: Do not respond to messages from "grammar-checker"What's Next?
You've now seen all 5 OpenAgents demos showcasing:
- Hello World - Basic messaging
- Startup Pitch Room - Multi-agent chat
- Tech News Stream - Python agents + tools
- Research Team - Project-based delegation
- Grammar Check Forum - Forum mod + event triggers
Continue learning:
- Python Interface Tutorial - Build custom agents programmatically
- Customize Agents - Advanced agent patterns