For AI Code Assistants (Claude, Cursor, Codex): This document contains complete, executable code examples for building conversational AI agents with the Rippletide SDK. All code blocks are ready to copy-paste and run.
Quick Reference for AI Assistants
Base URL:https://agent.rippletide.com/api/sdkAuthentication:
x-api-key header with your API keyKey Endpoints:
POST /agent- Create agentPOST /q-and-a- Add knowledgePOST /chat/{agent_id}- Chat with agentPOST /action- Define agent actionsPUT /state-predicate/{agent_id}- Set conversation flow
Table of Contents
- Quick Start
- Core Concepts
- SDK API Reference
- Agent Configuration
- Knowledge Management
- State Management
- Chat Integration
- LangChain Integration
- Best Practices
- Complete Examples
- Quick Reference
Quick Start
Prerequisites
Environment Setup
Basic Agent Setup
Core Concepts
Hypergraph Architecture
Rippletide uses a hypergraph-based knowledge representation system:- Entities: Unique identifiers (UUIDs) representing concepts
- Relations: Directed connections between entities
- Tags: Labels for organizing and categorizing content
- Data: Typed values stored on entities
- Commits: Version control for all changes
Key Components
- Agents: The conversational AI entities that interact with users
- Q&A Pairs: The knowledge base that agents use to answer questions
- Tags: Organizational labels for categorizing knowledge
- Actions: Functions that agents can perform
- State Predicates: Rules that govern agent behavior and state transitions
- Guardrails: Safety constraints that prevent inappropriate responses
SDK API Reference
Authentication
All API requests require an API key in the header:Base URL
https://agent.rippletide.com/api/sdkAgent Management
Create Agent
POST /agent Request Body:Get Agent
GET /agent/Update Agent
PUT /agent/Knowledge Management
Create Q&A Pair
POST /q-and-a Request Body:Get Q&A Pairs
GET /q-and-aUpdate Q&A Pair
PUT /q-and-a/Delete Q&A Pair
DELETE /q-and-a/Tag Management
Create Tag
POST /tag Request Body:Link Q&A to Tag
POST /q-and-a-tag Request Body:Action Management
Create Action
POST /action Request Body:State Predicate Management
Set State Predicate
PUT /state-predicate/ Request Body:Guardrails Management
Create Guardrail
POST /guardrail Request Body:Chat Interface
Send Message
POST /chat/ Request Body:Agent Configuration
System Prompt
The system prompt defines the agent’s personality and behavior:Best Practices for Prompts
- Be Specific: Clearly define the agent’s role and responsibilities
- Set Boundaries: Specify what the agent should and shouldn’t do
- Include Context: Provide relevant background information
- Define Tone: Specify the communication style (professional, friendly, etc.)
Knowledge Management
Q&A Structure
Each Q&A pair should be:- Specific: Address a particular question or scenario
- Accurate: Provide correct, up-to-date information
- Complete: Include all necessary details
- Tagged: Organized with relevant tags for better retrieval
Example Q&A Setup
Tag Organization
Organize your knowledge with a clear tagging strategy:State Management
State Predicates
State predicates define how your agent should behave based on the current conversation state:Setting State Predicates
Chat Integration
Basic Chat Implementation
Usage
Advanced Chat with Context
LangChain Integration
Azure OpenAI Integration
Rippletide provides a LangChain-compatible Azure OpenAI endpoint:Custom LangChain Chain
Best Practices
1. Knowledge Base Design
- Granular Q&A: Break complex topics into specific, focused Q&A pairs
- Consistent Formatting: Use consistent question and answer formats
- Regular Updates: Keep knowledge base current and accurate
- Tag Organization: Use a clear, hierarchical tagging system
2. Agent Configuration
- Clear Prompts: Write specific, actionable system prompts
- Appropriate Guardrails: Set boundaries without being overly restrictive
- State Management: Design logical conversation flows
- Error Handling: Implement robust error handling and fallbacks
3. Performance Optimization
- Efficient Queries: Use specific questions to get relevant answers
- Conversation Management: Maintain conversation context appropriately
- Rate Limiting: Implement proper rate limiting for API calls
- Caching: Cache frequently accessed knowledge when appropriate
4. Security Considerations
- API Key Management: Store API keys securely
- Input Validation: Validate all user inputs
- Content Filtering: Implement content filtering for sensitive topics
- Access Control: Implement proper access controls for different user types
Complete Examples
E-commerce Customer Support Agent
Technical Support Agent
Error Handling and Troubleshooting
Common Issues
- Authentication Errors
- Rate Limiting
- Invalid Agent ID
Debugging Tips
- Enable Request Logging
- Test API Connectivity
Quick Reference
Essential Code Templates
1. Minimal Agent Setup
2. Agent with Actions
3. Agent with State Management
4. LangChain Integration
Batch Knowledge Addition
Conversation Management
API Endpoints Summary
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /agent | Create agent |
| GET | /agent/{id} | Get agent details |
| PUT | /agent/{id} | Update agent |
| POST | /q-and-a | Add knowledge |
| GET | /q-and-a | Get knowledge |
| PUT | /q-and-a/{id} | Update knowledge |
| DELETE | /q-and-a/{id} | Delete knowledge |
| POST | /tag | Create tag |
| POST | /q-and-a-tag | Link knowledge to tag |
| POST | /action | Create agent action |
| PUT | /state-predicate/{id} | Set conversation flow |
| POST | /guardrail | Add safety guardrail |
| POST | /chat/{id} | Send message to agent |
Conclusion
The Rippletide SDK provides a powerful platform for building reliable, hallucination-free conversational AI agents. By following this guide and implementing the best practices outlined, you can create sophisticated agents that provide accurate, helpful responses while maintaining conversation context and following predefined business logic. For additional support and updates, visit the Rippletide documentation or contact our support team.This guide is designed to be comprehensive and self-contained. Save this file and use it as a reference when building your Rippletide agents. All code examples are ready to copy-paste and execute.