diff --git a/introduction/foundations/swekit.mdx b/introduction/foundations/swekit.mdx new file mode 100644 index 0000000..8b9ef04 --- /dev/null +++ b/introduction/foundations/swekit.mdx @@ -0,0 +1,161 @@ +--- +title: "Swe Kit" +sidebarTitle: "Swe Kit" +icon: "briefcase" +description: "This page provides basics of using SWE Kit to build, optimize, and benchmark Software Engineering agents with the Composio tooling ecosystem." +--- + + +## Introduction to Swe Kit +**SWE Kit** is a framework for building Software Engineering (SWE) agents using the Composio tooling ecosystem. SWE Kit allows you to: + +- Scaffold agents that work out-of-the-box with your chosen agentic framework (e.g., **crewai**, **llamaindex**). +- Add or optimize your agent's abilities using various tools. +- Benchmark your agents against **SWE-Bench**. + + +## How to get started? + +### Installation +Ensure Python 3.8 or higher is installed on your system. You need pip available to install packages from PyPI. + + + + + + + + ```bash Installing SWE Kit and Core Package + pip install swekit composio-core + ``` + + + + + + + + ```bash Composio-CrewAI installation + # Installation for CrewAI + pip install crewai composio-crewai + ``` + + + + + + + + ```bash Authenticate your Github Account + composio add github + ``` + + + + + + SWE Kit requires a GitHub access token to interact with your repositories. Create one [here](https://github.com/settings/tokens) with the necessary permissions and set it as an environment variable: + + + ```bash Export Github Access Token + export GITHUB_ACCESS_TOKEN= + ``` + + + + + + You need to setup API key for the LLM provider you're planning to use. By default the agents scaffolded by **swekit** uses **openai client**, but you can use any other llm too. + + + ```bash Export OpenAI API Key + export OPENAI_API_KEY= + ``` + + + + + + + +### Creating a New Agent +To scaffold a new agent, use the following command: + + + ```bash Scaffold a new agent using CrewAI + swekit scaffold crewai -o + ``` + + +This will create a new agent in `/agent` with four key files: + +- `main.py`: Entry point to run the agent on your issue. +- `agent.py`: Agent definition (customize this to change behavior). +- `prompts.py`: Agent prompts. +- `benchmark.py`: SWE-Bench benchmark runner. +- `inputs.py`: Handles user inputs, validating GitHub repository names and issues, and fetching issue details from GitHub. + + +### Run the Agent +Navigate to the agent directory and run the agent: + + + ```bash Run the agent + cd /agent + python main.py + ``` + + +You'll be prompted for the repository name and issue. + + +## Docker Environment +The SWE-agent runs in Docker by default for security and isolation, sandboxing the agent's operations to protect against unintended consequences of arbitrary code execution. + +To run the agent locally instead of in Docker, modify the `workspace_env` in `agent/agent.py`. + + + ```python agent/agent.py + # Change the workspace_env to ExecEnv.HOST to run the agent locally + composio_toolset = ComposioToolSet(workspace_env=ExecEnv.HOST) + ``` + + +Be cautious, as this bypasses Docker's protective layer. + + +## Running the Benchmark +[SWE-Bench](https://www.swebench.com/) is a comprehensive benchmark designed to evaluate the performance of software engineering agents. It includes a diverse collection of real-world issues from popular Python open-source projects, providing a robust testing environment. + +To run the benchmark: + + + + + Ensure Docker is installed and running on your system. + + + + + + ```bash Run the benchmark + cd /agent + python benchmark.py --test-split= + ``` + + + - By default, `python benchmark.py` runs only 1 test instance. + - Specify a test split ratio to run more tests, e.g., `--test-split=1:300` runs 300 tests. + + + + + +We use [SWE-Bench-Docker](https://github.com/aorwall/SWE-bench-docker) to ensure each test instance runs in an isolated container with its specific environment and Python version. + + +## Conclusion +SWE Kit is a powerful framework for building, optimizing, and benchmarking software engineering agents with ease. With tools for scaffolding, integrating with various frameworks, and performance testing, SWE Kit simplifies agent development and enhances productivity. + + + diff --git a/mint.json b/mint.json index 162c6ad..06f3163 100644 --- a/mint.json +++ b/mint.json @@ -61,17 +61,14 @@ "name": "SDK", "url": "sdk" }, - { "name": "Guides", "url": "patterns" }, - { "name": "Examples", "url": "guides" }, - { "name": "API", "url": "api-reference" @@ -146,7 +143,7 @@ "pages": [ "introduction/pricing/startups-program" ] - }, + }, { "group": "Python SDK", "pages": [ @@ -156,7 +153,7 @@ "sdk/python/local_tools" ] }, - { + { "group": "JS SDK", "pages": [ "sdk/javascript/introduction", @@ -177,36 +174,36 @@ { "group": "Guides", "pages": [ - { - "group": "Patterns", - "pages": [ - "patterns/functions/multiple-users", - "patterns/functions/triggers" - ] - }, - { - "group": "How Tos", - "pages": [ - "patterns/howtos/usecase", - "patterns/howtos/tool-finding", - "patterns/howtos/listing-connections" - ] - }, - { - "group": "Going to Production", - "pages": [ - "patterns/production-guide/prod" - ] - } - ] - }, + { + "group": "Patterns", + "pages": [ + "patterns/functions/multiple-users", + "patterns/functions/triggers" + ] + }, + { + "group": "How Tos", + "pages": [ + "patterns/howtos/usecase", + "patterns/howtos/tool-finding", + "patterns/howtos/listing-connections" + ] + }, + { + "group": "Going to Production", + "pages": [ + "patterns/production-guide/prod" + ] + } + ] + }, { "group": "Examples", "pages": [ "guides/examples/Example", - { - "group": "Python Guides", - "pages":[ + { + "group": "Python Guides", + "pages": [ "guides/python/investment-analyst", "guides/python/research-assistant", "guides/python/sql-agent", @@ -216,121 +213,120 @@ "guides/python/interpreter_agent", "guides/python/news-summary", "guides/python/calendar-agent" - ] - }, - { - "group":"Javascript Guides", - "pages":[ - "guides/javascript/interpreter-agent" - ] - } - ] + ] + }, + { + "group": "Javascript Guides", + "pages": [ + "guides/javascript/interpreter-agent" + ] + } + ] }, - { "group": "Tools", "pages": [ { - "group":"Apps", - "pages":[ - - "apps/accelo", - "apps/adobe", - "apps/amazon", - "apps/amplitude", - "apps/apify", - "apps/ashby", - "apps/asana", - "apps/atlassian", - "apps/attio", - "apps/auth0", - "apps/bamboohr", - "apps/battle-net", - "apps/bitbucket", - "apps/blackbaud", - "apps/boldsign", - "apps/box", - "apps/braintree", - "apps/calendly", - "apps/clickup", - "apps/close", - "apps/deel", - "apps/discord", - "apps/dropbox", - "apps/epic-games", - "apps/eventbrite", - "apps/facebook", - "apps/figma", - "apps/freshbooks", - "apps/freshdesk", - "apps/front", - "apps/github", - "apps/gitlab", - "apps/gmail", - "apps/google-calendar", - "apps/google-docs", - "apps/google-drive", - "apps/google-sheets", - "apps/gorgias", - "apps/gumroad", - "apps/guru", - "apps/hackerrank-work", - "apps/harvest", - "apps/heroku", - "apps/highlevel", - "apps/hubspot", - "apps/intercom", - "apps/jira", - "apps/keap", - "apps/klaviyo", - "apps/linkhut", - "apps/linear", - "apps/mailchimp", - "apps/miro", - "apps/mixpanel", - "apps/monday", - "apps/mural", - "apps/notion", - "apps/okta", - "apps/one-drive", - "apps/pagerduty", - "apps/pandadoc", - "apps/pipedrive", - "apps/reddit", - "apps/sage", - "apps/salesforce", - "apps/servicem8", - "apps/shopify", - "apps/slack", - "apps/smugmug", - "apps/splitwise", - "apps/spotify", - "apps/stack-exchange", - "apps/strava", - "apps/survey-monkey", - "apps/taskade", - "apps/timely", - "apps/todoist", - "apps/trello", - "apps/twitch", - "apps/twitter", - "apps/typeform", - "apps/wakatime", - "apps/wave-accounting", - "apps/workable", - "apps/xero", - "apps/yandex", - "apps/youtube", - "apps/zendesk", - "apps/zoho", - "apps/zoho-bigin", - "apps/zoho-books", - "apps/zoho-desk", - "apps/zoho-invoice", - "apps/zoho-inventory", - "apps/zoho-mail", - "apps/zoom" - ]}, + "group": "Apps", + "pages": [ + "apps/accelo", + "apps/adobe", + "apps/amazon", + "apps/amplitude", + "apps/apify", + "apps/ashby", + "apps/asana", + "apps/atlassian", + "apps/attio", + "apps/auth0", + "apps/bamboohr", + "apps/battle-net", + "apps/bitbucket", + "apps/blackbaud", + "apps/boldsign", + "apps/box", + "apps/braintree", + "apps/calendly", + "apps/clickup", + "apps/close", + "apps/deel", + "apps/discord", + "apps/dropbox", + "apps/epic-games", + "apps/eventbrite", + "apps/facebook", + "apps/figma", + "apps/freshbooks", + "apps/freshdesk", + "apps/front", + "apps/github", + "apps/gitlab", + "apps/gmail", + "apps/google-calendar", + "apps/google-docs", + "apps/google-drive", + "apps/google-sheets", + "apps/gorgias", + "apps/gumroad", + "apps/guru", + "apps/hackerrank-work", + "apps/harvest", + "apps/heroku", + "apps/highlevel", + "apps/hubspot", + "apps/intercom", + "apps/jira", + "apps/keap", + "apps/klaviyo", + "apps/linkhut", + "apps/linear", + "apps/mailchimp", + "apps/miro", + "apps/mixpanel", + "apps/monday", + "apps/mural", + "apps/notion", + "apps/okta", + "apps/one-drive", + "apps/pagerduty", + "apps/pandadoc", + "apps/pipedrive", + "apps/reddit", + "apps/sage", + "apps/salesforce", + "apps/servicem8", + "apps/shopify", + "apps/slack", + "apps/smugmug", + "apps/splitwise", + "apps/spotify", + "apps/stack-exchange", + "apps/strava", + "apps/survey-monkey", + "apps/taskade", + "apps/timely", + "apps/todoist", + "apps/trello", + "apps/twitch", + "apps/twitter", + "apps/typeform", + "apps/wakatime", + "apps/wave-accounting", + "apps/workable", + "apps/xero", + "apps/yandex", + "apps/youtube", + "apps/zendesk", + "apps/zoho", + "apps/zoho-bigin", + "apps/zoho-books", + "apps/zoho-desk", + "apps/zoho-invoice", + "apps/zoho-inventory", + "apps/zoho-mail", + "apps/zoom" + ] + }, { "group": "Usecases", "pages": [ @@ -533,8 +529,8 @@ ] }, { - "group":"Autogen", - "pages":[ + "group": "Autogen", + "pages": [ "apps/usecases/autogen_blogs/ably", "apps/usecases/autogen_blogs/active-compaign", "apps/usecases/autogen_blogs/adobe", @@ -731,8 +727,8 @@ ] }, { - "group":"Crewai", - "pages":[ + "group": "Crewai", + "pages": [ "apps/usecases/crewai/ably", "apps/usecases/crewai/accelo", "apps/usecases/crewai/active-compaign", @@ -1008,4 +1004,4 @@ "mode": "show" } } -} +} \ No newline at end of file