{"id":27414762,"url":"https://github.com/kabragaurav/ai-agent","last_synced_at":"2025-08-22T10:07:59.387Z","repository":{"id":282417595,"uuid":"948504411","full_name":"kabragaurav/ai-agent","owner":"kabragaurav","description":"A simple AI agent for getting temperature of a city","archived":false,"fork":false,"pushed_at":"2025-04-24T09:38:40.000Z","size":7673,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T13:26:07.171Z","etag":null,"topics":["ai-agent","cursor-ai","cursor-ai-editor","cursorai","openai","openai-api","openweathermap","openweathermap-api","temperature-app","weather-app"],"latest_commit_sha":null,"homepage":"https://kabragaurav.netlify.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kabragaurav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-14T13:04:09.000Z","updated_at":"2025-04-24T09:38:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"9c010c9a-6ce7-44cf-8cda-9083d0bbc21f","html_url":"https://github.com/kabragaurav/ai-agent","commit_stats":null,"previous_names":["kabragaurav/ai-agent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kabragaurav/ai-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabragaurav%2Fai-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabragaurav%2Fai-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabragaurav%2Fai-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabragaurav%2Fai-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kabragaurav","download_url":"https://codeload.github.com/kabragaurav/ai-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabragaurav%2Fai-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271620532,"owners_count":24791566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agent","cursor-ai","cursor-ai-editor","cursorai","openai","openai-api","openweathermap","openweathermap-api","temperature-app","weather-app"],"created_at":"2025-04-14T08:48:31.482Z","updated_at":"2025-08-22T10:07:59.375Z","avatar_url":"https://github.com/kabragaurav.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Agents\nby Gaurav Kabra\n\n## What is an AI agent?\nA system capable of autonomously performing taskson behalf of user/another system.\n\nE.g. Salesforce Agentforce\n\n## How is it different from LLM?\nLLM (like ChatGPT4o) have knowledge base on trained data but cannot perform tasks like CRUD on company DB. Moreover, the data on which LLM was trained, is stale (not real time).\n\nIn a very layman terms,\n\n```\nAgent = LLM + tools (defined functions like how to do CRUD)\n```\n\n## Setup\nObtain OpenAPI keys from [here](https://platform.openai.com/api-keys).\n\nCheck your remaining credit quota [here](https://platform.openai.com/settings/organization/billing/overview).\n\nAlso get keys for getting weather details from [here](https://api.openweathermap.org/). Once you generate key, key will take ~10 mins to become activated.\n\nThen put this in a new `.env` file, which you need to create in root folder of the project.\nE.g.\n\n```\nOPENAI_API_KEY=\u003cvalue here without quotes\u003e\nWEATHER_API_KEY=\u003cvalue here without quotes\u003e\n```\n\n## Insights\n\n#### 1.\nCode:\n\n```js\nasync function chat() {\n    let result = await client.chat.completions.create({\n        model: \"gpt-4o-mini\",\n        messages: [\n            {role: \"system\", content: SYS_PROMPT},\n            {role: \"user\", content: \"what is the weather of Jaipur?\"}\n        ]\n    });\n\n    console.log(result.choices[0].message.content);\n}\n```\n\nOutput:\n\n```json\n{\"type\": \"user\", \"user\": \"What is the weather of Jaipur?\"}\n{\"type\": \"plan\", \"plan\": \"I will call getTemperatureDetails function for Jaipur\"}\n{\"type\": \"execution\", \"function\": \"getTemperatureDetails\", \"input\": \"Jaipur\"}\n```\n\n#### 2.\n\nCode:\n```js\nconst chat = await client.chat.completions.create({\n            model: \"gpt-4o-mini\",\n            messages: history,\n            response_format: { \"type\": \"json_object\" }\n        });\n    \n        const response = chat.choices[0].message.content;\n        console.log('---------- Starts Agent Response ----------');\n        console.log(response);\n```\n\nOutput:\n![](./assets/sample1.png)\n![](./assets/sample2.png)\n\n#### 3. \nIt is able to apply AI over output (e.g. °C to °F conversions)\n![](./assets/sample3.png)\n![](./assets/sample4.png)\n![](./assets/sample5.png)\n![](./assets/sample6.png)\n![](./assets/sample7.png)\n\n\n#### 4. Integrating live weather API using Cursor AI editing\n![](./assets/sample8.png)\n![](./assets/sample9.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabragaurav%2Fai-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkabragaurav%2Fai-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabragaurav%2Fai-agent/lists"}