Production AI for non-technical knowledge workers: LangChain Agent Builder with GLM 4.7 on Baseten

Learn how to build fast and performant AI agents with natural language

LangChain + Baseten

What if you could describe an agent in English and have it running in production two minutes later? That's what LangChain's LangSmith Agent Builder does. And with Baseten's GLM 4.7 LLM as the inference backbone, it runs extremely fast..

Now everyone can build, no matter their business function. But there remain a few barriers–picking the right tools to augment the quality and accuracy of output and iterating quickly to refine the agent to fit your workflow perfectly. 

Tell Agent Builder what you want, then it will write a detailed system prompt, select the appropriate tools, and can even create subagents to delegate portions of complex tasks. Under the hood, it continuously tool calls over long horizons to accomplish tasks. 

In this guide, we’ll show how to build your own meal planning agent that fits your specific fitness, dietary requirements and other constraints so you can shop smoothly at a grocery store pulling in your favorite recipes from the web. You can similarly build other agents such as a LinkedIn Recruiter, Email Assistant, and many more following prebuilt templates in LangSmith (or create your own from a simple prompt). 

Let’s get started.

Watch this video or follow the instructions below!

Video

Prerequisites

Before starting, you’ll need:

  1. LangSmith account. Visit https://smith.langchain.com/ to sign up.

  2. A Baseten account for Model APIs access. Sign up here. In this example, we will be using GLM 4.7, the leading open source coding and reasoning model at time of writing.

  3. A Tavily account for web search. Visit https://www.tavily.com/ to sign up.

Creating Your Agent

Step 1. Open Agent Builder by clicking on the upper left side bar.

Add custom model in dropdownAdd custom model in dropdown

Step 2: Open the model selection dropdown and click add custom model.

Fill in information required for custom modelFill in information required for custom model

Step 3: All Baseten Model API models are OpenAI compatible chat completion format so will select the default OpenAI API Spec. IMPORTANT: Model ID field must match the slug on Baseten listed here. For GLM 4.7, the slug is `zai-org/GLM4.7`. Enter any display name (we’ve used the same string as the model ID here for simplicity). Enter `https://inference.baseten.co/v1` for the Base URL. Lastly, navigate to app.baseten.co/settings/api_keys to generate your API key and set it in the API key value field. You only need to do this once and the API key will be saved in the Agent Builder environment. Click Save.

Describe your agent with a short sentence or phraseDescribe your agent with a short sentence or phrase

Step 4. Describe the agent in a short sentence such as “meal planning assistant”. Press enter and follow the Agent Builder questions that will help you narrow down the desired behavior of the agent. Then generate an agent instantly using Baseten Inference.

Describe your agent with a short sentence or phraseDescribe your agent with a short sentence or phrase
Follow Agent Builder questions to specify the agent's behaviorFollow Agent Builder questions to specify the agent's behavior

Step 5. Many agents, including this one, often use web search tools such as Tavily to improve the quality and accuracy of their answers. In this case you need to provide the API key in settings once the agent is created. Now you can use the agent!

Add a Tavily API Key for web searchAdd a Tavily API Key for web search

Conclusion

Agent Builder in LangChain allows anyone to build no code agents quickly, automatically suggesting the right set of tools to enhance its capabilities and saving you the headache of writing massive system prompts. Agent Builder becomes even more capable when used in conjunction with open source models powered by Baseten Inference, one of the most cost efficient and performant API on the market. Get started with Agent Builder today: www.langchain.com/langsmith/agent-builder 



Subscribe to our newsletter

Stay up to date on model performance, GPUs, and more.