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
70 changes: 70 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This workflow will upload a Python Package to PyPI when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Build release distributions
run: |
# NOTE: put your own distribution build steps here.
python -m pip install build
python -m build
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point the release build at a real Python package

In this workflow, the release job runs python -m build from the repository root immediately after checkout, but I checked the root for pyproject.toml, setup.py, or setup.cfg and none exists. That means every published release will fail in release-build before dist/ is uploaded or PyPI publishing can run; either add package metadata at the root or cd to the package that actually has it before building.

Useful? React with 👍 / 👎.

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
environment:
name: pypi
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
# url: https://pypi.org/p/YOURPROJECT
#
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
# ALTERNATIVE: exactly, uncomment the following line instead:
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ To begin with Agent Zero, follow the links below for detailed guides on various
- **[Installation](installation.md):** Set up (or [update](installation.md#how-to-update-agent-zero)) Agent Zero on your system.
- **[Usage Guide](usage.md):** Explore GUI features and usage scenarios.
- **[Architecture Overview](architecture.md):** Understand the internal workings of the framework.
- **[Token Compression Protocol](token_compression_protocol.md):** Run the TCP service and integrate it with clients (including browser extensions).
- **[Contributing](contribution.md):** Learn how to contribute to the Agent Zero project.
- **[Troubleshooting and FAQ](troubleshooting.md):** Find answers to common issues and questions.

Expand Down Expand Up @@ -59,6 +60,7 @@ To begin with Agent Zero, follow the links below for detailed guides on various
- [Making Changes](contribution.md#making-changes)
- [Submitting a Pull Request](contribution.md#submitting-a-pull-request)
- [Documentation Stack](contribution.md#documentation-stack)
- [Token Compression Protocol](token_compression_protocol.md)
- [Troubleshooting and FAQ](troubleshooting.md)
- [Frequently Asked Questions](troubleshooting.md#frequently-asked-questions)
- [Troubleshooting](troubleshooting.md#troubleshooting)
186 changes: 186 additions & 0 deletions docs/autonomous_listing_service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Autonomous Listing Service – Technical Blueprint

This document describes the design of an AI-native service that turns a seller’s raw photos and notes into premium listings, syndicates them across major marketplaces (Craigslist, Mercari, Nextdoor, etc.), and provides a unified conversational interface for negotiating with buyers. The system is intentionally agentic, multi-LLM, and RAG-enabled while running on a lightweight Python container suitable for serverless deployments.

---

## 1. Goals & Constraints
- **Delightful Listings:** Transform mediocre images + short descriptions into polished media and persuasive narratives that boost conversions.
- **One-Click Syndication:** Publish consistently formatted listings to multiple platforms with per-channel compliance.
- **Unified Messaging:** Give sellers a Zoom-like conversational hub to coordinate with AI agents and buyers while listings are live.
- **Autonomous Lifecycle:** Monitor inquiries, negotiate within guardrails, and auto-close listings once an item sells.
- **Portable Runtime:** Deliver as a Python-first, containerized micro-app deployable on Lambda, Cloud Run, or Fargate.

---

## 2. High-Level Architecture

```
User → Web/App UI → API Gateway → Python Orchestrator (FastAPI) → Agent Mesh
↘ Event Bus / Task Queue
↘ Worker Pods (image, LLM, RAG, integrators)
Storage Layers: Object storage (images), Vector DB (descriptions/market data), Relational DB (listings, chats)
```

### Core Services
1. **Ingestion & Auth**
- Accepts photo uploads, metadata, and voice/text notes.
- Performs safe content checks before processing.
2. **AI Creativity Pipeline**
- Image Enhancement Agent: Upscales, denoises, applies lighting corrections, and composes collage thumbnails.
- Styling Agent: Suggests background removal or contextual scenes (e.g., staging furniture).
- Narrative Agent: Generates long-form descriptions leveraging a marketing RAG corpus + sentiment tuning for each marketplace.
3. **Marketplace Integrators**
- Channel-specific adapters for Craigslist, Mercari, Nextdoor, (extensible to Facebook Marketplace, OfferUp, etc.).
- Normalizes categories, pricing, shipping, and handles platform-specific throttling/anti-bot rules.
4. **Engagement Hub**
- Real-time messaging service bridging buyers (email/SMS/in-platform chat) with seller + negotiation agents.
- Shared timeline UI showing offers, counteroffers, and status changes.
5. **Lifecycle Controller**
- Tracks listing states (draft → scheduled → live → pending sale → closed).
- Automatically unlists from all channels once a purchase is confirmed.

---

## 3. Agentic Workflow

| Step | Agent | Description | LLM Model(s) |
| --- | --- | --- | --- |
| Intake | Concierge Agent | Confirms item details, requests missing info, runs safety checklist. | GPT-4o or Claude 3.5 Sonnet |
| Visual Polish | Vision Stylist & Enhancer | Applies upscaling, background cleanup, style transfer tuned per category. | Stable Diffusion XL / ControlNet + DeepSeek-VL for QA |
| Narrative Crafting | Listing Copywriter | Generates short + long descriptions, bullet highlights, SEO tags, shipping guidance. Uses RAG on market best practices. | GPT-4.1 / Gemini 1.5 Pro |
| Valuation | Pricing Analyst | Benchmarks with comps fetched via search APIs; suggests optimal price tiers. | Claude 3.5 Haiku + internal comps DB |
| Syndication | Channel Publisher | Maps listing to each platform’s schema, posts, and verifies success. | Tool-executing agent via FastAPI + Selenium/API |
| Engagement | Buyer Liaison | Monitors inquiries, drafts responses, escalates to seller when negotiation boundaries hit. | GPT-4o mini (fast) with guardrails |
| Closure | Lifecycle Steward | Detects sale confirmation, auto-closes all channels, generates pick-up instructions. | Rule-based + LLM verification |

Agents communicate via the existing `call_subordinate` + `knowledge_tool` primitives, storing context in `memory`/`knowledge` for reuse (e.g., pricing heuristics, category guidelines).

---

## 4. AI Pipeline Details

### 4.1 Image Enhancement
- **Stages:** (1) quality assessment → (2) super-resolution (e.g., Real-ESRGAN) → (3) background cleanup (Matte-ing) → (4) lighting & color grading → (5) layout collage.
- **Outputs:** hero image, 3–5 gallery shots, detail zooms, and optional lifestyle composite scene.
- **Instrumentation:** Each step logs metrics (sharpness delta, noise reduction) for future fine-tuning.

### 4.2 Description + Sentiment Crafting
- **Inputs:** Seller notes, extracted metadata (dimensions via OCR, brand logos, etc.), prior sales comps.
- **RAG Sources:** Marketing playbooks, brand tone guides, compliance docs per platform.
- **Outputs:**
- Title optimized for SEO,
- Rich paragraph + bullet list,
- Condition disclosures,
- Suggested hashtags and shipping/pickup text.
- **Tone Tuning:** Different prompt templates per platform (e.g., concise for Craigslist, lifestyle-forward for Nextdoor).

### 4.3 Pricing & Strategy
- Pulls live comps via aggregator APIs (where permitted) or stored datasets.
- Generates price ladder (list price, “fast-sale” price, minimum acceptable).
- Feeds guardrails to Buyer Liaison (auto-approve offers above threshold, escalate otherwise).

---

## 5. Marketplace Integrations

| Platform | Integration Mode | Notes |
| --- | --- | --- |
| Craigslist | Headless browser automation (Playwright) + email relay for replies. | Needs CAPTCHA-solving strategy (vision model + manual fallback). |
| Mercari | Official API (if available) or mobile-app automation. | Supports shipping label creation; track order IDs. |
| Nextdoor | Web automation w/ community selection. | Monitor community guidelines to avoid spam flags. |
| Custom / Others | Modular adapters via interface `MarketplacePublisher`. | Easy to add OfferUp, eBay, Etsy later. |

Failure handling: retries with exponential backoff, webhook-like callbacks to update listing state, and anomaly logging for manual review.

---

## 6. Unified Seller Interface

### UX Tenets
- **Organic Flow:** Minimal forms; conversational onboarding with dynamic checklists.
- **Zoom-like Collab:** Agents appear as avatars, announce actions (e.g., “Copywriter drafting Mercari description”). Seller can join live huddles to approve or tweak content.
- **Inbox View:** Threaded conversations grouped by platform and buyer; AI-suggested replies with quick-edit controls.
- **Visual Dashboard:** Pipeline status (Processing Images → Drafting → Live on X platforms), price ladder, performance analytics.

### Tech Stack
- **Frontend:** React/Next.js or SvelteKit with WebSockets for live updates.
- **Backend:** Python FastAPI orchestrator running inside a slim container (e.g., distroless + uvicorn). Event-driven tasks handled by Celery/Redis or AWS SQS + Lambda workers.
- **Storage:**
- S3-compatible bucket for assets,
- Postgres for listings/offers,
- Redis/WebSocket gateway for live messaging,
- Vector DB (Qdrant/Pinecone) for RAG corpora.

---

## 7. Serverless / Containerized Deployment

| Layer | Option | Notes |
| --- | --- | --- |
| API + UI | AWS Lambda (FastAPI via Mangum) or Cloud Run | Handles synchronous interactions. |
| Workers | AWS Fargate / ECS tasks or Cloud Run Jobs | For heavier image/LLM workloads. |
| Event Bus | AWS SQS + EventBridge or Pub/Sub | Decouples ingestion from processing. |
| Media Processing | AWS Lambda w/ GPU (if available) or attached GPU service | For rapid diffusion-based adjustments. |

CI/CD builds a single container image (FastAPI + worker binaries) pushed to ECR/GCR. Infrastructure-as-code (Terraform/Pulumi) provisions queues, storage, and secrets.

---

## 8. Data & Knowledge Fabric
- **Knowledge Packs:**
- Marketing best practices,
- Platform policy summaries,
- Visual staging tips per category.
- **RAG Pipeline:**
1. Seller intent + item metadata → embed → retrieve from vector DB,
2. Feed retrieved snippets into Copywriter prompts,
3. Store resulting listing in `memory/solutions` for future reuse.
- **Personalization:** Seller preferences (tone, negotiation style) saved to memory and loaded automatically when they return.

---

## 9. Implementation Roadmap

1. **Foundations**
- Spin up FastAPI skeleton + auth.
- Configure storage buckets, DB, and vector store.
2. **AI Pipeline MVP**
- Integrate image enhancer (ESRGAN) + background removal.
- Build Copywriter agent with GPT-4o + RAG from initial corpus.
3. **Marketplace Adapter Framework**
- Define `MarketplacePublisher` interface.
- Implement Craigslist + Mercari to validate both automation styles.
4. **Engagement Hub**
- Real-time messaging API + UI view.
- Buyer Liaison agent with guardrails + escalation rules.
5. **Lifecycle & Automation**
- Listing state machine, auto-closing logic, unified analytics.
6. **Serverless Packaging**
- Containerize, add IaC, deploy to sandbox environment.
7. **UX Polish**
- Zoom-like collaboration room, hero dashboard, onboarding wizards.
8. **Compliance & Monitoring**
- Logging, anomaly detection, rate-limit watchdogs, content moderation pipeline.

---

## 10. Future Enhancements
- **Smart Negotiation:** Reinforcement-learning agent tuned on successful deal histories.
- **Buyer Discovery:** Cross-post to social channels with auto-generated reels/stories.
- **Shipment Automation:** Integration with UPS/FedEx APIs for instant label creation.
- **Reputation Engine:** Aggregate feedback across platforms to build seller trust profiles.
- **Predictive Demand:** Recommend best posting windows and price adjustments based on market trends.

---

## 11. Co-Development with the Super Agency

- **Mission Diary:** Maintain `docs/programs/autonomous_listing/journal.md` logging every experiment, release, and KPI shift so agents can learn from prior iterations.
- **Improvement Backlog:** Share a prioritized list (`docs/programs/autonomous_listing/improvements.md`) that feeds into the agency-wide iterative protocol (see Section 15 of `autonomous_super_agency.md`).
- **Telemetry Handoff:** Telemetry Sentinel publishes listing-service-specific health reports (conversion uplift, response latency, negotiation success rate) for Portfolio Navigator to review weekly.
- **Prompt Sync:** Copywriter, Buyer Liaison, and Publisher persona prompts live under `prompts/super-agency/roles/listing_*` and reference the same change log as the broader agency to keep behavior updates auditable.
- **Feedback Routing:** Any seller or buyer feedback entering the Engagement Hub is tagged and stored in `knowledge/custom/main/listings/` so the RAG corpus continuously reflects real-world voice-of-customer insights.
- **Release Ritual:** Every deployment of the service includes a short “What changed / Metrics impacted / Next bet” record appended to the mission diary, ensuring synchronous evolution of the agency and this product line.

This blueprint provides a detailed path to a serverless, AI-native listing concierge that delights sellers and scales across marketplaces with minimal manual effort.
Loading