Skip to content

Instantly share code, notes, and snippets.

View ayushchopra96's full-sized avatar

Ayush Chopra ayushchopra96

View GitHub Profile
from typing import Optional
import asyncio
from contextlib import AsyncExitStack
from mcp import ClientSession
from mcp.client.stdio import stdio_client
#from custom_transport import insecure_sse_client
from mcp.client.sse import sse_client
import os
from anthropic import Anthropic
import mcp
from mcp.client.streamable_http import streamablehttp_client
import base64
import asyncio
import json
import uuid
import traceback
async def connect_to_mcp(mcp_server_url):
"""Connect to MCP server and return available tools"""
# agent_bridge.py
import os
import uuid
import traceback
import json
import threading
import requests
from typing import Optional
from datetime import datetime
from anthropic import Anthropic, APIStatusError
def f(x, grad=True):
y = x**2
if grad:
return y, dy_dx
return y
def g(y, grad=True):
z = 3*y**3 + 10
if grad:
# API Specification for run_ui_agent.py
Here's a summary of the API endpoints exposed by the `run_ui_agent.py` Flask application:
## Health Check
- **Endpoint**: `/api/health`
- **Method**: GET
- **Description**: Simple health check to verify the agent is running
- **Response**: `{"status": "ok", "agent_id": "<agent_id>"}`
This is my code
@ayushchopra96
ayushchopra96 / train_wandb.py
Created February 23, 2025 02:05
Logginw tih Wandb
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data as data
import wandb
import numpy as np
import time
from datetime import datetime
def create_random_dataset(num_samples=1000, input_shape=(1, 28, 28), num_classes=10):
@ayushchopra96
ayushchopra96 / gist:6fb2c288d1ef5c9f8a5ae20eae41a242
Created July 11, 2024 17:10
Template AgentTorch config for Beckn protocols
simulation_metadata:
device: 'cpu'
num_episodes: 100
num_steps_per_episode: 1000
num_substeps_per_step: 5
calibration: false
visualize: true
max_x: 1000
max_y: 1000
@ayushchopra96
ayushchopra96 / combine.py
Created September 28, 2018 09:25 — forked from FranciscoCanas/combine.py
Combining Pre-trained Left and Right nets into a single joint model
import numpy as np
import sys, os
# Edit the paths as needed:
caffe_root = '../caffe/'
sys.path.insert(0, caffe_root + 'python')
import caffe
# Path to your combined net prototxt files:
@ayushchopra96
ayushchopra96 / README.md
Created August 21, 2018 10:35 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet