Local Deployment
Run Agent Kernel locally for development and testing.
CLI Mode
The simplest way to run agents locally:
from agentkernel.cli import CLI
if __name__ == "__main__":
CLI.main()
Run:
python my_agent.py
CLI Features
- Agent selection
- Session management
- Conversation history
- Error display
- Debug mode
REST API Mode
Run as a local API server:
from agentkernel.api import RESTAPI
if __name__ == "__main__":
RESTAPI.run()
Run:
python my_agent.py
Test with curl:
curl -X POST http://localhost:8000/chat \
-H "Content-Type: application/json" \
-d '{
"agent": "general",
"message": "Hello!",
"session_id": "test-123"
}'
Configuration
# Log level
export AK_LOG_LEVEL=DEBUG
# Session storage
export AK_SESSION_STORAGE=in_memory
# Port (API mode)
export AK_API_PORT=8000
Development Workflow
- Write agent code
- Test in CLI -
python my_agent.py - Test API locally -
python my_agent.py --mode api - Deploy to cloud when ready
- Optionally create docker image (Refer to
containerizedexamples)
Best Practices
- Use CLI for rapid iteration
- Test with API mode before deployment
- Use in-memory sessions for development
- Enable DEBUG logging during development