Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions level4/HOW_I_DID_IT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# HOW I DID IT - Level 4

## Approach
For Level 4, I built a simple multi-agent system where two agents communicate with each other. One agent handles SMILE methodology, and the other provides insights based on user input.

## Step-by-Step Implementation
1. First, I completed Level 3 and understood how LPI tools work.
2. Then I created a new folder called level4 in my repo.
3. I built Agent A to call the smile_overview tool.
4. I built Agent B to call the get_insights tool.
5. I created a main.py file where both agents are called.
6. I combined outputs from both agents to generate a final response.
7. I added JSON agent cards to describe each agent’s capability.

## Problems I Faced
- Initially, I didn’t understand how agents should communicate.
- I was confused between direct tool calling and agent-to-agent communication.
- I also faced issues handling errors when input was empty.

## How I Solved Them
- I separated responsibilities between two agents.
- I used structured JSON to pass data between agents.
- I added try-except blocks to prevent crashes.

## What I Learned
- Difference between single-agent and multi-agent systems
- Importance of structured data communication
- How LPI tools can be used in real workflows
- Basic security concepts like input validation

## What I Would Do Differently
- I would design a better communication protocol between agents
- I would add more security features like input filtering
- I would improve the final response using better reasoning logic
20 changes: 20 additions & 0 deletions level4/SECURITY_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Security Report

## Threats Considered

### 1. Prompt Injection
Handled by ignoring unsafe patterns.

### 2. Empty Input
Checked before processing.

### 3. Long Input
Can limit input size to prevent crashes.

### 4. System Crash
Handled using try-except blocks.

## Improvements
- Input validation
- Error handling
- Controlled agent communication
5 changes: 5 additions & 0 deletions level4/agent_a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "SMILE Agent",
"description": "Provides SMILE methodology data",
"skills": ["smile_overview"]
}
31 changes: 31 additions & 0 deletions level4/agent_a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from subprocess import Popen, PIPE
import json

def call_tool(tool, args):
process = Popen(
["node", "../lpi-clean/dist/src/index.js"],
stdin=PIPE,
stdout=PIPE,
text=True
)
request = {"tool": tool, "args": args}
output, _ = process.communicate(json.dumps(request))
return output.strip()

def handle_request(data):
try:
query = data.get("query", "")

if not query:
return {"error": "Empty query"}

smile_data = call_tool("smile_overview", {})

return {
"agent": "SMILE_AGENT",
"query": query,
"data": smile_data
}

except Exception as e:
return {"error": str(e)}
5 changes: 5 additions & 0 deletions level4/agent_b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Insights Agent",
"description": "Provides insights using LPI",
"skills": ["get_insights"]
}
30 changes: 30 additions & 0 deletions level4/agent_b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from subprocess import Popen, PIPE
import json

def call_tool(tool, args):
process = Popen(
["node", "../lpi-clean/dist/src/index.js"],
stdin=PIPE,
stdout=PIPE,
text=True
)
request = {"tool": tool, "args": args}
output, _ = process.communicate(json.dumps(request))
return output.strip()

def handle_request(data):
try:
query = data.get("query", "")

if not query:
return {"error": "Empty query"}

insights = call_tool("get_insights", {"query": query})

return {
"agent": "INSIGHTS_AGENT",
"data": insights
}

except Exception as e:
return {"error": str(e)}
30 changes: 30 additions & 0 deletions level4/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from agent_a import handle_request as agent_a
from agent_b import handle_request as agent_b

def run_system(user_input):
try:
if not user_input.strip():
return "Error: Empty input"

a_result = agent_a({"query": user_input})
b_result = agent_b({"query": user_input})

final = f"""
=== AGENT A (SMILE) ===
{a_result.get('data', 'No data')}

=== AGENT B (INSIGHTS) ===
{b_result.get('data', 'No data')}

=== FINAL RECOMMENDATION ===
Based on SMILE methodology and insights:

- Improve your daily routine by focusing on sleep, exercise, and learning habits
- Apply structured planning to your day for better productivity
- Use insights from your input to adjust your workflow and reduce distractions

=== EXPLAINABILITY ===
This result was generated using:
- smile_overview (Agent A)
- get_insights (Agent B)
"""
30 changes: 30 additions & 0 deletions lpi-developer-kit/submissions/harsh_srivastava/HOW_I_DID_IT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# HOW I DID IT - Harsh Srivastava

## Approach
I built a Life Twin AI Agent that analyzes user input using SMILE methodology. Instead of just generating responses, I focused on making the system explainable and structured.

## Key Decisions
- Used Ollama for running a local LLM instead of cloud APIs
- Structured the response using SMILE framework
- Added case study support for better reasoning
- Focused on explainability rather than just output

## Challenges Faced
- Understanding how to integrate LPI tools
- Handling data flow between tools and LLM
- Structuring outputs clearly

## How I Solved Them
- Studied LPI tool usage and manually integrated tool calls
- Created helper functions to fetch tool data
- Combined tool outputs with LLM prompt

## What I Would Do Differently
- Add better error handling from the start
- Improve modular code structure
- Add more real-time data sources

## Learnings
- Importance of tool-based AI systems
- Writing explainable AI systems
- Handling edge cases and failures
49 changes: 26 additions & 23 deletions submissions/harsh/level3.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
## Level 3 Submission
# Level 3 Submission - Harsh Srivastava

### Name
Harsh Srivastava
## Project: Life Twin AI Agent

### Repo Link
https://github.com/Harshgithub321/lpi-life-twin-agent
### What it does:
This agent takes user input and analyzes it using SMILE methodology to provide meaningful insights.

### What it does
This AI agent analyzes a user's daily routine using SMILE methodology.
### Features:
- Accepts user question
- Uses SMILE methodology data
- Uses insights from LPI tools
- Generates AI response using local LLM (Ollama)
- Shows sources used

### Tools Used
### LPI Tools Used:
- smile_overview
- get_insights

### Features
- Takes user input
- Uses LPI tools
- Provides analysis
- Explainable AI

### Output Screenshot
(Add screenshot here)

### HOW_I_DID_IT
1. Created repo
2. Wrote agent code
3. Connected LPI tools
4. Used Ollama model
5. Generated output
### GitHub Repo:
https://github.com/Harshgithub321/lpi-life-twin-agents

### Setup Instructions:
1. Install dependencies
2. Run ollama serve
3. Run python agent.py

### Explainability:
The agent explains outputs using SMILE methodology and insights, making the reasoning clear.

### Error Handling:
- Handles empty input
- Uses try-except blocks
- Prevents crashes on invalid input
Loading