Skip to content

Amber-Singhal/AI-Agents-Marketplace-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Error in user YAML: (<unknown>): mapping values are not allowed in this context at line 6 column 19
---

# Agent Marketplace Backend – Project Report

## 🎯 Goal

The objective was to design, build, test, and deploy a **full backend for an AI Agents Marketplace**.
Key goals included:

* Support for agent catalog, licensing, installation, configuration, permissions, connectors.
* Invocation flows (sync/async), runs, schedules, policy management, analytics, billing, MCP integration.
* Policy enforcement & watchdog features.
* Deployment in a **cloud-accessible environment** (Ngrok for local tunneling, Railway for production).

---

🛠️ Approach

  1. Initial Specification

    • Defined a large set of REST API endpoints across multiple domains (hygiene, catalog, licensing, install, config, permissions, connectors, invoke, runs, schedules, policy enforcement, watchdog, etc.).
    • Chose Flask as the framework.
    • Targeted Google Colab for rapid prototyping, with Ngrok to expose the local service.
  2. Backend Implementation

    • Wrote a complete Flask server (main.py) with stubbed in-memory stores for agents, installs, runs, schedules, policies, watchdog detections.

    • Added hygiene features:

      • Idempotency headers
      • Rate limit headers
      • Request IDs
      • RFC7807 error responses
  3. Testing Suite

    • Created a Colab notebook and a Python script to:

      • Systematically test every API endpoint.
      • Log request/response.
      • Save reports in JSON + Markdown.
    • Automated flows for install → config → invoke → runs → schedules → policy → webhooks → billing.

  4. Deployment

    • Used Ngrok (with token: 32aauBZgG3BuoZFAT3B8VNMLPFp_hYNbMn3ubwewMaS1KkYH) to expose Colab.
    • Later deployed to Railway using the repo Agent-marketplace.
    • Deployment successful, service live under Railway.

🐞 Issues & Fixes

Issue Cause Fix
Duplicate Flask routes Decorators without functools.wraps caused “View function mapping is overwriting an existing endpoint.” Added @wraps(func) in idempotency decorator.
f-string syntax errors Improperly closed f-strings in policy enforcement test calls. Corrected f-string format and ensured proper braces.
datetime.utcnow() warnings Deprecated in Python 3.12. Replaced with datetime.now(UTC).
Watchdog endpoints 404 Not implemented in the backend stub. Added stub endpoints (sources, detections, disclosures, sweep).
TypeError: unhashable type 'dict' Accidentally used a set for test results. Replaced with a list, wrapped data with JSON-safe serializer.
FileNotFoundError for reports /mnt/data not always available. Created the directory with os.makedirs(exist_ok=True).

✅ Features Successfully Working

  • Hygiene: Ping, rate-limit headers, error model.
  • Catalog: List agents, get details, versions, artifacts.
  • Licensing: Plans, subscriptions, entitlements.
  • Installations: Create, list, enable/disable.
  • Config: Schema fetch, set, get.
  • Permissions: Get, grant/revoke.
  • Connectors: Add, list, status.
  • Invoke: Sync, async, validate input.
  • Runs: Get status, logs, artifacts, cancel, feedback.
  • Schedules: Create, list, update, delete.
  • Policy: Get, update.
  • Webhooks: Register, test, delete.
  • Analytics: Runs search, metrics.
  • Billing: Usage, invoices.
  • MCP: Manifest, invoke tools, send events.
  • Policy Enforcement: Upload, simulate, enforce, findings (list, accept, remediate), attest.
  • Watchdog: Stubs available (sources, detections, sweep, disclosures).

🚀 Deployment

  • Ngrok (Colab): Temporary live link (used for testing): https://d62e3ad6a8db.ngrok-free.app

  • Railway (Production): Repo: Agent-marketplace on GitHub Status: ✅ Deployment successful (via GitHub CI → Railway) Region: asia-southeast1


📊 Outcome

  • Built a production-ready API skeleton for an Agent Marketplace.

  • Cut down development cost & time drastically:

    • Traditional devs: 3–4 weeks, ~$7k–$15k.
    • With Colab + AI assistance: ~1 day of iterative building & debugging.
  • Achieved end-to-end functionality with 50+ endpoints, tested automatically.


📌 Next Steps

  • Add authentication & RBAC.
  • Replace in-memory stores with persistent DB (Postgres/Redis).
  • Harden watchdog agent integrations.
  • Publish OpenAPI/Swagger docs for external developers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages