A collection of three serverless agents built with Agentuity, Composio and custom tools to synchronize data between Clerk, SmartLead and Stripe webhooks and your Attio CRM instance.
This repository contains three webhook‑driven agents:
- Clerk Agent: syncs new users and org updates from Clerk into Attio.
- SmartLead Agent: tracks lead category changes and email replies from SmartLead into Attio.
- Stripe Agent: listens for
charge.succeededevents and updates a company’s credit balance in Attio.
All agents use the shared createAgent template in src/lib/agent.ts, Composio toolkits for Attio operations, and custom executors where needed.
- Clone the repo:
git clone https://github.com/your-org/attio-crm-agents.git cd attio-crm-agents - Install dependencies:
npm install
- Copy the example env file:
cp .env.example .env - Open .env and set:
COMPOSIO_API_KEY=your_composio_api_key STRIPE_API_KEY=sk_live_… STRIPE_SIGNING_SECRET=whsec_… SMARTLEAD_API_KEY=your_smartlead_api_key
.
├── src
│ ├── agents
│ ├── clerk-agent
│ ├── smartlead-agent
│ └── stripe-agent
└── lib
│ └── agent.ts # Shared createAgent template
├── .env.example
├── package.json
└── README.md
- File:
src/agents/clerkAgent.ts - Purpose:
- On user.created: find or create a Person in Attio, then find or create their Company.
- On organization.created/updated: find existing company and update its org_id and/or name per rules.
- File:
src/agents/smartlead-agent/index.ts - Purpose:
- On
LEAD_CATEGORY_UPDATED:- find or create Person and Company, then create a Deal.
- Add them to the positive_leads KV.
- On
EMAIL_REPLY:- check if the email is in the archive KV.
- If the email is in the archive, ping the relevant person in Slack.
- If the email is not in the archive, store the email in the emails KV.
- On
- File:
src/agents/email-handler-agent/index.ts - Purpose:
- Once a day:
- Go through positive_leads KV and pull the associated emails from the emails KV.
- If the email is simple, send an auto-reply.
- If the email is complex, ping the relevant person in Slack.
- Add the email to the archive KV.
- Clear the positive_leads KV.
- Once a day:
- File:
src/agents/stripeAgent.ts - Purpose:
- Verify
charge.succeededwebhooks. - Use getOrgIdFromCustomer,
ATTIO_FIND_RECORD,latestAttioNumber,ATTIO_UPDATE_RECORDto update credits.
- Verify
- Features: missing credits default to zero, judge loop to enforce single-tool usage.
Before you begin, ensure you have the following installed:
- Bun: Version 1.2.4 or higher
Before using Agentuity, you need to authenticate:
agentuity loginThis command will open a browser window where you can log in to your Agentuity account.
To create a new agent in your project:
agentuity agent newFollow the interactive prompts to configure your agent.
Run your project in development mode with:
agentuity devThis will start your project and open a new browser window connecting your agent to the Agentuity Console in DevMode, allowing you to test and debug your agent in real-time.
When you're ready to deploy your agent to the Agentuity Cloud:
agentuity deployThis command will bundle your agent and deploy it to the cloud, making it accessible via the Agentuity platform.
├── agents/ # Agent definitions and implementations
├── node_modules/ # Dependencies
├── package.json # Project dependencies and scripts
└── agentuity.yaml # Agentuity project configuration
Your project configuration is stored in agentuity.yaml. This file defines your agents, development settings, and deployment configuration.
You can set environment variables for your project:
agentuity env set KEY VALUEFor sensitive information, use secrets:
agentuity env set --secret KEY VALUEFor comprehensive documentation on the Agentuity JavaScript SDK, visit: https://agentuity.dev/SDKs/javascript
If you encounter any issues:
- Check the documentation
- Join our Discord community for support
- Contact the Agentuity support team
This project is licensed under the terms specified in the LICENSE file.
