π 5.1 Introduction to Agent Development
Turn requirements into working agents β this module covers the practical skills needed to build, test, and refine AI agents.
π Development Lifecycle
Requirements β Design β Prompt Engineering β Implementation β Testing β Deployment
π Iterative Development
Agents improve through continuous testing and refinement
- Human-in-the-loop β critical for high-stakes decisions
- Version control for prompts and agent configurations
βοΈ 5.2 Prompt Engineering Fundamentals
Crafting effective prompts β the art and science of instructing LLMs to perform specific tasks.
π― System Prompts
Define the agent's role, constraints, and personality
π¬ User Prompts
The actual user input or query that initiates the interaction
π Few-shot Prompts
Provide examples of desired behaviour (2-3 examples)
π Structured Output
JSON, XML for consistent, parseable responses
πΉ Example System Prompt:
You are a customer service agent for a Nigerian bank. Be polite, professional, and verify identity before sharing sensitive information. Never ask for passwords or OTPs.
π§ 5.3 Chain-of-Thought Prompting
Step-by-step reasoning β guide the model to think through problems systematically.
πΉ Loan Application Assessment Example:
You are a loan officer at a Nigerian bank. Assess the following application step-by-step:
1. Check if applicant has valid ID and BVN
2. Verify income meets minimum requirements
3. Check credit history
4. Calculate debt-to-income ratio
5. Make recommendation
Applicant: [details here]
- Benefits: transparency, fewer errors, better justification
- Nigerian context: useful for loan processing, compliance checks, and advisory
π 5.4 Tool Calling & Function Execution
Agents that take action β connecting to APIs, databases, and external systems.
πΉ Tool Definition Example:
Tool: check_account_balance
Input: account_number (string)
Output: balance (float), status (string)
Description: Retrieves current balance for a given account number
Tool: initiate_transfer
Input: from_account, to_account, amount, reference
Output: transaction_id, status, timestamp
Description: Transfers funds between accounts
- Idempotent operations β can be safely repeated
- Error handling β graceful failures with clear messages
- Audit logging β record all tool calls for compliance
π 5.5 Prompt Templates & Reusability
Standardize your prompts β create templates for common scenarios.
πΉ Customer Service Template:
SYSTEM: You are a customer service agent for Paystack Nigeria.
Your goal is to resolve payment issues quickly and professionally.
You must NEVER: ask for passwords, OTPs, or BVN.
Always: verify identity through official channels.
CONTEXT: {{user_history}}
{{transaction_details}}
USER: {{user_message}}
INSTRUCTIONS:
1. Acknowledge the issue with empathy
2. Check transaction status
3. If resolved, confirm success
4. If not, escalate with the appropriate department
OUTPUT FORMAT: JSON with fields: status, message, action_required, reference_id
- Template variables β dynamically insert context
- Version control β track changes to templates
π§ͺ 5.6 Testing & Evaluation
Measure what matters β systematic testing ensures reliable agent performance.
π§© Unit Tests
Test individual components (prompts, tool calls, RAG)
π Integration Tests
Test the full agent pipeline
π₯ User Acceptance
Real users interact with the agent
π A/B Testing
Compare different prompt versions
- Key metrics: accuracy, latency, hallucination rate, user satisfaction, task completion
- Test suite β build at least 50 scenarios for your use case
π‘οΈ 5.7 Handling Errors & Edge Cases
Plan for failure β robust agents handle unexpected situations gracefully.
- Hallucinations: ground with RAG, set confidence thresholds β "I'm not sure, let me escalate"
- Prompt Injection: input sanitization, role-based constraints
- Tool Failures: retry logic, alternative paths, human escalation
- Context Overload: summarize, chunk, or prioritize information
π‘ Rule: Always have a graceful fallback β humans are the ultimate safety net.
essential
πΎ 5.8 Multi-Turn Conversations & State Management
Agents that remember β maintaining context across multiple interactions.
β‘ In-Memory Session
Simple, fast, but not persistent
ποΈ Database-Backed
Persistent, scalable, supports long-running conversations
πΉ Session State Example:
Session: #12345
User: 080-1234-5678
Status: VERIFIED
Pending Actions: Transfer request to savings account
History: [verified identity, checked balance, initiated transfer]
Agent: "Transfer of β¦50,000 to savings initiated. Reference: TXN-7890"
π³π¬ 5.9 Nigerian Case Examples
Real-world prompt engineering applications in Nigerian organisations.
- π¦ Bank (Lagos): System prompt with role, constraints, and escalation rules β 40% reduction in resolution time
- π± Telecom (Kano): Chain-of-thought prompting + data retrieval β 30% churn reduction, β¦50M savings
- πΎ Agri-Tech (Kaduna): Few-shot prompting with advisory examples β 25% yield increase, 90% satisfaction
- π₯ Health (Enugu): Structured output for triage decisions β 40% wait time reduction
π Lesson: Start simple, iterate based on feedback. Small prompt improvements can have huge impact.
proven
π 5.10 Summary & Next Steps
You now understand the core skills for agent development. Next module dives into integration and production readiness.
π― Key Takeaways
Prompts are code β treat them with rigour. Test systematically. Plan for failure.
π Action Items
Create templates, build test suite, implement error handling, design tools, set up logging
β
Module 5 Checklist:
- Create prompt templates for your use cases
- Build a test suite with at least 50 scenarios
- Implement error handling and fallback strategies
- Design your tool interfaces and authentication
- Set up logging and monitoring
π§ Module 6 preview: Integration & Production Readiness β deploying, monitoring, and scaling your agent.