{"id":27966572,"url":"https://github.com/tobysolutions/gaianet-langraph-agent","last_synced_at":"2026-02-27T04:31:49.883Z","repository":{"id":287965799,"uuid":"965106027","full_name":"tobySolutions/gaianet-langraph-agent","owner":"tobySolutions","description":"This is a simple showcase of using a langraph agent with a Gaianet node ","archived":false,"fork":false,"pushed_at":"2025-04-12T12:31:33.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-15T12:18:45.849Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/tobySolutions.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-04-12T12:28:38.000Z","updated_at":"2025-04-15T10:00:50.000Z","dependencies_parsed_at":"2025-04-14T22:17:56.595Z","dependency_job_id":"939cb3af-1344-48d4-b00c-3a4837efcd48","html_url":"https://github.com/tobySolutions/gaianet-langraph-agent","commit_stats":null,"previous_names":["tobysolutions/gaianet-langraph-agent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tobySolutions/gaianet-langraph-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobySolutions%2Fgaianet-langraph-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobySolutions%2Fgaianet-langraph-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobySolutions%2Fgaianet-langraph-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobySolutions%2Fgaianet-langraph-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobySolutions","download_url":"https://codeload.github.com/tobySolutions/gaianet-langraph-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobySolutions%2Fgaianet-langraph-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29884699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"online","status_checked_at":"2026-02-27T02:00:06.759Z","response_time":57,"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":[],"created_at":"2025-05-07T20:19:37.567Z","updated_at":"2026-02-27T04:31:49.868Z","avatar_url":"https://github.com/tobySolutions.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LangChain ReAct Agent Demo\n\nThis repository demonstrates how to create a ReAct agent (Reasoning and Acting) using LangChain. The agent can use tools to answer questions, such as fetching weather information.\n\n## Features\n\n- Creates a ReAct agent with LangChain\n- Implements a custom search tool for weather information\n- Uses Llama 3 models via Gaianet\n- Uses environment variables for API keys\n\n## Prerequisites\n\n- Node.js (v14 or higher recommended)\n- npm or yarn\n- API keys for your chosen LLM provider\n\n## Installation\n\n1. Clone this repository\n2. Install dependencies:\n\n```bash\nnpm install\n```\n\n3. Create a `.env` file in the root directory with your API keys:\n\n```\nGAIANET_API_KEY=your_gaia_api_key\n```\n\n## Usage\n\n```javascript\nimport { createReactAgent } from \"@langchain/langgraph/prebuilt\";\nimport { ChatAnthropic } from \"@langchain/anthropic\";\nimport { ChatOpenAI } from \"@langchain/openai\";\nimport { tool } from \"@langchain/core/tools\";\nimport dotenv from \"dotenv\";\n\n// Load environment variables\ndotenv.config();\n\n// Define your tools\nconst myTool = tool(\n  async ({ query }) =\u003e {\n    // Tool implementation\n    return \"Result of the tool\";\n  },\n  {\n    name: \"toolName\",\n    description: \"Description of what this tool does\",\n    schema: z.object({\n      query: z.string().describe(\"Description of the query parameter\"),\n    }),\n  }\n);\n\n// Configure your LLM\nconst model = new ChatOpenAI({\n  // Configuration options\n});\n\n// Create the agent\nconst agent = createReactAgent({\n  llm: model,\n  tools: [myTool],\n});\n\n// Invoke the agent\nconst result = await agent.invoke({\n  messages: [\n    {\n      role: \"user\",\n      content: \"Your query here\",\n    },\n  ],\n});\n\nconsole.log(result);\n```\n\n## Example\n\nThe repository includes an example that creates a weather search tool. When queried about San Francisco's weather, it returns \"60 degrees and foggy\". For all other locations, it returns \"90 degrees and sunny\".\n\n```javascript\n// Define a simple search tool\nconst search = tool(\n  async ({ query }) =\u003e {\n    if (\n      query.toLowerCase().includes(\"sf\") ||\n      query.toLowerCase().includes(\"san francisco\")\n    ) {\n      return \"It's 60 degrees and foggy.\";\n    }\n    return \"It's 90 degrees and sunny.\";\n  },\n  {\n    name: \"search\",\n    description: \"Call to surf the web.\",\n    schema: z.object({\n      query: z.string().describe(\"The query to use in your search.\"),\n    }),\n  }\n);\n\n// Create and invoke the agent\nconst agent = createReactAgent({\n  llm: model,\n  tools: [search],\n});\n\nconst result = await agent.invoke({\n  messages: [\n    {\n      role: \"user\",\n      content: \"Can you search for the weather in SF for today?\",\n    },\n  ],\n});\n```\n\n## LLM Configuration\n\nThis project uses Gaianet to access Llama 3 models. You'll need a Gaianet API key to run this code.\n\n```javascript\nconst model = new ChatOpenAI({\n  configuration: {\n    apiKey: process.env.GAIANET_API_KEY,\n    model: \"Llama-3-Groq-8B-Tool\",\n    baseURL: \"https://0x5cea2cf8e0e8307a3e8655cb3f4fd1065f4a3ab5.gaia.domains/v1\",\n  },\n});\n```\n\nThe code includes a commented-out configuration for Anthropic Claude that you can use as an alternative:\n\n```javascript\nconst model = new ChatAnthropic({\n  apiKey: process.env.ANTHROPIC_API_KEY,\n  model: \"claude-3-7-sonnet-latest\"\n});\n```\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobysolutions%2Fgaianet-langraph-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobysolutions%2Fgaianet-langraph-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobysolutions%2Fgaianet-langraph-agent/lists"}