A TypeScript-based agent built using Bhindi.io specification.
Brewit provides crypto accounts for individuals and teams. Using the Brewit agent, users can interact and perform crypto transactions on their Brewit account
Bhindi lets you talk to your apps like you talk to a friend. Bhindi supports 100+ integrations and is the easiest way to build AI agents.
Check a list of integrations available at Bhindi Agents Directory
For comprehensive documentation on building agents, visit the Bhindi Documentation.
Checkout Brewit Documentation to add features to agent.
- Token Swaps: Swap between different tokens on any supported chain
- Multi-Transfer Support: Send single or multiple token transfers in a single transaction
- Confirmation required: User confirmation for all token operations
- Cross-chain Support: Works with multiple blockchain networks
| Tool | Description | Special Features |
|---|---|---|
swap |
Swap tokens from one token to another on any chain | confirmationRequired: true |
send |
Send single or multiple token transfers in a single transaction | confirmationRequired: true |
toToken(string): The token address to swap tofromToken(string): The token address to swap fromamount(string): The amount of tokens to swap
transfers(array): Array of token transfers to executetoAddress(string): The recipient address to send tokens toamount(string): The amount of token to sendtoken(string): The token address to send
npm installnpm run buildnpm start
# or for development with auto-reload:
npm run dev# Get available tools
curl -X GET "http://localhost:3000/tools"
# Test token swap
curl -X POST "http://localhost:3000/tools/swap" \
-H "Content-Type: application/json" \
-H "x-agent-delegation-key: your-delegation-key" \
-d '{
"toToken": "0xA0b86a33E6441b8c4C8C0C4C0C4C0C4C0C4C0C4C",
"fromToken": "0x0000000000000000000000000000000000000000",
"amount": "1.0"
}'
# Test multi-token send
curl -X POST "http://localhost:3000/tools/send" \
-H "Content-Type: application/json" \
-H "x-agent-delegation-key: your-delegation-key" \
-d '{
"transfers": [
{
"toAddress": "0x1234567890123456789012345678901234567890",
"amount": "100",
"token": "0xA0b86a33E6441b8c4C8C0C4C0C4C0C4C0C4C0C4C"
}
]
}'# Token Swap
curl -X POST "http://localhost:3000/tools/swap" \
-H "Content-Type: application/json" \
-H "x-agent-delegation-key: your-delegation-key" \
-d '{
"toToken": "0xA0b86a33E6441b8c4C8C0C4C0C4C0C4C0C4C0C4C",
"fromToken": "0x0000000000000000000000000000000000000000",
"amount": "1.0"
}'
# Single Token Transfer
curl -X POST "http://localhost:3000/tools/send" \
-H "Content-Type: application/json" \
-H "x-agent-delegation-key: your-delegation-key" \
-d '{
"transfers": [
{
"toAddress": "0x1234567890123456789012345678901234567890",
"amount": "100",
"token": "0xA0b86a33E6441b8c4C8C0C4C0C4C0C4C0C4C0C4C"
}
]
}'
# Multiple Token Transfers (Batch)
curl -X POST "http://localhost:3000/tools/send" \
-H "Content-Type: application/json" \
-H "x-agent-delegation-key: your-delegation-key" \
-d '{
"transfers": [
{
"toAddress": "0x1234567890123456789012345678901234567890",
"amount": "100",
"token": "0xA0b86a33E6441b8c4C8C0C4C0C4C0C4C0C4C0C4C"
},
{
"toAddress": "0x0987654321098765432109876543210987654321",
"amount": "50",
"token": "0x0000000000000000000000000000000000000000"
}
]
}'
# Expected response:
{
"success": true,
"responseType": "mixed",
"data": {
"result": "Transaction hash or result data",
"message": "Successfully executed swap operation",
"tool_type": "brewit"
}
}This agent requires authentication for all tool operations:
- x-agent-delegation-key: Required header for all tool execution requests
- The agent automatically verifies the delegation key and retrieves:
- Validator Salt: For transaction validation
- Account Address: For transaction execution
- Chain IDs: Supported blockchain networks
GET /- Landing page (serves README.md content)GET /tools- Get list of available toolsPOST /tools/:toolName- Execute a specific tool (requires x-agent-delegation-key header)GET /health- Health check endpointGET /docs- Swagger UI documentation (servespublic/swagger.json)GET /info- Get account information and validator configuration
- Complete API Examples - Detailed usage examples for all tools with curl commands
- Swagger Documentation - Available at
/docsendpoint when server is running - Postman Collection - Import
Bhind-Agent-Starter.postman_collection.jsonfor easy testing
src/
โโโ config/
โ โโโ tools.json # Tool definitions with JSON Schema
โโโ controllers/
โ โโโ appController.ts # Handles token operations
โโโ services/
โ โโโ BrewitService.ts # Brewit Money API integration
โโโ routes/
โ โโโ toolsRoutes.ts # GET /tools endpoint
โ โโโ appRoutes.ts # POST /tools/:toolName endpoint
โโโ middlewares/
โ โโโ auth.ts # Authentication utilities
โ โโโ errorHandler.ts # Error handling middleware
โโโ types/
โ โโโ agent.ts # Response type definitions
โโโ __tests__/ # Test files
โโโ app.ts # Express app configuration
โโโ server.ts # Server entry point
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Lint code
npm run lint
# Format code
npm run format
# Development server with auto-reload
npm run dev