Sign in

Expert in handling Thanos API interactions for querying metrics, listing series, and inspecting labels

Expert in handling Promtheus API interactions for querying metrics, listing series, and inspecting labels

What is an "Expert"? How do we create our own expert?

Add Jenkins credentials

Add a key-value pair

Add credentials for various integrations

Add AWS credentials

Add Jira credentials

Add Slack credentials

Add Grafana credentials

Add Azure credentials

Add GitHub credentials

Process Grafana Alerts

Managing workspaces and access control

DagKnows Architecture Overview

Managing Proxies

Setting up SSO via Azure AD for Dagknows

All the experts

Enable "Auto Exec" and "Send Execution Result to LLM" in "Adjust Settings" if desired

(Optionally) Add ubuntu user to docker group and refresh group membership

Deployment of an EKS Cluster with Worker Nodes in AWS

Adding, Deleting, Listing DagKnows Proxy credentials or key-value pairs

Kubernetes pod issue

Comprehensive AWS Security and Compliance Evaluation Workflow (SOC2 Super Runbook)

AWS EKS Version Update 1.29 to 1.30 via terraform

Instruction to allow WinRM connection

MSP Usecase: User Onboarding Azure + M365

Post a message to a Slack channel

How to debug a kafka cluster and kafka topics?

Docusign Integration Tasks

Open VPN Troubleshooting (Powershell)

Execute a simple task on the proxy

Assign the proxy role to a user

Create roles to access credentials in proxy

Install OpenVPN client on Windows laptop

Setup Kubernetes kubectl and Minikube on Ubuntu 22.04 LTS

Install Prometheus and Grafana on the minikube cluster on EC2 instance in the monitoring namespace

Sample selenium script

update the EKS versions in different clusters

AI agent session 2024-09-12T09:36:14-07:00 by Sarang Dharmapurikar

Install kubernetes on an ec2 instance ubuntu 20.04 using kubeadm and turn this instance into a master node.

Turn an ec2 instance, ubuntu 20.04 into a kubeadm worker node. Install necessary packages and have it join the cluster.

Install Docker

Parse EDN content and give a JSON out

GitHub related tasks

Check whether a user is there on Azure AD and if the user account status is enabled

Get the input parameters of a Jenkins pipeline

Get the console output of last Jenkins job build

List my Jenkins pipelines

Get last build status for a Jenkins job

GitHub related tasks

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

