Skip to content

vizionik25/agent-puter

Repository files navigation

logo

Agent-Puter

Autonomous AI Consulting Agency β€” Business in a Box

A fully autonomous AI consulting agency powered by a swarm of specialized LLM agents, a Starlette REST API, and a Next.js client portal with a subscription-credit billing model.

Python Next.js PyPI License: MIT uv


What is Agent-Puter?

Agent-Puter is a self-contained, production-ready AI consulting agency platform. A client visits the portal, describes their project in plain English, receives an AI-generated proposal, and uses subscription credits to kick off the autonomous agent swarm. A team of specialized AI agents handles everything β€” research, engineering, QA β€” then delivers a live demo.

Client visits portal
      β”‚
      β–Ό
/consult  ←── Sales Agent (live AI chat, scopes the project)
      β”‚
      β–Ό
/proposal ←── Proposal (problem/solution, plan, ETA, credit cost)
      β”‚
      β–Ό
Execute with credits ←── Deduct credits from subscription balance
      β”‚
      β–Ό  ← Agent Swarm kicks off autonomously ──────────────────────┐
      β”‚                                                               β”‚
      β”‚  CEO ──► PM ──► Engineer / Researcher ──► QA ──► CEO approvesβ”‚
      β”‚                                                               β”‚
      β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚
      β–Ό
/demo  ←── Auto-deployed sandbox delivery
      β”‚
      β–Ό
/status ←── Real-time task progress tracker (auto-refreshes every 8s)

Architecture

