Initialize github sandbox with data
curl --request POST \
--url https://api.klavis.ai/sandbox/github/{sandbox_id}/initialize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"repos": [
{
"name": "test-repo",
"description": "A test repository for GitHub sandbox",
"branches": [
{
"name": "main",
"folders": {
"name": "root",
"path": "",
"files": [
{
"name": "README.md",
"path": "README.md",
"content": "# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs"
}
],
"folders": [
{
"name": "src",
"path": "src",
"files": [
{
"name": "main.py",
"path": "src/main.py",
"content": "def main():\n print('Hello, GitHub Sandbox!')\n\nif __name__ == '__main__':\n main()"
}
],
"folders": []
}
]
}
},
{
"name": "feature-branch",
"folders": {
"name": "root",
"path": "",
"files": [
{
"name": "README.md",
"path": "README.md",
"content": "# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs\n- New feature in development"
}
],
"folders": [
{
"name": "src",
"path": "src",
"files": [
{
"name": "main.py",
"path": "src/main.py",
"content": "def main():\n print('Hello, GitHub Sandbox!')\n print('New feature added!')\n\nif __name__ == '__main__':\n main()"
},
{
"name": "feature.py",
"path": "src/feature.py",
"content": "def new_feature():\n return 'This is a new feature'\n"
}
],
"folders": []
}
]
}
}
],
"issues": [
{
"issue_title": "Sample issue for testing",
"description": "This is a test issue created for GitHub sandbox testing.\n\n## Description\nWe should implement feature X.\n\n## Steps\n1. Plan the feature\n2. Implement the code\n3. Write tests",
"status": "open",
"labels": [
"bug",
"enhancement"
]
}
],
"prs": [
{
"pr_title": "Add new feature",
"description": "This PR adds a new feature to the repository.\n\n## Changes\n- Added new functionality\n- Updated documentation\n- Added tests",
"status": "open",
"source_branch": "feature-branch",
"target_branch": "main",
"labels": [
"enhancement"
]
}
]
}
]
}
EOFimport requests
url = "https://api.klavis.ai/sandbox/github/{sandbox_id}/initialize"
payload = { "repos": [
{
"name": "test-repo",
"description": "A test repository for GitHub sandbox",
"branches": [
{
"name": "main",
"folders": {
"name": "root",
"path": "",
"files": [
{
"name": "README.md",
"path": "README.md",
"content": "# Test Repository
This is a test repository for the GitHub sandbox.
## Features
- Test files
- Test folders
- Sample issues and PRs"
}
],
"folders": [
{
"name": "src",
"path": "src",
"files": [
{
"name": "main.py",
"path": "src/main.py",
"content": "def main():
print('Hello, GitHub Sandbox!')
if __name__ == '__main__':
main()"
}
],
"folders": []
}
]
}
},
{
"name": "feature-branch",
"folders": {
"name": "root",
"path": "",
"files": [
{
"name": "README.md",
"path": "README.md",
"content": "# Test Repository
This is a test repository for the GitHub sandbox.
## Features
- Test files
- Test folders
- Sample issues and PRs
- New feature in development"
}
],
"folders": [
{
"name": "src",
"path": "src",
"files": [
{
"name": "main.py",
"path": "src/main.py",
"content": "def main():
print('Hello, GitHub Sandbox!')
print('New feature added!')
if __name__ == '__main__':
main()"
},
{
"name": "feature.py",
"path": "src/feature.py",
"content": "def new_feature():
return 'This is a new feature'
"
}
],
"folders": []
}
]
}
}
],
"issues": [
{
"issue_title": "Sample issue for testing",
"description": "This is a test issue created for GitHub sandbox testing.
## Description
We should implement feature X.
## Steps
1. Plan the feature
2. Implement the code
3. Write tests",
"status": "open",
"labels": ["bug", "enhancement"]
}
],
"prs": [
{
"pr_title": "Add new feature",
"description": "This PR adds a new feature to the repository.
## Changes
- Added new functionality
- Updated documentation
- Added tests",
"status": "open",
"source_branch": "feature-branch",
"target_branch": "main",
"labels": ["enhancement"]
}
]
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repos: [
{
name: 'test-repo',
description: 'A test repository for GitHub sandbox',
branches: [
{
name: 'main',
folders: {
name: 'root',
path: '',
files: [
{
name: 'README.md',
path: 'README.md',
content: '# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs'
}
],
folders: [
{
name: 'src',
path: 'src',
files: [
{
name: 'main.py',
path: 'src/main.py',
content: 'def main():\n print(\'Hello, GitHub Sandbox!\')\n\nif __name__ == \'__main__\':\n main()'
}
],
folders: []
}
]
}
},
{
name: 'feature-branch',
folders: {
name: 'root',
path: '',
files: [
{
name: 'README.md',
path: 'README.md',
content: '# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs\n- New feature in development'
}
],
folders: [
{
name: 'src',
path: 'src',
files: [
{
name: 'main.py',
path: 'src/main.py',
content: 'def main():\n print(\'Hello, GitHub Sandbox!\')\n print(\'New feature added!\')\n\nif __name__ == \'__main__\':\n main()'
},
{
name: 'feature.py',
path: 'src/feature.py',
content: 'def new_feature():\n return \'This is a new feature\'\n'
}
],
folders: []
}
]
}
}
],
issues: [
{
issue_title: 'Sample issue for testing',
description: 'This is a test issue created for GitHub sandbox testing.\n\n## Description\nWe should implement feature X.\n\n## Steps\n1. Plan the feature\n2. Implement the code\n3. Write tests',
status: 'open',
labels: ['bug', 'enhancement']
}
],
prs: [
{
pr_title: 'Add new feature',
description: 'This PR adds a new feature to the repository.\n\n## Changes\n- Added new functionality\n- Updated documentation\n- Added tests',
status: 'open',
source_branch: 'feature-branch',
target_branch: 'main',
labels: ['enhancement']
}
]
}
]
})
};
fetch('https://api.klavis.ai/sandbox/github/{sandbox_id}/initialize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repos: [
{
name: 'test-repo',
description: 'A test repository for GitHub sandbox',
branches: [
{
name: 'main',
folders: {
name: 'root',
path: '',
files: [
{
name: 'README.md',
path: 'README.md',
content: '# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs'
}
],
folders: [
{
name: 'src',
path: 'src',
files: [
{
name: 'main.py',
path: 'src/main.py',
content: 'def main():\n print(\'Hello, GitHub Sandbox!\')\n\nif __name__ == \'__main__\':\n main()'
}
],
folders: []
}
]
}
},
{
name: 'feature-branch',
folders: {
name: 'root',
path: '',
files: [
{
name: 'README.md',
path: 'README.md',
content: '# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs\n- New feature in development'
}
],
folders: [
{
name: 'src',
path: 'src',
files: [
{
name: 'main.py',
path: 'src/main.py',
content: 'def main():\n print(\'Hello, GitHub Sandbox!\')\n print(\'New feature added!\')\n\nif __name__ == \'__main__\':\n main()'
},
{
name: 'feature.py',
path: 'src/feature.py',
content: 'def new_feature():\n return \'This is a new feature\'\n'
}
],
folders: []
}
]
}
}
],
issues: [
{
issue_title: 'Sample issue for testing',
description: 'This is a test issue created for GitHub sandbox testing.\n\n## Description\nWe should implement feature X.\n\n## Steps\n1. Plan the feature\n2. Implement the code\n3. Write tests',
status: 'open',
labels: ['bug', 'enhancement']
}
],
prs: [
{
pr_title: 'Add new feature',
description: 'This PR adds a new feature to the repository.\n\n## Changes\n- Added new functionality\n- Updated documentation\n- Added tests',
status: 'open',
source_branch: 'feature-branch',
target_branch: 'main',
labels: ['enhancement']
}
]
}
]
})
};
fetch('https://api.klavis.ai/sandbox/github/{sandbox_id}/initialize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"sandbox_id": "<string>",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}GitHub
Initialize github sandbox with data
Initialize the sandbox with github-specific data following the defined schema.
POST
/
sandbox
/
github
/
{sandbox_id}
/
initialize
Initialize github sandbox with data
curl --request POST \
--url https://api.klavis.ai/sandbox/github/{sandbox_id}/initialize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"repos": [
{
"name": "test-repo",
"description": "A test repository for GitHub sandbox",
"branches": [
{
"name": "main",
"folders": {
"name": "root",
"path": "",
"files": [
{
"name": "README.md",
"path": "README.md",
"content": "# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs"
}
],
"folders": [
{
"name": "src",
"path": "src",
"files": [
{
"name": "main.py",
"path": "src/main.py",
"content": "def main():\n print('Hello, GitHub Sandbox!')\n\nif __name__ == '__main__':\n main()"
}
],
"folders": []
}
]
}
},
{
"name": "feature-branch",
"folders": {
"name": "root",
"path": "",
"files": [
{
"name": "README.md",
"path": "README.md",
"content": "# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs\n- New feature in development"
}
],
"folders": [
{
"name": "src",
"path": "src",
"files": [
{
"name": "main.py",
"path": "src/main.py",
"content": "def main():\n print('Hello, GitHub Sandbox!')\n print('New feature added!')\n\nif __name__ == '__main__':\n main()"
},
{
"name": "feature.py",
"path": "src/feature.py",
"content": "def new_feature():\n return 'This is a new feature'\n"
}
],
"folders": []
}
]
}
}
],
"issues": [
{
"issue_title": "Sample issue for testing",
"description": "This is a test issue created for GitHub sandbox testing.\n\n## Description\nWe should implement feature X.\n\n## Steps\n1. Plan the feature\n2. Implement the code\n3. Write tests",
"status": "open",
"labels": [
"bug",
"enhancement"
]
}
],
"prs": [
{
"pr_title": "Add new feature",
"description": "This PR adds a new feature to the repository.\n\n## Changes\n- Added new functionality\n- Updated documentation\n- Added tests",
"status": "open",
"source_branch": "feature-branch",
"target_branch": "main",
"labels": [
"enhancement"
]
}
]
}
]
}
EOFimport requests
url = "https://api.klavis.ai/sandbox/github/{sandbox_id}/initialize"
payload = { "repos": [
{
"name": "test-repo",
"description": "A test repository for GitHub sandbox",
"branches": [
{
"name": "main",
"folders": {
"name": "root",
"path": "",
"files": [
{
"name": "README.md",
"path": "README.md",
"content": "# Test Repository
This is a test repository for the GitHub sandbox.
## Features
- Test files
- Test folders
- Sample issues and PRs"
}
],
"folders": [
{
"name": "src",
"path": "src",
"files": [
{
"name": "main.py",
"path": "src/main.py",
"content": "def main():
print('Hello, GitHub Sandbox!')
if __name__ == '__main__':
main()"
}
],
"folders": []
}
]
}
},
{
"name": "feature-branch",
"folders": {
"name": "root",
"path": "",
"files": [
{
"name": "README.md",
"path": "README.md",
"content": "# Test Repository
This is a test repository for the GitHub sandbox.
## Features
- Test files
- Test folders
- Sample issues and PRs
- New feature in development"
}
],
"folders": [
{
"name": "src",
"path": "src",
"files": [
{
"name": "main.py",
"path": "src/main.py",
"content": "def main():
print('Hello, GitHub Sandbox!')
print('New feature added!')
if __name__ == '__main__':
main()"
},
{
"name": "feature.py",
"path": "src/feature.py",
"content": "def new_feature():
return 'This is a new feature'
"
}
],
"folders": []
}
]
}
}
],
"issues": [
{
"issue_title": "Sample issue for testing",
"description": "This is a test issue created for GitHub sandbox testing.
## Description
We should implement feature X.
## Steps
1. Plan the feature
2. Implement the code
3. Write tests",
"status": "open",
"labels": ["bug", "enhancement"]
}
],
"prs": [
{
"pr_title": "Add new feature",
"description": "This PR adds a new feature to the repository.
## Changes
- Added new functionality
- Updated documentation
- Added tests",
"status": "open",
"source_branch": "feature-branch",
"target_branch": "main",
"labels": ["enhancement"]
}
]
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repos: [
{
name: 'test-repo',
description: 'A test repository for GitHub sandbox',
branches: [
{
name: 'main',
folders: {
name: 'root',
path: '',
files: [
{
name: 'README.md',
path: 'README.md',
content: '# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs'
}
],
folders: [
{
name: 'src',
path: 'src',
files: [
{
name: 'main.py',
path: 'src/main.py',
content: 'def main():\n print(\'Hello, GitHub Sandbox!\')\n\nif __name__ == \'__main__\':\n main()'
}
],
folders: []
}
]
}
},
{
name: 'feature-branch',
folders: {
name: 'root',
path: '',
files: [
{
name: 'README.md',
path: 'README.md',
content: '# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs\n- New feature in development'
}
],
folders: [
{
name: 'src',
path: 'src',
files: [
{
name: 'main.py',
path: 'src/main.py',
content: 'def main():\n print(\'Hello, GitHub Sandbox!\')\n print(\'New feature added!\')\n\nif __name__ == \'__main__\':\n main()'
},
{
name: 'feature.py',
path: 'src/feature.py',
content: 'def new_feature():\n return \'This is a new feature\'\n'
}
],
folders: []
}
]
}
}
],
issues: [
{
issue_title: 'Sample issue for testing',
description: 'This is a test issue created for GitHub sandbox testing.\n\n## Description\nWe should implement feature X.\n\n## Steps\n1. Plan the feature\n2. Implement the code\n3. Write tests',
status: 'open',
labels: ['bug', 'enhancement']
}
],
prs: [
{
pr_title: 'Add new feature',
description: 'This PR adds a new feature to the repository.\n\n## Changes\n- Added new functionality\n- Updated documentation\n- Added tests',
status: 'open',
source_branch: 'feature-branch',
target_branch: 'main',
labels: ['enhancement']
}
]
}
]
})
};
fetch('https://api.klavis.ai/sandbox/github/{sandbox_id}/initialize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repos: [
{
name: 'test-repo',
description: 'A test repository for GitHub sandbox',
branches: [
{
name: 'main',
folders: {
name: 'root',
path: '',
files: [
{
name: 'README.md',
path: 'README.md',
content: '# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs'
}
],
folders: [
{
name: 'src',
path: 'src',
files: [
{
name: 'main.py',
path: 'src/main.py',
content: 'def main():\n print(\'Hello, GitHub Sandbox!\')\n\nif __name__ == \'__main__\':\n main()'
}
],
folders: []
}
]
}
},
{
name: 'feature-branch',
folders: {
name: 'root',
path: '',
files: [
{
name: 'README.md',
path: 'README.md',
content: '# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs\n- New feature in development'
}
],
folders: [
{
name: 'src',
path: 'src',
files: [
{
name: 'main.py',
path: 'src/main.py',
content: 'def main():\n print(\'Hello, GitHub Sandbox!\')\n print(\'New feature added!\')\n\nif __name__ == \'__main__\':\n main()'
},
{
name: 'feature.py',
path: 'src/feature.py',
content: 'def new_feature():\n return \'This is a new feature\'\n'
}
],
folders: []
}
]
}
}
],
issues: [
{
issue_title: 'Sample issue for testing',
description: 'This is a test issue created for GitHub sandbox testing.\n\n## Description\nWe should implement feature X.\n\n## Steps\n1. Plan the feature\n2. Implement the code\n3. Write tests',
status: 'open',
labels: ['bug', 'enhancement']
}
],
prs: [
{
pr_title: 'Add new feature',
description: 'This PR adds a new feature to the repository.\n\n## Changes\n- Added new functionality\n- Updated documentation\n- Added tests',
status: 'open',
source_branch: 'feature-branch',
target_branch: 'main',
labels: ['enhancement']
}
]
}
]
})
};
fetch('https://api.klavis.ai/sandbox/github/{sandbox_id}/initialize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"sandbox_id": "<string>",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Your Klavis AI API key.
Path Parameters
The unique sandbox identifier
Query Parameters
If true, use default test data for initialization
Body
application/json
Complete GitHub sandbox data structure
List of repositories
Show child attributes
Show child attributes
⌘I
