Create an Agent¶
Agents are YAML files. Drop the file in your agents/ folder — no restart needed.
Minimal Agent¶
name: my_agent
description: What this agent does
triggers:
keywords: [trigger1, trigger2, trigger3]
priority: 5
personality:
default: |
You are a helpful assistant specialized in...
That's it. 6 lines and your agent is live.
Full Agent Reference¶
# ── Required ──────────────────────────────────────────────
name: legal_advisor # unique, lowercase, underscores
description: Legal information and document helper
# ── Triggers ──────────────────────────────────────────────
triggers:
keywords:
- contract
- legal
- law
- agreement
- clause
- liability
- jurisdiction
priority: 8 # higher = preferred when multiple agents match
# range: 1 (general fallback) to 10 (most specific)
# ── Personalities ─────────────────────────────────────────
# One system prompt per user level. Activated by profile.level.
# Only 'default' is required.
personality:
default: |
You are a knowledgeable legal information assistant.
Always clarify that you provide general information, not legal advice.
Recommend consulting a licensed attorney for specific situations.
Use clear, plain language to explain legal concepts.
expert: |
You are assisting a legal professional.
Use proper legal terminology and cite relevant principles.
Focus on nuance, jurisdiction specifics, and edge cases.
indonesian: |
Kamu adalah asisten informasi hukum yang berpengetahuan.
Selalu jelaskan bahwa ini informasi umum, bukan nasihat hukum resmi.
Sarankan konsultasi ke pengacara untuk kasus spesifik.
# ── Skills ────────────────────────────────────────────────
# Additional instructions injected into system prompt.
# Higher priority = appears earlier in the prompt.
skills:
- name: disclaimer
description: Legal disclaimer to always include
content: |
Always include this when giving specific guidance:
"Note: This is general legal information, not legal advice.
Please consult a licensed attorney for your specific situation."
priority: 20 # highest — always at top of prompt
group: tone # group name for organization
- name: document_review
description: How to review legal documents
content: |
When reviewing contracts or legal documents:
1. Identify the parties involved
2. Highlight key obligations for each party
3. Flag unusual or potentially unfavorable clauses
4. Note missing standard protections
5. Summarize termination and dispute resolution terms
priority: 10
group: process
tags: [contract, review] # used for context-aware retrieval
- name: advanced_analysis
description: Advanced legal analysis for expert users
content: |
For expert users: discuss jurisdiction specifics, case law,
and procedural strategies when relevant.
priority: 5
group: advanced
conditions:
profile.level: expert # only activate for expert users
# ── Chain Rules ───────────────────────────────────────────
# Automatically hand off to another agent based on user message.
chain:
- condition: tax OR pajak OR accounting OR audit
to: analyst
message: For tax and financial matters, routing to the Analyst agent.
- condition: startup OR bisnis OR business
to: analyst
message: For business strategy, routing to the Analyst agent.
Schema Reference¶
name¶
- Required
- Must be unique across all agents
- Lowercase, use underscores:
my_agent,legal_advisor
triggers.keywords¶
- List of words that activate this agent
- Case-insensitive, partial match supported
- Be specific — generic words cause false positives
# ❌ Too generic
keywords: [help, please, question]
# ✅ Domain-specific
keywords: [contract, legal, clause, liability, jurisdiction]
triggers.priority¶
- Integer, higher = preferred
- Used when multiple agents match the same message
- Suggested ranges:
1— general fallback5-7— broad domain agents8-9— specific domain agents10— most specific (e.g.,coding)
personality¶
defaultis required, all others are optional- Activated by
sc.memory(user_id).remember("level", "expert") - Common keys:
default,beginner,intermediate,expert,indonesian,formal
skills¶
| Field | Required | Description |
|---|---|---|
name | ✅ | Unique identifier within this agent |
content | ✅ | Instructions injected into system prompt |
description | ✅ | What this skill does |
priority | ❌ | Order in prompt (higher = first), default 5 |
group | ❌ | Logical grouping for organization |
tags | ❌ | List of strings for context-aware activation |
conditions | ❌ | Profile conditions to activate this skill |
chain¶
| Field | Required | Description |
|---|---|---|
condition | ✅ | Keyword(s) in user message, supports OR |
to | ✅ | Name of target agent |
message | ❌ | Optional message shown to user during handoff |
Chain on user message, not LLM response
Chain conditions are matched against the user's message, not what the LLM says.
Practical Examples¶
Agent with bilingual support¶
name: finance
description: Personal finance advisor
triggers:
keywords: [uang, money, investasi, investment, tabungan, saving]
priority: 8
personality:
default: |
You are a knowledgeable personal finance advisor.
Provide practical, evidence-based financial guidance.
indonesian: |
Kamu adalah penasihat keuangan pribadi yang berpengetahuan.
Berikan panduan keuangan yang praktis dan berbasis bukti dalam Bahasa Indonesia.
Agent that chains to multiple agents¶
name: general
description: General-purpose assistant and smart router
triggers:
keywords: [hello, hi, halo, what, why, how, help]
priority: 1
personality:
default: You are a helpful general-purpose assistant.
chain:
- condition: code OR bug OR python OR javascript
to: coding
- condition: deploy OR docker OR server
to: devops
- condition: tulis OR write OR artikel OR blog
to: writer
Agent with conditional skills¶
name: coding
description: Expert programmer
triggers:
keywords: [code, bug, error, python]
priority: 10
personality:
default: You are a senior software engineer.
beginner: You are a patient programming teacher.
expert: You are a principal engineer.
skills:
- name: basic_format
content: Always use proper code blocks with language tags.
priority: 20
- name: advanced_review
content: |
When reviewing code:
- Check security vulnerabilities
- Analyze time and space complexity
- Suggest design patterns
priority: 10
conditions:
profile.level: expert # only for expert users
Testing Your Agent¶
from simplecontext import SimpleContext
sc = SimpleContext("config.yaml")
# Check if your agent loaded
print(sc.list_agents())
# Test routing
result = sc.router.route("user1", "I need help with my contract")
print(result.agent_id) # → "legal_advisor"
print(result.system_prompt) # → full generated prompt