Three components, one docker compose up:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  frontend/          Next.js 16  (port 3000)      β”‚
β”‚  β”œβ”€β”€ /                Landing page               β”‚
β”‚  β”œβ”€β”€ /consult         AI consultation chat (SSE) β”‚
β”‚  β”œβ”€β”€ /dashboard       User dashboard & projects  β”‚
β”‚  β”œβ”€β”€ /proposal/[id]   Proposal + credit CTA      β”‚
β”‚  β”œβ”€β”€ /billing         Subscription & credit mgmt β”‚
β”‚  β”œβ”€β”€ /demo/[id]       Sandbox demo viewer        β”‚
β”‚  └── /status/[id]     Live progress tracker      β”‚
β”‚                                                  β”‚
β”‚  lib/api.ts           Typed REST API client      β”‚
β”‚  lib/auth.ts          GitHub OAuth session       β”‚
β”‚  lib/billing.ts       Client-side billing mock   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚  REST / JSON
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  src/agent_puter/swarm/   Starlette  (port 9999) β”‚
β”‚                                                  β”‚
β”‚  ── Client API ──────────────────────────────── β”‚
β”‚  GET  /api/auth/github                           β”‚
β”‚  GET  /api/auth/callback                         β”‚
β”‚  GET  /api/auth/me                               β”‚
β”‚  POST /api/auth/logout                           β”‚
β”‚  POST /api/consult/start                         β”‚
β”‚  POST /api/consult/{id}/message                  β”‚
β”‚  POST /api/consult/{id}/stream      (SSE)        β”‚
β”‚  GET  /api/consult/{id}                          β”‚
β”‚  POST /api/consult/{id}/complete                 β”‚
β”‚  GET  /api/projects                              β”‚
β”‚  GET  /api/projects/{id}                         β”‚
β”‚  GET  /api/projects/{id}/proposal                β”‚
β”‚  POST /api/projects/{id}/demo-url                β”‚
β”‚  GET  /api/projects/{id}/demo                    β”‚
β”‚  GET  /api/projects/{id}/usage                   β”‚
β”‚  POST /api/projects/{id}/push-github             β”‚
β”‚  POST /api/payments/deposit                      β”‚
β”‚  POST /api/payments/final                        β”‚
β”‚  POST /api/payments/webhook                      β”‚
β”‚  GET  /api/payments/{id}/status                  β”‚
β”‚  GET  /api/admin/*   (X-Admin-Key required)      β”‚
β”‚                                                  β”‚
β”‚  ── Agent A2A Endpoints ─────────────────────── β”‚
β”‚  /              CEO Agent (root)                 β”‚
β”‚  /sales/*       Sales Agent                      β”‚
β”‚  /pm/*          Project Manager                  β”‚
β”‚  /product-manager/* Product Manager Agent        β”‚
β”‚  /researcher/*  Researcher                       β”‚
β”‚  /engineer/*    Engineer                         β”‚
β”‚  /qa/*          QA Agent                         β”‚
β”‚  /deliveries/*  Static sandbox files             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The Agent Swarm

Seven specialized agents, each a self-contained A2A ASGI app:

Agent Mount Role Key Tools
CEO / Strategic goals, token budgets, final approval allocate_budget, approve_delivery, publish_goal
Sales /sales Client intake, project brief creation create_project_brief, send_proposal
PM /pm Task decomposition, milestone tracking create_task_list, update_task_status
Product Manager /product-manager User stories, acceptance criteria write_user_stories, prioritize_features
Researcher /researcher Web research, document summarization web_search, summarize_docs
Engineer /engineer Code generation, file I/O, sandbox deploy write_file, read_file, run_tests, deploy_to_sandbox
QA /qa Output review, PASS/FAIL verdicts review_output, check_standards

All inter-agent calls use the A2A protocol (HTTP via fasta2a.A2AClient). No direct Python .run() calls between agents β€” every agent is addressed only by its mounted HTTP URL.


Subscription & Credit Model

Project execution is billed in credits drawn from a subscription balance. All billing state is managed client-side via localStorage (frontend mock β€” no backend billing calls).

Plans

Plan Price Credits / Month
Free $0 0 β€” purchase credits to execute
Starter $49/month 30
Pro $149/month 100
Business $399/month 300

Credits roll over; they do not expire. Monthly grants accumulate on top of your existing balance.

Credit Packs (paid plans only)

Top-up credits are available on Starter, Pro, and Business plans. The Free tier cannot purchase packs.

Pack Credits Price
Starter pack 10 $12
Standard pack 30 $32
Power pack 100 $99

Per-Million Token Pricing

Credits are calculated from the proposal's estimated hours using the same per-million-token structure as LLM providers:

Token type Rate
Input tokens 3 credits / 1M tokens
Output tokens 15 credits / 1M tokens
Throughput estimate 75,000 tokens / hour of agent work
Input/output ratio 70% input, 30% output

Formula: totalCredits = (inputTokens / 1M Γ— 3) + (outputTokens / 1M Γ— 15)


Quick Start

Prerequisites

  • uv β€” Python package manager
  • Node.js 20+ and npm
  • A Puter.js account for free LLM inference (or any OpenAI-compatible API)
  • A Stripe account (test keys work fine)
  • A GitHub OAuth App (optional β€” required for the login button and GitHub delivery features)

1. Clone and configure

git clone https://github.com/vizionik25/agent-puter.git
cd agent-puter
cp .env.example .env
# Edit .env: fill in PUTER_AUTH_TOKEN, PUTER_MODEL, PUTER_API_BASE,
#             Stripe keys, and (optional) GitHub OAuth vars

GitHub login (optional): Create an OAuth App at github.com/settings/developers. Set the callback URL to http://localhost:3000/api/auth/callback. Copy the client ID and secret into GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET in .env. Set SESSION_SECRET to any strong random string.

2. Start the backend

uv sync
uv run agent-puter
# β†’ http://localhost:9999
# β†’ http://localhost:9999/health   (swarm status)
# β†’ http://localhost:9999/docs     (CEO agent interactive docs)

Or install from PyPI and run globally:

uv tool install agent-puter
agent-puter

3. Start the frontend

cd frontend
npm install
npm run dev
# β†’ http://localhost:3000

4. (Optional) Stripe webhook for local testing

stripe listen --forward-to localhost:9999/api/payments/webhook

Docker β€” full stack

cp .env.example .env   # fill in secrets
docker compose up --build -d
# Frontend: http://localhost:3000
# Backend:  http://localhost:9999

Environment Variables

Variable Required Default Description
PUTER_AUTH_TOKEN Yes β€” Puter.js session token (used as LLM API key)
PUTER_MODEL Yes β€” LiteLLM model string, e.g. openai/claude-sonnet-4-5
PUTER_API_BASE Yes β€” LLM endpoint, e.g. https://api.puter.com/puterai/openai/v1
STRIPE_SECRET_KEY No β€” Stripe secret key (sk_test_...)
STRIPE_PUBLISHABLE_KEY No β€” Stripe publishable key (pk_test_...)
STRIPE_WEBHOOK_SECRET No β€” Stripe webhook signing secret (whsec_...)
NEXT_PUBLIC_API_URL No "" Frontend β†’ backend URL. Empty = relative /api/* (Docker). Set to http://localhost:9999 for local dev.
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY No β€” Stripe publishable key for frontend Stripe Elements
STORAGE_BACKEND No memory memory, json_file, or puter_kv
STORAGE_PATH No ./data/store.json Path for json_file backend
PUTER_KV_BASE No https://api.puter.com/kv Override for puter_kv backend endpoint
ADMIN_API_KEY No β€” Protects all /api/admin/* routes. Unset = admin disabled.
AGENCY_API_KEYS No β€” Multi-tenancy: key1:tenant1,key2:tenant2
SMTP_HOST No β€” SMTP server for email notifications
SMTP_PORT No 587 SMTP port
SMTP_USER No β€” SMTP login
SMTP_PASS No β€” SMTP password or app password
FROM_EMAIL No SMTP_USER Sender address for notifications
FRONTEND_URL No http://localhost:3000 Base URL for email action links
GITHUB_CLIENT_ID No β€” GitHub OAuth App client ID. Required for GitHub login.
GITHUB_CLIENT_SECRET No β€” GitHub OAuth App client secret. Required for GitHub login.
SESSION_SECRET No random HMAC key for signing session tokens. Set to a strong random string in production.
MCP_SERVER_URL No β€” MCP server URL; enables MCP tools on Researcher + Engineer

Project Structure

agent-puter/
β”œβ”€β”€ src/agent_puter/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ agent-logic-example.py       Single-agent reference example
β”‚   └── swarm/
β”‚       β”œβ”€β”€ main.py                  Starlette app β€” mounts agents + API
β”‚       β”œβ”€β”€ server.py                uvicorn launcher
β”‚       β”œβ”€β”€ agency.py                Agency orchestrator (business loop)
β”‚       β”œβ”€β”€ models.py                Pydantic data models
β”‚       β”œβ”€β”€ base_agent.py            LiteLLMModel factory
β”‚       β”œβ”€β”€ middleware.py            Multi-tenancy (X-Agency-Key)
β”‚       β”œβ”€β”€ notifications.py         SMTP email notifications
β”‚       β”œβ”€β”€ ceo_agent.py
β”‚       β”œβ”€β”€ sales_agent.py
β”‚       β”œβ”€β”€ pm_agent.py
β”‚       β”œβ”€β”€ product_manager_agent.py
β”‚       β”œβ”€β”€ researcher_agent.py
β”‚       β”œβ”€β”€ engineer_agent.py
β”‚       β”œβ”€β”€ qa_agent.py
β”‚       └── api/
β”‚           β”œβ”€β”€ __init__.py          Aggregates all API routes
β”‚           β”œβ”€β”€ _store.py            Legacy alias (delegates to store.py)
β”‚           β”œβ”€β”€ store.py             Pluggable storage backends
β”‚           β”œβ”€β”€ auth.py              /api/auth/* routes (GitHub OAuth)
β”‚           β”œβ”€β”€ consultation.py      /api/consult/* routes
β”‚           β”œβ”€β”€ github_delivery.py   Push deliverables to GitHub repo
β”‚           β”œβ”€β”€ projects.py          /api/projects/* routes
β”‚           β”œβ”€β”€ payments.py          /api/payments/* routes
β”‚           └── admin.py             /api/admin/* routes
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ layout.tsx               Root layout + nav + UserMenu
β”‚   β”‚   β”œβ”€β”€ page.tsx                 Landing page
β”‚   β”‚   β”œβ”€β”€ consult/page.tsx         Consultation chat (SSE streaming)
β”‚   β”‚   β”œβ”€β”€ dashboard/page.tsx       User dashboard & project management
β”‚   β”‚   β”œβ”€β”€ proposal/[id]/page.tsx   Proposal + credit execution CTA
β”‚   β”‚   β”œβ”€β”€ billing/page.tsx         Subscription & credit management
β”‚   β”‚   β”œβ”€β”€ demo/[id]/page.tsx       Sandbox demo viewer
β”‚   β”‚   └── status/[id]/page.tsx     Real-time task progress
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ UserMenu.tsx             GitHub auth nav menu + dropdown
β”‚   β”‚   └── MockStripeModal.tsx      Simulated payment modal
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ api.ts                   Typed REST client
β”‚   β”‚   β”œβ”€β”€ auth.ts                  GitHub OAuth session helpers
β”‚   β”‚   └── billing.ts               Client-side billing (localStorage)
β”‚   └── next.config.ts               Standalone output mode
β”‚
β”œβ”€β”€ Dockerfile                       Backend multi-stage build
β”œβ”€β”€ frontend/Dockerfile              Frontend multi-stage build (Node 22)
β”œβ”€β”€ docker-compose.yml               Full stack
β”œβ”€β”€ docker-compose.backend.yml       Backend only
β”œβ”€β”€ pyproject.toml
└── .env.example

Docs

  • Architecture β€” system design, agent communication, data flow, storage
  • API Reference β€” every endpoint with request/response tables
  • Getting Started β€” local dev setup, first consultation walkthrough
  • Deployment β€” Docker Compose, environment reference, Stripe production

License

MIT Β© 2026 Charles Nichols β€” vizionikmedia.com

About

A business-in-a-box using pydanti-ai for agentic framework and puter.js python SDK for Model Provider and Next.js 16 frontend. This is an Softwares Integrations & AI Automations/Integrations Agency that is meant to be a self-serve autonomous system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors