Cursor AI
Getting started with Cursor.
Why Use Cursor
Cursor simplifies AI agent development by reducing the feedback loop on AI-generated code. This enables faster iteration and provides an optimal balance between manual control and AI assistance.
What are Cursor Rules
Cursor Rules are custom instructions that tell Cursor how to work with your code. Agency has a predefined .cursorrules
file that contains everything that Cursor needs to know in order to create agents with this framework.
Getting Started with Cursor
Follow these steps to create your first Agency using Cursor:
Enable Cursor Rules in Settings
First, you need to enable Cursor Rules in the Cursor IDE:
- Open the Cursor IDE.
- Go to Settings… > Cursor Settings.
- Turn on the Rules for AI option. This allows you to use a
.cursorrules
file in your project.
Add The `.cursorrules` File to Your Project
The .cursorrules
file contains the instructions that guide Cursor’s AI. To add it:
- Download the
.cursorrules
file from the Agency Swarm repository. - Place the file in the main folder (root directory) of your project.
Open Cursor Composer
Cursor Composer allows you to create and modify multiple files in parallel.
- Open Composer by pressing
Cmd+I
(macOS) orCtrl+I
(Windows/Linux).
Send Your First Prompt to Composer
Spend as much time as possible on your first prompt. This will save you a lot of time later. Make sure to include:
- All agents that you want to create
- All tools and APIs that the agents must use
- Communication flows between your agents
Verify The Agency Structure
Sometimes Cursor forgets certain files or hallucinates the agency structure. Make sure to verify that:
- All import statements are correct
requirements.txt
file existsagency.py
file executes properly
If any of these are missing or not working, instruct composer to create them or fix the code.
Adjust the Tools
Run each tool file to make sure they work as expected. You will see the test cases that Cursor created at the bottom in if __name__ == "__main__"
statements.
- If any of the tools are not working, send the error message to composer and ask it to fix the code.
- If you want to adjust the functionality of the tool, either use inline editing
Cmd+K
(macOS) orCtrl+K
(Windows/Linux) or send another message to composer. - If you are stuck, use Chat
Cmd+L
(macOS) orCtrl+L
(Windows/Linux) to ask questions and brainstorm alternative approaches. For example, ask “What other APIs can I use for this tool?”
Adjust the Agents
Verify the agent instructions and parameters are correct after adjustments. Actually think about instructions.
- Use Chat or Inline Editing to adjust the
instruction.md
files to your needs. - Edit instructions manually and remove all boilerplate text.
- Make sure each agent has access to all the new tools either by specifying
tools_folder
path or adding them intools
parameter.
Test Your Agency
Run agency.py
file to see if it works.
- Send a realistic task to your agency and see if it can complete it.
- If it doesn’t work as expected, try to send additional messages with more details and see if it helps.
- Use these extra messages to guide yourself on how to adjust the instructions, so it can complete it next time.
Repeat
Iterate on your agency by repeating the process until you are satisfied with the results.
Agent Development is an Iterative Process
Currently, agent development requires ongoing monitoring and adjustments to ensure desired performance. As larger and more advanced models become available, this process will become more streamlined.
Next Steps
- Learn the core concepts of Tools, Agents, and Agencies.
- Watch the Deployment Tutorial.