Created
January 12, 2026 22:45
-
-
Save maria-shimkovska/21e28f79ffeac7fc7b8e47af74dc3a6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createAgent, tool } from "langchain"; | |
| import { z } from "zod"; | |
| // Mock database of company information | |
| const companyDatabase = { | |
| "orkes": "Orkes is a workflow orchestration platform that helps developers build and manage microservices and distributed systems at scale. It provides visual workflow management, monitoring, and state management for complex applications. Orkes is spearheaded by the founding members of Conductor, who successfully developed and expanded the open-source project during their tenure at Netflix. This effort led to widespread adoption across industries and companies of all sizes fueled by an enthusiastic community of developers.", | |
| "netflix": "Netflix is a streaming entertainment service with over 200 million subscribers worldwide, offering TV series, documentaries, and feature films.", | |
| "stripe": "Stripe is a technology company that provides payment processing services. Founded in 2010, they serve millions of businesses worldwide." | |
| }; | |
| // Define a simple tool | |
| const companySearch = tool( | |
| async ({ name }) => { | |
| // Normalize the company name to lowercase for lookup | |
| const companyKey = name.toLowerCase(); | |
| // Look up the company in our mock database | |
| const companyInfo = companyDatabase[companyKey]; | |
| if (companyInfo) { | |
| return `${name}: ${companyInfo}`; | |
| } else { | |
| return `${name}: No information available in the database. This might be a smaller company or one we haven't added yet.`; | |
| } | |
| }, | |
| { | |
| name: "company_search", | |
| description: "Search for information about a company by name", | |
| schema: z.object({ | |
| name: z.string().describe("The name of the company to search for"), | |
| }), | |
| } | |
| ); | |
| // Create the agent | |
| const agent = createAgent({ | |
| model: "openai:gpt-4o", | |
| tools: [companySearch], | |
| systemPrompt: "You are a meeting preparation assistant. Summarize key information concisely and help users prepare for their meetings.", | |
| }); | |
| // Run the agent | |
| async function main() { | |
| const result = await agent.invoke({ | |
| messages: [ | |
| { role: "user", content: "Prepare me for a meeting with Orkes" } | |
| ], | |
| }); | |
| console.log("\n=== Agent Response ==="); | |
| console.log(result.messages[result.messages.length - 1].content); | |
| } | |
| main().catch(console.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment