Skip to main content
Prerequisites: Basic Python knowledge and completed Deploy Your First Agent tutorial

Overview

RunAgent supports any Python-based AI framework by defining simple entrypoint functions. This guide shows you how to integrate custom frameworks and create your own AI agents.

Quick Start

1. Create a Custom Agent

2. Install Your Framework

3. Configure Your Agent

The generated runagent.config.json will be pre-configured for custom frameworks:

Basic Custom Agent

Here’s a simple custom agent that demonstrates the core concepts:
main.py

Advanced Custom Patterns

1. Streaming Custom Agent

streaming_custom.py

2. Multi-Modal Custom Agent

multimodal_custom.py

3. Specialized Custom Agents

specialized_custom.py

Configuration for Multiple Agents

Update your runagent.config.json to include multiple custom agents:

Testing Your Custom Agent

Python Client

test_custom.py

JavaScript Client

test_custom.js

Best Practices

1. Entrypoint Design

  • Keep entrypoint functions simple and focused
  • Use clear parameter names
  • Provide meaningful return values

2. Error Handling

  • Implement comprehensive error handling
  • Provide meaningful error messages
  • Log errors for debugging

3. Performance

  • Optimize your custom logic
  • Use caching when appropriate
  • Monitor performance metrics

4. Testing

  • Test each entrypoint thoroughly
  • Use mock data for testing
  • Implement integration tests

Common Patterns

Create agents that use rule-based logic for decision making.
Build agents specialized in data transformation and analysis.
Create agents that can process different types of content.
Implement complex workflows with multiple steps.

Troubleshooting

Common Issues

  1. Entrypoint Errors
    • Check function signatures
    • Verify parameter types
    • Handle exceptions properly
  2. Framework Integration
    • Ensure proper imports
    • Check framework compatibility
    • Test framework functionality
  3. Performance Issues
    • Profile your custom logic
    • Optimize expensive operations
    • Use appropriate data structures

Debug Tips

Performance Optimization

1. Code Optimization

  • Use efficient algorithms
  • Optimize data structures
  • Minimize memory usage

2. Caching

  • Cache expensive operations
  • Use appropriate cache strategies
  • Monitor cache performance

3. Async Processing

  • Use async/await when appropriate
  • Implement parallel processing
  • Optimize I/O operations

Next Steps

Advanced Patterns

Learn advanced custom agent patterns and techniques

Production Deployment

Deploy your custom agents to production

Multi-Language Access

Access your custom agents from different languages

Performance Tuning

Optimize your custom agents for production
🎉 Great work! You’ve learned how to deploy custom agents with RunAgent. The flexibility of custom frameworks combined with RunAgent’s multi-language access gives you unlimited possibilities for AI agent development!