AI agent task

  1. 1

    List all the repos that I have access to. Public and private both.

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script lists all repositories that the user has access to, including public and private ones, and not just the ones they own.

    import requests import json def get_all_accessible_repos(username): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/user/repos' headers = { 'Authorization': f'token {token}' } params = { 'visibility': 'all', 'affiliation': 'owner,collaborator,organization_member' } response = requests.get(url, headers=headers, params=params) if response.status_code == 200: repos = response.json() return repos else: print(f'Error: {response.status_code} - {response.text}') return [] # Input print(f'Input username: {username}') # Get all accessible repos repos = get_all_accessible_repos(username) # Output print('Output repos:') for repo in repos: print(repo["name"]) # print(json.dumps(repos, indent=4))
    copied
    1
  2. 2

    Check if a GitHub token is valid or expired.

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script checks if the GitHub token is still valid or has expired.

    import requests # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Check token validity is_valid = check_github_token_validity() # Output print('Output is_valid:') print(is_valid)
    copied
    2
  3. 3

    List branches of a given repo

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script checks why the branches of a specified GitHub repository cannot be listed and provides a more detailed explanation.

    import requests import json # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Function to list branches of a repo def list_branches(owner, repo_name): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/branches' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json' } response = requests.get(url, headers=headers) return response # Input print(f'Input owner: {owner}') print(f'Input repo_name: {repo_name}') # Check token validity is_valid = check_github_token_validity() if is_valid: # List branches response = list_branches(owner, repo_name) if response.status_code == 200: branches = response.json() explanation = json.dumps(branches, indent=4) elif response.status_code == 404: explanation = 'The repository was not found. Please check the owner and repository name.' elif response.status_code == 403: explanation = 'Access to the repository is forbidden. Please check your permissions.' else: explanation = f'Error: {response.status_code} - {response.text}' else: explanation = 'The GitHub token is not valid.' # Output print('Output explanation:') print(explanation)
    copied
    3
  4. 4

    List just the names of the branches of a github repo.

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script lists just the names of the branches of a specified GitHub repository.

    import requests import json # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Function to list branches of a repo def list_branches(owner, repo_name): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/branches' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json' } response = requests.get(url, headers=headers) return response # Input print(f'Input owner: {owner}') print(f'Input repo_name: {repo_name}') # Check token validity is_valid = check_github_token_validity() if is_valid: # List branches response = list_branches(owner, repo_name) if response.status_code == 200: branches = response.json() branch_names = [branch['name'] for branch in branches] explanation = json.dumps(branch_names, indent=4) elif response.status_code == 404: explanation = 'The repository was not found. Please check the owner and repository name.' elif response.status_code == 403: explanation = 'Access to the repository is forbidden. Please check your permissions.' else: explanation = f'Error: {response.status_code} - {response.text}' else: explanation = 'The GitHub token is not valid.' # Output print('Output branch_names:') print(explanation)
    copied
    4
  5. 5

    Create a new branch for a repo.

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script creates a new branch specified in branch_name for the specified GitHub repository.

    import requests import json # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Function to get the latest commit SHA of the default branch def get_latest_commit_sha(owner, repo_name): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/branches/main' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json' } response = requests.get(url, headers=headers) if response.status_code == 200: branch_info = response.json() return branch_info['commit']['sha'] else: print(f'Error: {response.status_code} - {response.text}') return None # Function to create a new branch def create_branch(owner, repo_name, branch_name, sha): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/git/refs' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json' } data = { 'ref': f'refs/heads/{branch_name}', 'sha': sha } response = requests.post(url, headers=headers, data=json.dumps(data)) return response # Input print(f'Input owner: {owner}') print(f'Input repo_name: {repo_name}') print(f'Input branch_name: {branch_name}') # Check token validity is_valid = check_github_token_validity() if is_valid: # Get the latest commit SHA of the default branch sha = get_latest_commit_sha(owner, repo_name) if sha: # Create a new branch response = create_branch(owner, repo_name, branch_name, sha) if response.status_code == 201: explanation = f'Branch {branch_name} created successfully.' else: explanation = f'Error: {response.status_code} - {response.text}' else: explanation = 'Failed to get the latest commit SHA.' else: explanation = 'The GitHub token is not valid.' # Output print('Output explanation:') print(explanation)
    copied
    5
  6. 6

    Switch to a branch and list the repo files

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script switches to the specified branch and lists the files in the repository.

    import requests import json # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Function to list files in a branch def list_files_in_branch(owner, repo_name, branch_name): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/git/trees/{branch_name}?recursive=1' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json' } response = requests.get(url, headers=headers) return response # Input print(f'Input owner: {owner}') print(f'Input repo_name: {repo_name}') print(f'Input branch_name: {branch_name}') # Check token validity is_valid = check_github_token_validity() if is_valid: # List files in the branch response = list_files_in_branch(owner, repo_name, branch_name) if response.status_code == 200: files_info = response.json() file_paths = [file['path'] for file in files_info.get('tree', [])] explanation = json.dumps(file_paths, indent=4) elif response.status_code == 404: explanation = 'The branch or repository was not found. Please check the owner, repository name, and branch name.' elif response.status_code == 403: explanation = 'Access to the repository is forbidden. Please check your permissions.' else: explanation = f'Error: {response.status_code} - {response.text}' else: explanation = 'The GitHub token is not valid.' # Output print('Output file_paths:') print(explanation)
    copied
    6
  7. 7

    Get the contents of a file in the github repo

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script shows the contents of the specified file in the specified branch of the GitHub repository.

    import requests import json # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Function to get the contents of a file def get_file_content(owner, repo_name, branch_name, file_path): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/contents/{file_path}?ref={branch_name}' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3.raw' } response = requests.get(url, headers=headers) return response # Input print(f'Input owner: {owner}') print(f'Input repo_name: {repo_name}') print(f'Input branch_name: {branch_name}') print(f'Input file_path: {file_path}') # Check token validity is_valid = check_github_token_validity() if is_valid: # Get the file content response = get_file_content(owner, repo_name, branch_name, file_path) if response.status_code == 200: file_content = response.text explanation = file_content elif response.status_code == 404: explanation = 'The file or repository was not found. Please check the owner, repository name, branch name, and file path.' elif response.status_code == 403: explanation = 'Access to the repository is forbidden. Please check your permissions.' else: explanation = f'Error: {response.status_code} - {response.text}' else: explanation = 'The GitHub token is not valid.' # Output print('Output file_content:') print(explanation)
    copied
    7
  8. 8

    Update the contents of a file in the repo and commit the changes to a branch.

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script updates the README.md file with 'Hello folks!' at the top and commits the changes to the specified branch.

    import requests import json import base64 # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Function to get the contents of a file def get_file_content(owner, repo_name, branch_name, file_path): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/contents/{file_path}?ref={branch_name}' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3.raw' } response = requests.get(url, headers=headers) return response # Function to update the contents of a file def update_file_content(owner, repo_name, branch_name, file_path, content, sha, commit_message): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/contents/{file_path}' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json' } data = { 'message': commit_message, 'content': base64.b64encode(content.encode()).decode(), 'sha': sha, 'branch': branch_name } response = requests.put(url, headers=headers, data=json.dumps(data)) return response # Input print(f'Input owner: {owner}') print(f'Input repo_name: {repo_name}') print(f'Input branch_name: {branch_name}') print(f'Input file_path: {file_path}') print(f'Input commit_message: {commit_message}') # Check token validity is_valid = check_github_token_validity() if is_valid: # Get the file content response = get_file_content(owner, repo_name, branch_name, file_path) print('Raw response:') print(response.text) print(f'Status code: {response.status_code}') if response.status_code == 200: file_content = response.text new_content = f'Hello folks!\n{file_content}' sha = response.headers.get('ETag').strip('"') # Update the file content update_response = update_file_content(owner, repo_name, branch_name, file_path, new_content, sha, commit_message) print('Update response:') print(update_response.text) print(f'Update status code: {update_response.status_code}') if update_response.status_code == 200 or update_response.status_code == 201: explanation = 'File updated successfully.' else: explanation = f'Error: {update_response.status_code} - {update_response.text}' elif response.status_code == 404: explanation = 'The file or repository was not found. Please check the owner, repository name, branch name, and file path.' elif response.status_code == 403: explanation = 'Access to the repository is forbidden. Please check your permissions.' else: explanation = f'Error: {response.status_code} - {response.text}' else: explanation = 'The GitHub token is not valid.' # Output print('Output explanation:') print(explanation)
    copied
    8
  9. 9

    Create a pull request to merge a feature branch to main branch for a repo

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script creates a pull request to merge the branch head_branch (like feature branch) to the base_branch (like main) for the specified GitHub repository.

    import requests import json # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Function to create a pull request def create_pull_request(owner, repo_name, head_branch, base_branch, title, body): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/pulls' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json' } data = { 'title': title, 'head': head_branch, 'base': base_branch, 'body': body } response = requests.post(url, headers=headers, data=json.dumps(data)) return response # Input print(f'Input owner: {owner}') print(f'Input repo_name: {repo_name}') print(f'Input head_branch: {head_branch}') print(f'Input base_branch: {base_branch}') print(f'Input title: {title}') print(f'Input body: {body}') # Check token validity is_valid = check_github_token_validity() if is_valid: # Create pull request response = create_pull_request(owner, repo_name, head_branch, base_branch, title, body) print('Raw response:') print(response.text) print(f'Status code: {response.status_code}') if response.status_code == 201: pull_request_info = response.json() pull_request_url = pull_request_info['html_url'] explanation = f'Pull request created successfully: {pull_request_url}' elif response.status_code == 422: explanation = 'Validation failed. Please check if the pull request already exists or if there are any conflicts.' elif response.status_code == 404: explanation = 'The repository was not found. Please check the owner and repository name.' elif response.status_code == 403: explanation = 'Access to the repository is forbidden. Please check your permissions.' else: explanation = f'Error: {response.status_code} - {response.text}' else: explanation = 'The GitHub token is not valid.' # Output print('Output explanation:') print(explanation)
    copied
    9
  10. 10

    Assign a pull request to a user

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

    This script assigns the specified reviewer to the pull request for the specified GitHub repository.

    import requests import json # Function to check if the GitHub token is valid def check_github_token_validity(): token = getEnvVar('GITHUB_TOKEN') url = 'https://api.github.com/user' headers = { 'Authorization': f'token {token}' } response = requests.get(url, headers=headers) return response.status_code == 200 # Function to assign a reviewer to a pull request def assign_reviewer(owner, repo_name, pull_number, reviewers): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/repos/{owner}/{repo_name}/pulls/{pull_number}/requested_reviewers' headers = { 'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json' } data = { 'reviewers': reviewers } response = requests.post(url, headers=headers, data=json.dumps(data)) return response # Input print(f'Input owner: {owner}') print(f'Input repo_name: {repo_name}') print(f'Input pull_number: {pull_number}') print(f'Input reviewers: {reviewers}') # Check token validity is_valid = check_github_token_validity() if is_valid: # Assign reviewer response = assign_reviewer(owner, repo_name, pull_number, reviewers) print('Raw response:') print(response.text) print(f'Status code: {response.status_code}') if response.status_code == 201: explanation = 'Reviewer assigned successfully.' elif response.status_code == 422: explanation = 'Validation failed. Please check if the reviewer is a collaborator on the repository.' elif response.status_code == 404: explanation = 'The pull request or repository was not found. Please check the owner, repository name, and pull request number.' elif response.status_code == 403: explanation = 'Access to the repository is forbidden. Please check your permissions.' else: explanation = f'Error: {response.status_code} - {response.text}' else: explanation = 'The GitHub token is not valid.' # Output print('Output explanation:') print(explanation)
    copied
    10