CodeWhiz: My AI Assistant for Backend Developers
I recently built Knowledge Agent, an AI assistant for backend developers. It answers questions about Java, Spring Boot, Node.js, Python, Go, and related frameworks in real time. Here’s a step-by-step breakdown of how I created, deployed, and integrated it. It’s live on Telex and ready to assist anyone exploring backend development.
What Knowledge Agent Does:
Knowledge Agent is a real-time AI assistant. Developers can ask questions through a webhook or directly in the Telex platform. It answers with clear, concise explanations, often including code examples. For example, you can ask it how dependency injection works in Spring Boot or request best practices for API design.
1. AI Agent Overview
Function:
Knowledge Agent is designed to help developers with backend development queries. You can ask it questions about frameworks, coding patterns, dependency injection, and more, and it provides concise, clear answers.
Tools Used:
- LlmAgent (Google ADK) – for creating the AI agent
- Spring Boot – for REST API and webhook support
Dependencies:
- google-adk and google-adk-dev
- spring-boot-starter-web
- Lombok (optional, for boilerplate reduction)
Project Architecture:
- Controller – Handles incoming HTTP requests and webhook messages:
@RestController
@RequestMapping("/knowledge")
public class KnowledgeController {
private final KnowledgeService service;
public KnowledgeController(KnowledgeService service) { this.service = service; }
@GetMapping("/health")
public String healthCheck() { return "KnowledgeAgent is running ✅"; }
@PostMapping("/hook")
public ResponseEntity<Map<String,Object>> handle(@RequestBody Map<String,Object> payload) {
String text = service.extractUserText(payload);
String response = service.generateResponse(text);
Map<String,Object> message = Map.of("result", response);
return ResponseEntity.ok(message);
}
}
- Service – Extracts user text from webhook payloads and generates AI responses using Google Gemini:
@Service
public class KnowledgeService {
private final Client client;
public KnowledgeService() {
String apiKey = System.getenv("GOOGLE_API_KEY").trim();
this.client = Client.builder().apiKey(apiKey).build();
}
public String extractUserText(Map<String,Object> payload) {
// Extracts text from Telex webhook JSON payload
Map<String,Object> params = (Map<String,Object>) payload.get("params");
Map<String,Object> message = (Map<String,Object>) params.get("message");
Map<String,Object> part = (Map<String,Object>) ((List<?>) message.get("parts")).get(0);
return part.get("text").toString();
}
public String generateResponse(String query) {
String prompt = "You are a backend development assistant. Question: " + query;
return client.models.generateContent("gemini-2.0-flash", prompt, null).text();
}
}
- Agent Configuration – Initializes the AI agent with instructions and tools:
public class KnowledgeAgent {
public static LlmAgent createAgent() {
return LlmAgent.builder()
.name("knowledge_agent")
.model("gemini-2.0-flash")
.description("Backend developer assistant.")
.instruction("""
You are an expert backend engineer.
Help with Java, Spring Boot, Node.js, Python, Go.
Include examples and references when possible.
""")
.build();
}
}
2. GitHub & Deployment to Railway
- Push to GitHub:
git init
git add .
git commit -m "Initial commit of Knowledge Agent"
git push origin main
- Deploy to Railway:
- Connect your GitHub repository to Railway
- Set environment variables (e.g., GOOGLE_API_KEY) in Railway
- Enable automatic builds from GitHub
- Railway deploys your Spring Boot application and exposes it publicly
Tips:
- Keep API keys secret using Railway’s environment variables
- Ensure your Spring Boot app runs on Railway’s default port
3. Telex AI Integration
1. Create an AIWorker on Telex:
- AIWorker receives messages and triggers webhooks
- Assign the Knowledge Agent webhook URL
2. Configure JSON Workflow:
- Map incoming messages to POST requests to /knowledge/hook
- Ensure the payload matches the expected structure
3. Check Logs:
- Verify the AI agent started successfully https://api.telex.im/agent-logs/{channel.UUID}.txt
- Send a test question to the AIWorker and confirm it returns a valid response
Example Payload:
{
"params": {
"message": {
"parts": [
{"text": "Explain dependency injection in Spring Boot"}
]
}
}
}
Expected Response:
{
"result": {
"kind": "message",
"parts": [
{
"text": "Dependency injection (DI) in Spring Boot is a design pattern that allows you to create loosely coupled and more testable code....... ,
"kind": "text"
}
],
"role": "agent"
},
"id": "12345",
"jsonrpc": "2.0"
}
4. My Experience & Key Learnings
- Integrating Google Gemini AI via ADK made it simple to generate real-time backend answers.
- Webhook integration with Telex ensured real-time communication between users and the AI agent.
- Deployment via Railway allowed secure environment variable handling and fast cloud deployment. This project is perfect for developers, bootcamps, and communities who want a Slack-like AI assistant for learning and coding help.
Why This Project Matters
This agent demonstrates how AI can assist developers in real time. It’s perfect for bootcamps, communities, or educational platforms where learners need instant support. By combining Mastra features, Telex as a platform, and Google Gemini AI, I created a tool that helps developers learn and troubleshoot efficiently.
Explore my agent here: https://telex.im/telex-ai-intergration/home/colleagues/019a4ea1-f657-73b3-8499-57b769c9ce51/019a4ea1-b942-73af-823c-1aa0c72c8edb
Learn more about Telex here: Telex.im
Top comments (0)