{"id":30696099,"url":"https://github.com/cometchat/ai-agent-mastra-examples","last_synced_at":"2025-09-02T07:35:36.482Z","repository":{"id":312725478,"uuid":"1040698926","full_name":"cometchat/ai-agent-mastra-examples","owner":"cometchat","description":"Starter templates to accelerate AI agent development on CometChat.","archived":false,"fork":false,"pushed_at":"2025-09-01T15:14:17.000Z","size":171,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-01T17:25:37.457Z","etag":null,"topics":["ai","ai-agents","chat","chatbot"],"latest_commit_sha":null,"homepage":"https://www.cometchat.com/docs/ai-agents","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cometchat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-19T11:25:52.000Z","updated_at":"2025-09-01T15:14:20.000Z","dependencies_parsed_at":"2025-09-01T17:26:44.080Z","dependency_job_id":"af46794f-7b71-4d6d-a5bd-78d380edfee5","html_url":"https://github.com/cometchat/ai-agent-mastra-examples","commit_stats":null,"previous_names":["cometchat/ai-agent-mastra-examples"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cometchat/ai-agent-mastra-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometchat%2Fai-agent-mastra-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometchat%2Fai-agent-mastra-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometchat%2Fai-agent-mastra-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometchat%2Fai-agent-mastra-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cometchat","download_url":"https://codeload.github.com/cometchat/ai-agent-mastra-examples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cometchat%2Fai-agent-mastra-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273250380,"owners_count":25072167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-agents","chat","chatbot"],"created_at":"2025-09-02T07:35:31.176Z","updated_at":"2025-09-02T07:35:36.457Z","avatar_url":"https://github.com/cometchat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mastra AI Agent Examples\n\nThis repository contains four Mastra-based AI agent examples integrated with CometChat. Each folder is a self-contained sample you can run locally and wire to CometChat AI Agents.\n\n## Repository structure\n\n- `mastra-knowledge-agent/` — Retrieval-augmented agent that answers from your docs with citations\n- `mastra-frontend-actions-agent/` — Agent that triggers UI actions (e.g., confetti) via frontend tools\n- `mastra-backend-tools-agent/` — Agent that performs secure server-side actions using tools\n- `mastra-orchestrator-agent/` — Orchestrator that routes to specialist agents\n\n## Prerequisites\n\n- Node.js installed\n- A Mastra project (or use these samples directly)\n- CometChat app\n- Environment: `.env` with `OPENAI_API_KEY` in each sample directory (copy from `.env.example` if present)\n\n## Quickstart (any sample)\n\n1. Change directory into a sample, install dependencies, and start the dev server:\n\n```bash\ncd \u003cone-of-the-sample-folders\u003e\nnpm install\nnpx mastra dev\n```\n\n1. Hit the sample's API using the curl commands in its README, or open the local Swagger UI at:\n\n[http://localhost:4111/swagger-ui](http://localhost:4111/swagger-ui)\n\n1. Connect to CometChat: Dashboard → AI Agents → Add Agent → Provider = Mastra. Use the sample's `Agent ID` and public `Deployment URL` for its `/api/agents/\u003cname\u003e/generate` endpoint.\n\n## Samples overview\n\n### Knowledge Agent\n\nAnswers documentation questions using only ingested sources and includes short citations.\n\n- Folder: `mastra-knowledge-agent/`\n- Key endpoints: `/api/tools/ingestSources`, `/api/tools/searchDocs`, `/api/agents/knowledge/generate`\n- Docs: [Build Your Knowledge Agent with Mastra](https://www.cometchat.com/docs/ai-agents/mastra-knowledge-agent)\n\n### Frontend Actions Agent\n\nReturns safe, structured tool calls for the browser to run UI effects (e.g., confetti).\n\n- Folder: `mastra-frontend-actions-agent/`\n- Key endpoint: `/api/agents/celebration/generate`\n- Docs: [Build Your Frontend Actions Agent with Mastra](https://www.cometchat.com/docs/ai-agents/mastra-frontend-actions-agent)\n\n### Backend Tools Agent\n\nInvokes secure server-side tools (e.g., deals API) and summarizes results for chat.\n\n- Folder: `mastra-backend-tools-agent/`\n- Key endpoint: `/api/agents/deals/generate`\n- Docs: [Build Your Backend Tools Agent with Mastra](https://www.cometchat.com/docs/ai-agents/mastra-backend-tools-agent)\n\n### Orchestrator Agent\n\nClassifies intent and routes to specialist agents (billing, support, tech support, manager, human rep).\n\n- Folder: `mastra-orchestrator-agent/`\n- Key endpoint: `/api/agents/orchestratorAgent/generate`\n- Docs: [Build Your Orchestrator Agent with Mastra](https://www.cometchat.com/docs/ai-agents/mastra-orchestrator-agent)\n\n## Common tips\n\n- Each sample may define its own scripts and structure; refer to its README for exact steps.\n- Protect public endpoints with auth and CORS; keep API keys server-side only.\n- Use the local Swagger UI to explore and test endpoints during development.\n\n## Troubleshooting\n\n- 404 for `/api/agents/\u003cname\u003e/generate`: ensure the agent is registered with the expected key.\n- No tool/action triggered: verify tool registration and that the client or server is handling tool calls.\n- Empty retrievals (Knowledge): verify ingestion and that `knowledge/\u003cnamespace\u003e` contains parsed content.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcometchat%2Fai-agent-mastra-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcometchat%2Fai-agent-mastra-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcometchat%2Fai-agent-mastra-examples/lists"}