Copilot instructions
.github/copilot-instructions.mdCopilot instructions
Quality
88/100
Scores the file, not the repository.Length
1,563 words
26 headings · 6 code blocksRepository
186k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# GitHub Copilot Instructions for AutoGPT23This file provides comprehensive onboarding information for GitHub Copilot coding agent to work efficiently with the AutoGPT repository.45## Repository Overview67**AutoGPT** is a powerful platform for creating, deploying, and managing continuous AI agents that automate complex workflows. This is a large monorepo (~150MB) containing multiple components:89- **AutoGPT Platform** (`autogpt_platform/`) - Main focus: Modern AI agent platform (Polyform Shield License)10- **Classic AutoGPT** (`classic/`) - Legacy agent system (MIT License)11- **Documentation** (`docs/`) - MkDocs-based documentation site12- **Infrastructure** - Docker configurations, CI/CD, and development tools1314**Primary Languages & Frameworks:**1516- **Backend**: Python 3.10-3.13, FastAPI, Prisma ORM, PostgreSQL, RabbitMQ17- **Frontend**: TypeScript, Next.js 15, React, Tailwind CSS, Radix UI18- **Development**: Docker, Poetry, pnpm, Playwright, Storybook1920## Build and Validation Instructions2122### Essential Setup Commands2324**Always run these commands in the correct directory and in this order:**25261. **Initial Setup** (required once):2728```bash29 # Clone and enter repository30 git clone <repo> && cd AutoGPT3132 # Start all services (database, redis, rabbitmq, clamav)33 cd autogpt_platform && docker compose --profile local up deps --build --detach34```35362. **Backend Setup** (always run before backend development):3738```bash39 cd autogpt_platform/backend40 poetry install # Install dependencies41 poetry run prisma migrate dev # Run database migrations42 poetry run prisma generate # Generate Prisma client43```44453. **Frontend Setup** (always run before frontend development):46```bash47 cd autogpt_platform/frontend48 pnpm install # Install dependencies49```5051### Runtime Requirements5253**Critical:** Always ensure Docker services are running before starting development:5455```bash56cd autogpt_platform && docker compose --profile local up deps --build --detach57```5859**Python Version:** Use Python 3.11 (required; managed by Poetry via pyproject.toml)60**Node.js Version:** Use Node.js 21+ with pnpm package manager6162### Development Commands6364**Backend Development:**6566```bash67cd autogpt_platform/backend68poetry run serve # Start development server (port 8000)69poetry run test # Run all tests (requires ~5 minutes)70poetry run pytest path/to/test.py # Run specific test71poetry run format # Format code (Black + isort) - always run first72poetry run lint # Lint code (ruff) - run after format73```7475**Frontend Development:**7677```bash78cd autogpt_platform/frontend79pnpm dev # Start development server (port 3000) - use for active development80pnpm build # Build for production (only needed for E2E tests or deployment)81pnpm test # Run Playwright E2E tests (requires build first)82pnpm test-ui # Run tests with UI83pnpm format # Format and lint code84pnpm storybook # Start component development server85```8687### Testing Strategy8889**Backend Tests:**9091- **Block Tests**: `poetry run pytest backend/blocks/test/test_block.py -xvs` (validates all blocks)92- **Specific Block**: `poetry run pytest 'backend/blocks/test/test_block.py::test_available_blocks[BlockName]' -xvs`93- **Snapshot Tests**: Use `--snapshot-update` when output changes, always review with `git diff`9495**Frontend Tests:**9697- **E2E Tests**: Always run `pnpm dev` before `pnpm test` (Playwright requires running instance)98- **Component Tests**: Use Storybook for isolated component development99100### Critical Validation Steps101102**Before committing changes:**1031041. Run `poetry run format` (backend) and `pnpm format` (frontend)1052. Ensure all tests pass in modified areas1063. Verify Docker services are still running1074. Check that database migrations apply cleanly108109**Common Issues & Workarounds:**110111- **Prisma issues**: Run `poetry run prisma generate` after schema changes112- **Permission errors**: Ensure Docker has proper permissions113- **Port conflicts**: Check the `docker-compose.yml` file for the current list of exposed ports. You can list all mapped ports with:114- **Test timeouts**: Backend tests can take 5+ minutes, use `-x` flag to stop on first failure115116## Project Layout & Architecture117118### Core Architecture119120**AutoGPT Platform** (`autogpt_platform/`):121122- `backend/` - FastAPI server with async support123 - `backend/backend/` - Core API logic124 - `backend/blocks/` - Agent execution blocks125 - `backend/data/` - Database models and schemas126 - `schema.prisma` - Database schema definition127- `frontend/` - Next.js application128 - `src/app/` - App Router pages and layouts129 - `src/components/` - Reusable React components130 - `src/lib/` - Utilities and configurations131- `autogpt_libs/` - Shared Python utilities132- `docker-compose.yml` - Development stack orchestration133134**Key Configuration Files:**135136- `pyproject.toml` - Python dependencies and tooling137- `package.json` - Node.js dependencies and scripts138- `schema.prisma` - Database schema and migrations139- `next.config.mjs` - Next.js configuration140- `tailwind.config.ts` - Styling configuration141142### Security & Middleware143144**Cache Protection**: Backend includes middleware preventing sensitive data caching in browsers/proxies145**Authentication**: JWT-based with Supabase integration146**User ID Validation**: All data access requires user ID checks - verify this for any `data/*.py` changes147148### Development Workflow149150**GitHub Actions**: Multiple CI/CD workflows in `.github/workflows/`151152- `platform-backend-ci.yml` - Backend testing and validation153- `platform-frontend-ci.yml` - Frontend testing and validation154- `platform-fullstack-ci.yml` - End-to-end integration tests155156**Pre-commit Hooks**: Run linting and formatting checks157**Conventional Commits**: Use format `type(scope): description` (e.g., `feat(backend): add API`)158159### Key Source Files160161**Backend Entry Points:**162163- `backend/backend/api/rest_api.py` - FastAPI application setup164- `backend/backend/data/` - Database models and user management165- `backend/blocks/` - Agent execution blocks and logic166167**Frontend Entry Points:**168169- `frontend/src/app/layout.tsx` - Root application layout170- `frontend/src/app/page.tsx` - Home page171- `frontend/src/lib/supabase/` - Authentication and database client172173**Protected Routes**: Update `frontend/lib/supabase/middleware.ts` when adding protected routes174175### Agent Block System176177Agents are built using a visual block-based system where each block performs a single action. Blocks are defined in `backend/blocks/` and must include:178179- Block definition with input/output schemas180- Execution logic with proper error handling181- Tests validating functionality182183### Database & ORM184185**Prisma ORM** with PostgreSQL backend including pgvector for embeddings:186187- Schema in `schema.prisma`188- Migrations in `backend/migrations/`189- Always run `prisma migrate dev` and `prisma generate` after schema changes190191## Environment Configuration192193### Configuration Files Priority Order1941951. **Backend**: `/backend/.env.default` → `/backend/.env` (user overrides)1962. **Frontend**: `/frontend/.env.default` → `/frontend/.env` (user overrides)1973. **Platform**: `/.env.default` (Supabase/shared) → `/.env` (user overrides)1984. Docker Compose `environment:` sections override file-based config1995. Shell environment variables have highest precedence200201### Docker Environment Setup202203- All services use hardcoded defaults (no `${VARIABLE}` substitutions)204- The `env_file` directive loads variables INTO containers at runtime205- Backend/Frontend services use YAML anchors for consistent configuration206- Copy `.env.default` files to `.env` for local development customization207208## Advanced Development Patterns209210### Adding New Blocks2112121. Create file in `/backend/backend/blocks/`2132. Inherit from `Block` base class with input/output schemas2143. Implement `run` method with proper error handling2154. Generate block UUID using `uuid.uuid4()`2165. Register in block registry2176. Write tests alongside block implementation2187. Consider how inputs/outputs connect with other blocks in graph editor219220### API Development2212221. Update routes in `/backend/backend/api/features/`2232. Add/update Pydantic models in same directory2243. Write tests alongside route files2254. For `data/*.py` changes, validate user ID checks2265. Run `poetry run test` to verify changes227228### Frontend Development229230**📖 Complete Frontend Guide**: See `autogpt_platform/frontend/CONTRIBUTING.md` and `autogpt_platform/frontend/.cursorrules` for comprehensive patterns and conventions.231232**Quick Reference:**233234**Component Structure:**235236- Separate render logic from data/behavior237- Structure: `ComponentName/ComponentName.tsx` + `useComponentName.ts` + `helpers.ts`238- Exception: Small components (3-4 lines of logic) can be inline239- Render-only components can be direct files without folders240241**Data Fetching:**242243- Use generated API hooks from `@/app/api/__generated__/endpoints/`244- Generated via Orval from backend OpenAPI spec245- Pattern: `use{Method}{Version}{OperationName}`246- Example: `useGetV2ListLibraryAgents`247- Regenerate with: `pnpm generate:api`248- **Never** use deprecated `BackendAPI` or `src/lib/autogpt-server-api/*`249250**Code Conventions:**251252- Use function declarations for components and handlers (not arrow functions)253- Only arrow functions for small inline lambdas (map, filter, etc.)254- Components: `PascalCase`, Hooks: `camelCase` with `use` prefix255- No barrel files or `index.ts` re-exports256- Minimal comments (code should be self-documenting)257258**Styling:**259260- Use Tailwind CSS utilities only261- Use design system components from `src/components/` (atoms, molecules, organisms)262- Never use `src/components/__legacy__/*`263- Only use Phosphor Icons (`@phosphor-icons/react`)264- Prefer design tokens over hardcoded values265266**Error Handling:**267268- Render errors: Use `<ErrorCard />` component269- Mutation errors: Display with toast notifications270- Manual exceptions: Use `Sentry.captureException()`271- Global error boundaries already configured272273**Testing:**274275- Add/update Storybook stories for UI components (`pnpm storybook`)276- Run Playwright E2E tests with `pnpm test`277- Verify in Chromatic after PR278279**Architecture:**280281- Default to client components ("use client")282- Server components only for SEO or extreme TTFB needs283- Use React Query for server state (via generated hooks)284- Co-locate UI state in components/hooks285286### Security Guidelines287288**Cache Protection Middleware** (`/backend/backend/api/middleware/security.py`):289290- Default: Disables caching for ALL endpoints with `Cache-Control: no-store, no-cache, must-revalidate, private`291- Uses allow list approach for cacheable paths (static assets, health checks, public pages)292- Prevents sensitive data caching in browsers/proxies293- Add new cacheable endpoints to `CACHEABLE_PATHS`294295### CI/CD Alignment296297The repository has comprehensive CI workflows that test:298299- **Backend**: Python 3.11-3.13, services (Redis/RabbitMQ/ClamAV), Prisma migrations, Poetry lock validation300- **Frontend**: Node.js 21, pnpm, Playwright with Docker Compose stack, API schema validation301- **Integration**: Full-stack type checking and E2E testing302303Match these patterns when developing locally - the copilot setup environment mirrors these CI configurations.304305## Collaboration with Other AI Assistants306307This repository is actively developed with assistance from Claude (via CLAUDE.md files). When working on this codebase:308309- Check for existing CLAUDE.md files that provide additional context310- Follow established patterns and conventions already in the codebase311- Maintain consistency with existing code style and architecture312- Consider that changes may be reviewed and extended by both human developers and AI assistants313314## Trust These Instructions315316These instructions are comprehensive and tested. Only perform additional searches if:3173181. Information here is incomplete for your specific task3192. You encounter errors not covered by the workarounds3203. You need to understand implementation details not covered above321322For detailed platform development patterns, refer to `autogpt_platform/CLAUDE.md` and `AGENTS.md` in the repository root.323
Also in Significant-Gravitas/AutoGPT
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Significant-Gravitas/AutoGPTAGENTS.md · 186k | AGENTS.md | teststylearchgit+1 | 87/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTautogpt_platform/AGENTS.md · 186k | AGENTS.md | setuptestarchtesting-strategy+3 | 77/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTautogpt_platform/backend/AGENTS.md · 186k | AGENTS.md | setuptestlint-formatstyle+9 | 81/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTautogpt_platform/backend/backend/copilot/graphiti/AGENTS.md · 186k | AGENTS.md | styleperformance | 66/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTautogpt_platform/frontend/AGENTS.md · 186k | AGENTS.md | setupbuildtestlint-format+7 | 96/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTautogpt_platform/frontend/src/tests/AGENTS.md · 186k | AGENTS.md | teststylearchtypes+2 | 81/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTclassic/CLAUDE.md · 186k | CLAUDE.md | setuptestlint-formatstyle+7 | 89/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTclassic/direct_benchmark/CLAUDE.md · 186k | CLAUDE.md | setuptestlint-formatarch+4 | 78/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTclassic/forge/CLAUDE.md · 186k | CLAUDE.md | teststylearchtypes+3 | 73/100 | 3 days ago | |
| Significant-Gravitas/AutoGPT.claude/skills/vercel-react-best-practices/AGENTS.md · 186k | AGENTS.md | buildlint-formatstyledependencies+4 | 61/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTclassic/original_autogpt/CLAUDE.md · 186k | CLAUDE.md | testarchuiperformance+2 | 90/100 | 3 days ago |
Diff against AGENTS.md Diff against autogpt_platform/AGENTS.md Diff against autogpt_platform/backend/AGENTS.md Diff against autogpt_platform/backend/backend/copilot/graphiti/AGENTS.md Diff against autogpt_platform/frontend/AGENTS.md Diff against autogpt_platform/frontend/src/tests/AGENTS.md Diff against classic/CLAUDE.md Diff against classic/direct_benchmark/CLAUDE.md Diff against classic/forge/CLAUDE.md Diff against .claude/skills/vercel-react-best-practices/AGENTS.md Diff against classic/original_autogpt/CLAUDE.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 63 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 3 days ago | |
| HerringtonDarkholme/megarepo.github/copilot-instructions.md · 17 | Copilot instructions | setupbuildtestlint-format+7 | 100/100 | 3 days ago | |
| pytorch/pytorch.github/copilot-instructions.md · 102k | Copilot instructions | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| bagisto/bagisto.github/copilot-instructions.md · 28k | Copilot instructions | setupbuildteststyle+5 | 97/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.github/copilot-instructions.md · 31k | Copilot instructions | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| hiyouga/LlamaFactory.github/copilot-instructions.md · 74k | Copilot instructions | setupbuildtestlint-format+5 | 97/100 | 2 days ago | |
| nerolis-lab/nerolis-lab.github/copilot-instructions.md · 32 | Copilot instructions | setupbuildtestlint-format+11 | 96/100 | 3 days ago |
