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
14 changes: 14 additions & 0 deletions contributors/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributors Changelog

All notable community-submitted agent examples are documented in this file.

Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

### Added

- `contributors/` folder and contribution guide for community agent examples
- `contributors/community_agent/` — moved from repository root; AI community growth agent for events and hackathons
- `contributors/weather_agent/` – Added a beginner-friendly weather agent using the Open-Meteo API that provides real-time weather information for any city without requiring API keys or paid services.

109 changes: 109 additions & 0 deletions contributors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Community Contributors — Agent Examples

This folder is the **home for all community-submitted agent examples**. If you are contributing a new agent to this repository, create it here — not at the repository root.

Maintained examples (Fetch.ai team) live in top-level folders such as `fetch-hackathon-quickstarter/`, `gemini-quickstart/`, etc. **Community PRs for new agents must go under `contributors/<your-agent-name>/`.**

---

## Quick start

1. **Star** the repository (required for CI — see [CONTRIBUTING.md](../CONTRIBUTING.md)).
2. **Fork** and branch from `main`:
```bash
git checkout -b feat/my-agent-name
```
3. **Create your agent folder**:
```text
contributors/<your-agent-name>/
README.md
requirements.txt
.env.example # if API keys are needed
agent.py # or your entry script
assets/
demo.png # screenshot or GIF (recommended)
```
4. **Copy the README template**: [docs/AGENT_README_TEMPLATE.md](../docs/AGENT_README_TEMPLATE.md)
5. **Add a changelog entry** in [contributors/CHANGELOG.md](./CHANGELOG.md).
6. **Update the root README** — add your agent to the **Community Contributors** table in [README.md](../README.md).
7. **Open a PR** — your PR must pass CI and receive **at least one review** before merge.

---

## What makes a good contributor agent?

| Area | Guidance |
|------|----------|
| **Purpose** | Solves a clear, real-world task (booking, search, payments, automation, etc.) |
| **Runnable** | Works locally with documented setup; include `.env.example` |
| **Fetch.ai stack** | Prefer **uAgents**, **ASI:One**, **Agentverse**, **A2A**, or **MCP** where relevant |
| **Docs** | Complete README with install, env vars, run steps, and demo |
| **Safety** | No real secrets in code; read-only or sandbox APIs for demos when possible |

---

## Real-time / transactional agents (challenge ideas)

Looking for inspiration? These are high-value patterns the community is encouraged to build (see open issues):

- **Flight booking** — search, compare, hold or mock-book via a travel API (e.g. Duffel, Amadeus sandbox)
- **Hotel booking** — availability, pricing, reservation flow with clear mock/sandbox mode
- **Payment gateway** — Stripe or similar with a gated premium step (see `stripe-payment-agents/` for patterns)
- **Event tickets** — live inventory + checkout deep links (see `mcp-agents/ticketlens-agent/`)
- **Multi-step workflows** — planner → payment → confirmation with chat protocol

Reference examples elsewhere in the repo:

- [flight-tracker-openai-workflow-agent](../flight-tracker-openai-workflow-agent/)
- [stripe-payment-agents](../stripe-payment-agents/)
- [mcp-agents/ticketlens-agent](../mcp-agents/ticketlens-agent/)
- [contributors/community_agent](./community_agent/) — community growth / events agent

---

## Changelog

Every non-documentation change under `contributors/` must update [contributors/CHANGELOG.md](./CHANGELOG.md). The root [CHANGELOG.md](../CHANGELOG.md) is updated by maintainers when we cut releases.

---

## CI checks for contributor PRs

Your pull request must pass:

| Check | What it does |
|-------|----------------|
| `stargazer-gate` | PR author has starred the repo |
| `contributor-path-check` | New agent folders are only under `contributors/` |
| `changelog-check` | `contributors/CHANGELOG.md` updated when you change code |
| `review-required` | At least one approving review — **skipped for maintainers** |
| `lint` / `format` / `typecheck` | Python quality on changed files |
| `validate-architecture` | Required repo files present |
| `test` | Runs pytest when tests exist |

**PRs cannot be merged without review approval** when branch protection is enabled (see [.github/BRANCH_PROTECTION.md](../.github/BRANCH_PROTECTION.md)). Maintainers with repo write access skip this check.

---

## Contributor badge (after your PR merges)

1. Badge is added to your agent `README.md` under `contributors/<your-agent>/`
2. You are listed in [BADGE_REGISTRY.json](./BADGE_REGISTRY.json)
3. Install [profile-badge-sync](./profile-badge-sync/README.md) in your `GitHubUsername/GitHubUsername` repo for **automatic** profile README badge, or paste the markdown from the merge comment.

---

## Need help?

