Adding the app
Browse files- README.md +10 -0
- agent.yaml +15 -0
- app.py +30 -0
- requirements.txt +3 -0
README.md
CHANGED
|
@@ -11,4 +11,14 @@ license: apache-2.0
|
|
| 11 |
short_description: 'MCP agent for detecting climate anomalies in real-time '
|
| 12 |
---
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 11 |
short_description: 'MCP agent for detecting climate anomalies in real-time '
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Climate Sensor Agent
|
| 15 |
+
|
| 16 |
+
A self-contained MCP agent that scans input for climate-related anomalies.
|
| 17 |
+
|
| 18 |
+
Part of the **Collective Intelligence Networks** project — an experiment in emergent multi-agent AI collaboration.
|
| 19 |
+
|
| 20 |
+
## How it works
|
| 21 |
+
|
| 22 |
+
Send POST requests to `/agent` with structured or unstructured environmental text data.
|
| 23 |
+
|
| 24 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
agent.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: climate_sensor_agent
|
| 2 |
+
description: |
|
| 3 |
+
An MCP agent that analyzes environmental data to detect anomalies or alert-worthy climate patterns.
|
| 4 |
+
Designed to be part of Collective Intelligence Networks.
|
| 5 |
+
authors:
|
| 6 |
+
- name: Your Name
|
| 7 |
+
email: you@example.com
|
| 8 |
+
tags:
|
| 9 |
+
- mcp
|
| 10 |
+
- agent
|
| 11 |
+
- climate
|
| 12 |
+
parameters:
|
| 13 |
+
- name: input
|
| 14 |
+
type: string
|
| 15 |
+
description: Climate-related data (structured or semi-structured).
|
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
+
|
| 4 |
+
app = FastAPI()
|
| 5 |
+
|
| 6 |
+
class InputData(BaseModel):
|
| 7 |
+
input: str
|
| 8 |
+
|
| 9 |
+
@app.post("/agent")
|
| 10 |
+
async def run_agent(data: InputData):
|
| 11 |
+
input_text = data.input.lower()
|
| 12 |
+
|
| 13 |
+
if "heatwave" in input_text or "drought" in input_text:
|
| 14 |
+
status = "CRITICAL"
|
| 15 |
+
elif "rain" in input_text or "temperature" in input_text:
|
| 16 |
+
status = "NORMAL"
|
| 17 |
+
else:
|
| 18 |
+
status = "UNKNOWN"
|
| 19 |
+
|
| 20 |
+
return {
|
| 21 |
+
"output": {
|
| 22 |
+
"status": status,
|
| 23 |
+
"agent_response": f"Climate status identified as {status} based on input.",
|
| 24 |
+
"summary": input_text
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
@app.get("/")
|
| 29 |
+
async def root():
|
| 30 |
+
return {"message": "Climate Sensor Agent is alive"}
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi==0.110.0
|
| 2 |
+
uvicorn==0.29.0
|
| 3 |
+
pydantic==2.6.4
|