Agent Development Tutorial
Build sophisticated AI agents using the Fiberwise platform. Learn to create content generation agents, integrate LLM providers, and deploy intelligent automation workflows.
๐ What You'll Build
A content generation agent that:
- โ Creates blog posts, social media content, and emails
- โ Integrates with multiple LLM providers (OpenAI, Anthropic)
- โ Supports different tones and content lengths
- โ Includes workflow automation and error handling
Final Result: A production-ready AI agent installed to your Fiberwise platform (no UI - pure agent functionality).
๐ Prerequisites: Your Setup Checklist
Before you begin, you need a fully configured Fiberwise environment. This is the foundation for building any app on the platform.
๐ง Required Setup
โ All Set?
Once all boxes are checked, you are ready to proceed. If not, please complete the linked guides first.
Step 1: Create Your Agent App
Initialize Agent Project
# Create and enter project directory
mkdir content-generator-agent
cd content-generator-agent
# Initialize basic app structure
fiber init
# The CLI creates:
# โโโ app_manifest.yaml # App configuration
# โโโ agents/ # Agent implementations
# โ โโโ content_generator.py
# โโโ index.js # App entry point
Create Content Generator Agent
Edit agents/content_generator.py
:
from fiberwise_sdk import FiberAgent
class ContentGenerator(FiberAgent):
"""Generates marketing content with AI assistance"""
def run_agent(self, input_data: dict, llm_provider: LLMProviderService):
topic = input_data.get('topic', '')
content_type = input_data.get('type', 'blog_post')
tone = input_data.get('tone', 'professional')
length = input_data.get('length', 'medium')
if not topic:
return {'status': 'error', 'message': 'Topic is required'}
# Generate content based on type
if content_type == 'blog_post':
return self._generate_blog_post(topic, tone, length, llm_provider)
elif content_type == 'social_media':
return self._generate_social_media(topic, tone, llm_provider)
elif content_type == 'email':
return self._generate_email(topic, tone, llm_provider)
else:
return {'status': 'error', 'message': f'Unknown content type: {content_type}'}
def _generate_blog_post(self, topic, tone, length, llm_provider):
"""Generate a blog post"""
length_guide = {
'short': 'about 300-500 words',
'medium': 'about 800-1200 words',
'long': 'about 1500-2000 words'
}
prompt = f"""
Write a {tone} blog post about {topic}.
Length: {length_guide.get(length, 'medium length')}
Include:
- Engaging title
- Introduction that hooks the reader
- 3-4 main sections with subheadings
- Conclusion with call-to-action
- SEO-friendly structure
Format as markdown.
"""
try:
content = llm_provider.complete(prompt)
return {
'status': 'success',
'content': content,
'content_type': 'blog_post',
'metadata': {
'topic': topic,
'tone': tone,
'length': length,
'word_count': len(content.split()),
'generated_at': self.get_current_time()
}
}
except Exception as e:
return {'status': 'error', 'message': f'Generation failed: {str(e)}'}
def _generate_social_media(self, topic, tone, llm_provider):
"""Generate social media posts"""
prompt = f"""
Create 3 different social media posts about {topic} in a {tone} tone.
Format:
1. Twitter/X post (280 characters max)
2. LinkedIn post (professional, 1-2 paragraphs)
3. Instagram caption (engaging, with hashtags)
Each should be engaging and platform-appropriate.
"""
try:
content = llm_provider.complete(prompt)
return {
'status': 'success',
'content': content,
'content_type': 'social_media',
'metadata': {
'topic': topic,
'tone': tone,
'platforms': ['twitter', 'linkedin', 'instagram'],
'generated_at': self.get_current_time()
}
}
except Exception as e:
return {'status': 'error', 'message': f'Generation failed: {str(e)}'}
def _generate_email(self, topic, tone, llm_provider):
"""Generate marketing email"""
prompt = f"""
Write a marketing email about {topic} in a {tone} tone.
Include:
- Compelling subject line
- Personal greeting
- Clear value proposition
- Call-to-action
- Professional signature placeholder
Keep it concise and actionable.
"""
try:
content = llm_provider.complete(prompt)
return {
'status': 'success',
'content': content,
'content_type': 'email',
'metadata': {
'topic': topic,
'tone': tone,
'generated_at': self.get_current_time()
}
}
except Exception as e:
return {'status': 'error', 'message': f'Generation failed: {str(e)}'}
def get_current_time(self):
"""Get current timestamp"""
from datetime import datetime
return datetime.now().isoformat()
๐งช Step 2: Test Your Agent Locally
Test Basic Content Generation
# Test blog post generation
fiber activate agents/content_generator.py --input-data '{
"topic": "AI automation for small businesses",
"type": "blog_post",
"tone": "friendly",
"length": "medium"
}'
# Expected output:
# โ
Agent activated successfully
# โ
Content generated: ~800 word blog post
# โ
Metadata includes generation timestamp
Test Different Content Types
# Generate social media posts
fiber activate agents/content_generator.py --input-data '{
"topic": "productivity tips for remote work",
"type": "social_media",
"tone": "casual"
}'
# Generate marketing email
fiber activate agents/content_generator.py --input-data '{
"topic": "new product launch",
"type": "email",
"tone": "professional"
}'
Expected Results
- โ Successful execution - No Python errors or exceptions
- โ Generated content - Content appears in response JSON
- โ Proper formatting - Content follows requested tone and structure
- โ Metadata tracking - Response includes generation timestamp and provider info
๐ Step 3: Install Your Agent
Configure App Manifest
# Content Generator Agent App
app:
name: Content Generator
app_slug: content-generator-agent
version: 1.0.0
description: AI-powered content generation agent
icon: fas fa-pen-fancy
category: ai-tools
minPlatformVersion: 1.6.0
# Agent definitions
agents:
- name: content_generator
description: Generates marketing content with AI assistance
agent_type: content-generation
system_prompt: "You are a professional content creator..."
capabilities: ["blog_posts", "social_media", "email_marketing"]
Install to Platform
# Install your agent app
fiber install app .
# The CLI will:
# 1. โ
Validate app_manifest.yaml
# 2. โ
Create agent in platform database
# 3. โ
Upload agent implementation
# 4. โ
Make agent available for use
Verify Installation
# List installed agents
fiber agent list
# Should show: content_generator - active
# Test installed agent
fiber agent activate content_generator --input-data '{
"topic": "AI in marketing",
"type": "blog_post",
"tone": "professional"
}'
# Should generate content using installed agent
๐ Step 4: Explore Your Agent's Data
Data Explorer API Integration Flow
graph TD A[๐ง app-data-explorer.js] --> B[๐ API Calls to Platform] B --> C[๐ GET /api/apps/:appId/:modelSlug] C --> D[๐ Fetch Activations Data] B --> E[๐ GET /api/apps/:appId/models] E --> F[๐ Get Available Data Models] D --> G[๐ Parse JSON Responses] F --> G G --> H[๐จ Render Data Tables] H --> I[๐ฑ Interactive UI Components] I --> J[๐ Filter by Content Type] I --> K[๐ Sort by Date] I --> L[๐๏ธ View Full Content] I --> M[๐ Export to CSV] classDef component fill:#e3f2fd,stroke:#1976d2,stroke-width:2px classDef api fill:#e8f5e8,stroke:#388e3c,stroke-width:2px classDef data fill:#fff3e0,stroke:#f57c00,stroke-width:2px classDef ui fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px classDef features fill:#e0f2f1,stroke:#00796b,stroke-width:2px class A component class B,C,E api class D,F,G data class H,I ui class J,K,L,M features
Enhanced Data Explorer & Dynamic Model Flow
graph TD AA[๐ค Agent Activation] --> AB[๐ Create Dynamic Model (modelSlug)] AB --> AC[๐๏ธ app_models Table] AB --> AD[๐๏ธ app_model_fields Table] AA --> AE[โก Create Activation Record] AE --> AF[๐๏ธ app_model_items Table] AF --> AG[๐ data: {field1, field2, ...}] AH[๐ง app-data-explorer.js] --> AI[๐ GET /api/apps/:appId/models] AI --> AJ[๐ List Models (with modelSlug)] AH --> AK[๐ GET /api/apps/:appId/:modelSlug/fields] AK --> AL[๐ List Model Fields] AH --> AM[๐ GET /api/apps/:appId/:modelSlug] AM --> AN[๐ Fetch Model Data] AN --> AO[๐ Parse JSON Records] AL --> AO AO --> AP[๐จ Render Table: Dynamic Fields] AP --> AQ[๐ฑ Interactive UI: Filter, Sort, View] classDef agent fill:#e3f2fd,stroke:#1976d2,stroke-width:2px classDef db fill:#e8f5e8,stroke:#388e3c,stroke-width:2px classDef api fill:#fff3e0,stroke:#f57c00,stroke-width:2px classDef data fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px classDef ui fill:#e0f2f1,stroke:#00796b,stroke-width:2px class AA,AE agent class AB,AC,AD,AF db class AH,AI,AK,AM api class AJ,AL,AN,AO data class AP,AQ ui
Agent Activation Data Structure Flow
graph TD A[๐ค Content Generator Agent] --> B[๐ Creates Activation Records] B --> C[๐๏ธ app_model_items Table] C --> D[๐ item_id: UUID] C --> E[๐ created_at: Timestamp] C --> F[๐ค created_by: User ID] C --> G[๐ data: JSON Content] G --> H[๐ฏ status: success/error] G --> I[๐ content_type: blog_post/social_media/email] G --> J[๐จ topic: User Input] G --> K[๐ญ tone: professional/casual/friendly] G --> L[๐ word_count: Generated Count] G --> M[๐ content: Generated Text] H --> N[๐ Data Explorer Display] I --> N J --> N K --> N L --> N M --> N classDef agent fill:#e3f2fd,stroke:#1976d2,stroke-width:2px classDef database fill:#e8f5e8,stroke:#388e3c,stroke-width:2px classDef metadata fill:#fff3e0,stroke:#f57c00,stroke-width:2px classDef content fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px classDef display fill:#e0f2f1,stroke:#00796b,stroke-width:2px class A agent class B,C database class D,E,F,G metadata class H,I,J,K,L,M content class N display
Start Your Platform
Let's see the data your agent has been creating by starting the Fiberwise platform and using the built-in data explorer:
# Start your Fiberwise platform
fiber start
# Platform will be available at:
# http://localhost:8000
Access the Data Explorer
Navigate to your app's data explorer to see all the content your agent has generated:
- Open your browser: Go to
http://localhost:8000
- Navigate to Apps: Click on "Apps" in the main navigation
- Find your agent app: Look for "Content Generator" in the apps list
- Open Data Explorer: Click "Data" next to your app name
๐ What You'll See
The data explorer will show you:
- Activations Model - All agent executions and their results
- Generated Content - Blog posts, social media content, emails
- Metadata - Topics, tones, timestamps, content types
- Performance Data - Success rates, generation times
Explore Your Agent's Output
In the data explorer, you can:
๐ Browse Generated Content
View all blog posts, social media content, and emails your agent has created
๐ Analyze Performance
See success rates, response times, and content quality metrics
๐๏ธ Filter by Type
Sort content by type (blog_post, social_media, email) or tone
๐ฑ View Details
Click "View" on any item to see full content and metadata
Export Your Data
Download your agent's generated content for analysis or backup:
Data Export & CLI Integration Flow
graph TD A[๐ป fiber data export Command] --> B[๐ Identify App & Model] B --> C[๐ GET /api/apps/:appId/:modelSlug] C --> D[๐ Fetch All Activation Records] D --> E{๐ Export Format?} E -->|csv| F[๐ Convert to CSV Format] E -->|json| G[๐ฑ Convert to JSON Format] F --> H[๐ Create CSV Headers] H --> I[๐ง Map Data Fields] I --> J[๐พ Write CSV File] G --> K[๐ง Structure JSON Data] K --> L[๐พ Write JSON File] J --> M[โ Export Complete] L --> M classDef cli fill:#e3f2fd,stroke:#1976d2,stroke-width:2px classDef api fill:#e8f5e8,stroke:#388e3c,stroke-width:2px classDef format fill:#fff3e0,stroke:#f57c00,stroke-width:2px classDef csv fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px classDef json fill:#e0f2f1,stroke:#00796b,stroke-width:2px classDef complete fill:#ffebee,stroke:#d32f2f,stroke-width:2px class A,B cli class C,D api class E format class F,H,I,J csv class G,K,L json class M complete
CSV Export Data Transformation Flow
graph TD A[๐๏ธ Raw Database Records] --> B[๐ JSON Data Extraction] B --> C[๐ง Field Mapping Process] C --> D[๐ activation_id โ item_id] C --> E[๐ status โ data.status] C --> F[๐ฏ content_type โ data.content_type] C --> G[๐ topic โ data.metadata.topic] C --> H[๐ญ tone โ data.metadata.tone] C --> I[๐ word_count โ data.metadata.word_count] C --> J[๐ generated_at โ data.metadata.generated_at] C --> K[๐ content โ data.content (truncated)] D --> L[๐ CSV Row Generation] E --> L F --> L G --> L H --> L I --> L J --> L K --> L L --> M[๐พ Final CSV File] classDef database fill:#e3f2fd,stroke:#1976d2,stroke-width:2px classDef extraction fill:#e8f5e8,stroke:#388e3c,stroke-width:2px classDef mapping fill:#fff3e0,stroke:#f57c00,stroke-width:2px classDef csv fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px classDef output fill:#e0f2f1,stroke:#00796b,stroke-width:2px class A database class B extraction class C,D,E,F,G,H,I,J,K mapping class L csv class M output
# Export activations data to CSV
fiber data export content-generator-agent activations --format csv --output agent-content.csv
# Export with specific date range
fiber data export content-generator-agent activations \
--format csv \
--start-date "2025-01-01" \
--end-date "2025-12-31" \
--output agent-content-2025.csv
# Export as JSON for programmatic use
fiber data export content-generator-agent activations --format json --output agent-data.json
CSV Structure
Your exported CSV will contain columns like:
activation_id | status | content_type | topic | tone | word_count | generated_at | content |
---|---|---|---|---|---|---|---|
act_123456 | success | blog_post | AI automation | professional | 842 | 2025-08-15T10:30:00Z | # AI Automation for Modern... |
act_123457 | success | social_media | productivity tips | casual | 156 | 2025-08-15T11:15:00Z | ๐ Boost your productivity... |
๐ก Use Your Exported Data For:
- Content Analysis - Analyze word counts, topics, and performance
- Quality Review - Review and edit generated content
- Publishing Workflows - Import into CMS or social media schedulers
- Training Data - Use successful outputs to improve prompts
- Reporting - Show content generation metrics to stakeholders
๐ Next Steps
Complete Agent Development & Deployment Lifecycle
graph TD A[๐ป Local Development] --> B[๐งช Local Testing] B --> C[๐ Platform Installation] C --> D[๐ Production Usage] D --> E[๐ Data Analysis] E --> F[๐ Iteration & Improvement] F --> A A --> A1[๐๏ธ fiber init] A --> A2[๐ค Agent Implementation] A --> A3[โ๏ธ Manifest Configuration] B --> B1[โก fiber activate] B --> B2[๐ Validation & Debugging] B --> B3[โ Local Success] C --> C1[๐ฆ fiber install app] C --> C2[๐๏ธ Database Integration] C --> C3[๐ API Endpoints] D --> D1[๐ฑ Web Interface] D --> D2[๐ง FIBER.agents.activate] D --> D3[๐ Real-time Results] E --> E1[๐ app-data-explorer] E --> E2[๐ CSV Export] E --> E3[๐ Performance Analysis] F --> F1[๐ง Code Updates] F --> F2[๐ฆ fiber app update] F --> F3[๐ Re-deployment] classDef phase fill:#e3f2fd,stroke:#1976d2,stroke-width:2px classDef dev fill:#e8f5e8,stroke:#388e3c,stroke-width:2px classDef test fill:#fff3e0,stroke:#f57c00,stroke-width:2px classDef deploy fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px classDef usage fill:#e0f2f1,stroke:#00796b,stroke-width:2px classDef analysis fill:#ffebee,stroke:#d32f2f,stroke-width:2px classDef iterate fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px class A,B,C,D,E,F phase class A1,A2,A3 dev class B1,B2,B3 test class C1,C2,C3 deploy class D1,D2,D3 usage class E1,E2,E3 analysis class F1,F2,F3 iterate
End-to-End Agent Execution Flow with FIBER SDK
graph TD A[๐ค User Request] --> B[๐ Web Interface/CLI] B --> C[๐ง FIBER.agents.activate] C --> D[๐ POST /api/v1/activations] D --> E[๐๏ธ Create Activation Record] E --> F[๐ค Load Agent Code] F --> G[๐ Dependency Injection] G --> H[๐ง LLMProviderService] G --> I[๐ FiberApp SDK] G --> J[๐๏ธ DatabaseService] H --> K[๐ฏ Agent.run_agent Method] I --> K J --> K K --> L[๐ง llm_provider.complete] L --> M[๐ Generated Content] M --> N[๐ Create Metadata] N --> O[๐พ Update Activation] O --> P[โก WebSocket Event] P --> Q[๐ Real-time UI Update] O --> R[๐ Data Explorer View] R --> S[๐ CSV Export] classDef user fill:#e3f2fd,stroke:#1976d2,stroke-width:2px classDef interface fill:#e8f5e8,stroke:#388e3c,stroke-width:2px classDef api fill:#fff3e0,stroke:#f57c00,stroke-width:2px classDef platform fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px classDef agent fill:#e0f2f1,stroke:#00796b,stroke-width:2px classDef llm fill:#ffebee,stroke:#d32f2f,stroke-width:2px classDef result fill:#f1f8e9,stroke:#558b2f,stroke-width:2px class A user class B,Q interface class C,D api class E,F,G,H,I,J platform class K,M,N agent class L llm class O,P,R,S result
Immediate Next Steps
- Experiment with prompts - Try different content types and tones
- Add error logging - Implement comprehensive error tracking
- Create agent variations - Build specialized content agents
- Update your agent - Make changes and redeploy:
# Update deployed agent fiber app update .
Continue Learning
๐ Congratulations!
You've successfully:
- โ Built an AI-powered content generation agent
- โ Integrated with LLM providers securely
- โ Implemented error handling and metadata tracking
- โ Installed a production-ready agent (no UI needed)
- โ Learned agent development best practices
You're now ready to build even more powerful AI agents!