- [CONTRIBUTING.md](../CONTRIBUTING.md) — full contribution policy
- [ISSUES_GUIDE.md](../ISSUES_GUIDE.md) — how to file bugs and pick up tasks
- [Innovation Lab docs](https://innovationlab.fetch.ai/resources/docs/intro)
- Comment on an issue or ask in your PR — maintainers are happy to guide you

---

## Existing community agents

| Agent | Description |
|-------|-------------|
| [community_agent](./community_agent/) | AI community growth agent for events, conferences, and hackathons |
203 changes: 203 additions & 0 deletions contributors/weather_agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# weather-agent

> 🟢 **Beginner** · A uAgent that fetches real-time weather for any city using the free [Open-Meteo API](https://open-meteo.com/) — **no API key, no sign-up, zero cost**.

---

## 1) Project Title

`weather-agent`

A Fetch.ai uAgent that receives a city name and returns live weather conditions (temperature, humidity, wind speed, sky description) by querying the Open-Meteo REST API.

---

## 2) Overview

Most beginner agent examples either call a mocked API or require the user to sign up for a paid weather service. This example bridges that gap: it connects to a **real external API** the moment you run it, with **zero configuration**.

The agent listens for `WeatherRequest` messages, geocodes the city name via Open-Meteo's free Geocoding API, fetches current conditions, and replies with a structured `WeatherResponse` message.

- **Category:** `automation / real-world API`
- **Tech stack:** `Python · uAgents · Open-Meteo REST API · requests`
- **Difficulty:** 🟢 Beginner
- **Status:** `demo`

---

## 3) Features

- 🌍 Accepts **any city name** in the world (resolved via the Open-Meteo Geocoding API)
- 🌡️ Returns temperature, feels-like temperature, humidity, wind speed, and a WMO sky description
- 🔑 **No API key required** — completely free and open
- 🔁 Structured message passing with typed `Model` schemas shared between agent and client
- 🛡️ Graceful error handling for unknown cities or network failures

---

## 4) Prerequisites

| Requirement | Version |
|---|---|
| Python | ≥ 3.10 |
| pip | any recent version |
| Internet access | required (calls `open-meteo.com`) |

No API keys are needed.

---

## 5) Installation

```bash
git clone https://github.com/innovation-lab-examples.git
cd innovation-lab-examples/weather-agent

python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate

pip install -r requirements.txt
```

---

## 6) Environment Variables

This agent works out of the box with no `.env` required. If you want to customise the agent's identity seed or prepare it for Agentverse, create a `.env` file:

```bash
cp .env.example .env
```

### Variables

| Variable | Required | Description |
|---|---|---|
| `AGENT_SEED` | ❌ Optional | Seed phrase that determines the agent's address. Defaults to a hardcoded string in `agent.py`. Change it to get a new address. |
| `CLIENT_SEED` | ❌ Optional | Seed phrase for the client agent. |
| `AGENTVERSE_API_KEY` | ❌ Optional | Only needed to publish on Agentverse. |

---

## 7) Run the Agent

### Step 1 — Start the weather agent

```bash
python agent.py
```

Expected output:

```
INFO: [weather_agent]: Weather Agent started | address: agent1qfx0jmyn...
INFO: [weather_agent]: Waiting for WeatherRequest messages …
```

> **Note the agent address** printed on startup — paste it into `client.py` as `WEATHER_AGENT_ADDRESS` if it differs from the default.

### Step 2 — Run the client (in a second terminal)

```bash
# Default city (London)
python client.py

# Or pass any city as an argument
python client.py "Tokyo"
python client.py "São Paulo"
python client.py "Coimbatore"
```

---

## 8) Expected Output

```
────────────────────────────────────────────────
🌤 Weather Report — Tokyo, Japan
────────────────────────────────────────────────
Condition : Partly cloudy
Temperature : 22.4 °C
Feels like : 21.8 °C
Humidity : 63 %
Wind speed : 14.2 km/h
```

If the city is not found:

```
────────────────────────────────────────────────
⚠ Weather Agent Error
────────────────────────────────────────────────
City 'Atlantis' not found. Please check the spelling.
```

---

## 9) Demo

> _Add a screenshot here after running the agent locally._

```
![Weather Agent Demo](./assets/demo1.jpeg)
![Weather Agent Demo](./assets/demo2.jpeg)
```

---

## 10) Agent Profile

Not yet published on Agentverse.
Once published, link it here:

```
[View Agent Profile](https://agentverse.ai/agents/<address>)
```

---

## 11) Architecture

```
┌──────────────┐ WeatherRequest(city) ┌──────────────────────┐
│ client.py │ ────────────────────────► │ agent.py │
│ (port 8001) │ │ (port 8000) │
│ │ ◄──────────────────────── │ │
│ │ WeatherResponse(...) │ 1. Geocoding API │
└──────────────┘ │ 2. Forecast API │
└──────────────────────┘
https://open-meteo.com
(free, no auth)
```

**Data flow:**

1. `client.py` sends a `WeatherRequest(city="Tokyo")` to the agent's address.
2. `agent.py` calls the Open-Meteo **Geocoding API** to resolve the city to `(lat, lon)`.
3. `agent.py` calls the Open-Meteo **Forecast API** with `current=` parameters for temperature, humidity, wind speed, and WMO weather code.
4. The agent maps the WMO code to a human-readable description and replies with a `WeatherResponse`.
5. `client.py` receives and pretty-prints the response, then exits.

---

## 12) Troubleshooting

| Symptom | Fix |
|---|---|
| `ModuleNotFoundError: uagents` | Run `pip install -r requirements.txt` inside your virtual environment. |
| Client prints nothing / times out | Make sure `agent.py` is running in another terminal **before** starting `client.py`. |
| `City not found` for a valid city | Try a more specific name (e.g. `"Mumbai"` instead of `"Bombay"`). |
| `ConnectionError` | Check your internet connection — both `geocoding-api.open-meteo.com` and `api.open-meteo.com` must be reachable. |
| Wrong agent address | Copy the address printed by `agent.py` on startup and paste it as `WEATHER_AGENT_ADDRESS` in `client.py`. |
| Port conflict (`8000` or `8001` already in use) | Change `port=` in `agent.py` / `client.py` and update the `endpoint=` URL to match. |

---

## 13) License

Apache 2.0

---

Loading