Quick Start Guideο
This guide will get you up and running with Pili in just a few minutes!
π 5-Minute Setupο
Assuming you have already completed the Installation Guide, letβs get Pili chatting:
Start the Server
conda activate Pili uvicorn main:app --reload
You should see output like:
INFO: Will watch for changes in these directories: ['/path/to/project'] INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: Started reloader process [12345] using StatReload
Test the API
Open your browser and go to http://localhost:8000/api/docs to see the interactive API documentation.
Send Your First Message
curl -X POST "http://localhost:8000/api/chat" \ -H "Content-Type: application/json" \ -d '{ "user_id": "quickstart_user", "message": "Hello Pili!" }'
You should get a response like:
{ "response": "Hello! I'm Pili, your fitness companion! πββοΈ How can I help you today?", "logs": [] }
π― First Interactionsο
Letβs try some basic interactions to understand what Pili can do:
Log a Workout
curl -X POST "http://localhost:8000/api/chat" \
-H "Content-Type: application/json" \
-d '{
"user_id": "quickstart_user",
"message": "I ran 5 kilometers this morning in 30 minutes"
}'
Ask for Motivation
curl -X POST "http://localhost:8000/api/chat" \
-H "Content-Type: application/json" \
-d '{
"user_id": "quickstart_user",
"message": "I need some motivation to keep exercising"
}'
Request a Workout Plan
curl -X POST "http://localhost:8000/api/chat" \
-H "Content-Type: application/json" \
-d '{
"user_id": "quickstart_user",
"message": "Can you create a beginner running plan for me?"
}'
π± Using the Interactive APIο
The easiest way to test Pili is through the interactive API documentation:
Open Swagger UI: http://localhost:8000/api/docs
Click on POST /api/chat
Click βTry it outβ
Enter your test data:
{ "user_id": "test_user_123", "message": "Show me my workout progress this week" }
Click βExecuteβ
π§ Understanding Piliβs Responsesο
Piliβs responses include several components:
{
"response": "Main response text from Pili",
"logs": [
{
"agent": "orchestration",
"action": "route_request",
"details": "Routed to Logger Agent for activity logging"
}
]
}
Response Components:
response
: The main message from Pili to the userlogs
: Debug information showing which agents were involved
π§ Configuration Checkο
Letβs verify your configuration is working:
Health Check
curl http://localhost:8000/api/health
Memory Status
curl http://localhost:8000/api/memory/stats/quickstart_user
Available Endpoints
Visit http://localhost:8000/api/docs to see all available endpoints.
π Agent System Demoο
Pili uses a 3-agent orchestration system. Hereβs how to see it in action:
Simple Logging (Uses Logger Agent)
{
"user_id": "demo_user",
"message": "I did 50 push-ups today"
}
Complex Planning (Uses Logger + Coach Agents)
{
"user_id": "demo_user",
"message": "Analyze my running progress and suggest improvements"
}
Motivational Support (Uses Coach Agent)
{
"user_id": "demo_user",
"message": "I'm feeling unmotivated. Help me get back on track."
}
Watch the logs
field in responses to see which agents are activated!
π MCP Server Integrationο
If you have the Scaffold Your Shape MCP server running, test the integration:
# Test MCP connectivity
curl -X POST "http://localhost:8000/api/chat" \
-H "Content-Type: application/json" \
-d '{
"user_id": "mcp_test_user",
"message": "Show me available fitness clubs"
}'
Note
The MCP server should be running at http://192.168.1.98:3005
(configurable via MCP_BASE_URL
).
π¨ Common Issues & Solutionsο
Server Wonβt Start
# Check if port 8000 is in use
lsof -i :8000
# Use a different port
uvicorn main:app --reload --port 8001
Memory Errors
# Clear user memory if needed
curl -X POST "http://localhost:8000/api/memory/clear" \
-H "Content-Type: application/json" \
-d '{"user_id": "your_user_id"}'
API Key Issues
Check your .env
file has valid keys:
cat .env | grep -E "(OPENAI_API_KEY|LANGCHAIN_API_KEY)"
π Next Stepsο
Now that Pili is running:
Learn about Architecture: Architecture Overview
Explore Configuration: Configuration Guide
Try More Examples: Basic Usage Examples
π‘ Pro Tipsο
Use descriptive user_ids: This helps with debugging and memory management
Check the logs: The
logs
field shows you whatβs happening under the hoodTry conversational flow: Send multiple messages with the same
user_id
to test memoryMonitor with LangSmith: If configured, check your LangSmith dashboard for detailed traces
Tip
For production use, make sure to review the configuration guide carefully!
Happy chatting with Pili! πββοΈπͺ