new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

LangChain & LangGraph · all subjects

deployment & configuration

30 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Custom store replaces built-in Postgres store entirely

When a custom store is configured in LangSmith, it replaces the built-in Postgres store entirely. Capabilities like semantic search and TTL sweeping depend on your custom implementation.

Define custom store as async context manager

Create a file with an async context manager that yields a BaseStore instance. The server manages the store's lifecycle automatically by opening and closing the store connection at the right points in the application lifecycle.

SQLite not recommended for production deployments

AsyncSqliteStore should not be used in production deployments.

Custom store example with AsyncSqliteStore and semantic search

```python import contextlib from langchain.embeddings import init_embeddings from langgraph.store.base import IndexConfig from langgraph.store.sqlite import AsyncSqliteStore embeddings = init_embeddings("openai:text-embedding-3-small") @contextlib.asynccontextmanager async def generate_store(): """Yield a BaseStore, open for the duration of the server.""" async with AsyncSqliteStore.from_conn_string( "./custom_store.sql", index=IndexConfig( dims=1536, embed=embeddings, fields=["$"], ), ) as store: await store.setup() yield store ``` This example shows how to create an async context manager that yields an AsyncSqliteStore with semantic search configured.

Configure custom store in langgraph.json

Add a `store` key to the langgraph.json configuration file with a `path` pointing to the async context manager. Example: `{"store": {"path": "./src/agent/store.py:generate_store"}}`

Test custom store locally with langgraph dev

Test the server locally using the command `langgraph dev --no-browser`. The server logs will confirm the custom store is active with the message 'Using custom store. Skipping store TTL sweeper.'

BaseStore implementation required for custom store

A custom store must implement the BaseStore interface to be used as a replacement for the built-in Postgres store in LangSmith deployments.

Tools can read deployment secrets from environment variables

Tools can read deployment secrets from environment variables. For local development with mda dev, put values in .env. When deploying with mda deploy, non-reserved .env values are forwarded as hosted deployment secrets.

mda dev and mda deploy build behavior

mda dev and mda deploy copy the project files into the compiled build. Your imports work the same way they do in a normal local Python or TypeScript project.

Managed Deep Agents project structure for tools

Keep the agent entry point at the project root. Define authored tools under a tools/ directory. For Python: agent.py at root with tools/customer.py. For JavaScript: agent.ts at root with tools/customer.ts.

Engine connects lifecycle stages

Engine is a component that connects the agent development lifecycle, linking the UI and webhooks across the Build, Test, Deploy, Monitor, and Govern stages.

Agent development lifecycle stages

The agent development lifecycle consists of five stages: Build, Test, Deploy, Monitor, and Govern. These stages form a cyclical process for developing agents end to end.

LangSmith as all-in-one platform

LangSmith can be used as an all-in-one platform for the agent development lifecycle, covering Build, Test, Deploy, Monitor, and Govern stages.

Agent Auth self-hosted API URL configuration

For self-hosted LangSmith instances, set LANGSMITH_API_URL environment variable to 'https://your-langsmith-instance.com/api-host' with the /api-host path included.

Agent Auth installation command

Install Agent Auth using 'pip install langchain-auth' for Python or 'npm install @langchain/auth' for JavaScript.

Agent Auth Client initialization JavaScript

Initialize the Agent Auth client with: import { Client } from '@langchain/auth'; const client = new Client({ apiKey: 'you••••••ey' });

Agent Auth self-hosted Client initialization JavaScript explicit

For self-hosted instances, initialize the Client with: new Client({ apiKey: 'you••••••ey', apiUrl: 'https://your-langsmith-instance.com/api-host' })

OAuth provider callback URL LangSmith Cloud

For LangSmith Cloud, the OAuth callback URL format is: https://smith.langchain.com/host-oauth-callback/{provider_id}

OAuth provider callback URL self-hosted

For self-hosted LangSmith instances, the OAuth callback URL format is: https://{your-langsmith-instance}/host-oauth-callback/{provider_id}

Create OAuth provider Python

Create an OAuth provider using: await client.create_oauth_provider(provider_id='{provider_id}', name='{provider_display_name}', client_id='{your_client_id}', client_secret='{your_client_secret}', auth_url='{auth_url_of_your_provider}', token_url='{token_url_of_your_provider}')

Create OAuth provider JavaScript

Create an OAuth provider using: await client.createOAuthProvider({ providerId: '{provider_id}', name: '{provider_display_name}', clientId: '{your_client_id}', clientSecret: '{your_client_secret}', authUrl: '{auth_url_of_your_provider}', tokenUrl: '{token_url_of_your_provider}' })

Agent Server customization options

Agent Server supports customization through caching, custom stores and checkpointers, lifespan hooks, middleware, custom routes, encryption, and configurable headers and logs.

Cloud deployment using LangSmith

LangSmith Deployment on Cloud is fully managed by LangChain on AWS and GCP. You can create deployments from GitHub in the LangSmith UI or with the `langgraph deploy` command. This option requires a Plus plan or above.

Self-hosted deployment with control plane

Self-hosted LangSmith Deployment allows you to run the control plane and Agent Servers in your own Kubernetes cluster, alongside self-hosted LangSmith. This requires the Enterprise plan with LangSmith Deployment enabled.

Hybrid deployment mode

Hybrid deployment mode features a LangChain-managed control plane with Agent Servers and their data plane in your infrastructure. Traces flow to LangSmith Cloud or self-hosted LangSmith.

Standalone Agent Server deployment

Standalone Agent Server can be deployed with Docker, Compose, or Kubernetes. You bring your own PostgreSQL, Redis, and LangSmith license. This mode does not include a control plane. Optional LangSmith tracing is available to Cloud or a self-hosted instance.

Common LangSmith Deployment setups

Common setups include: (1) Managed hosting on Cloud with LangChain hosting control plane, data plane, and databases; (2) Agents in your VPC via Hybrid with LangChain-managed control plane; (3) Full data residency with self-hosted LangSmith Deployment; (4) Agent runtime only via Standalone Server without control plane.

Update prompts without redeploying

LangSmith Deployment allows you to manage the prompts and versioned contexts your deployed agents pull at runtime through the prompt and context hub, enabling behavior changes without a full redeploy.

RemoteGraph for deployed graphs

RemoteGraph enables you to call your deployed graph from client code as if it were a local compiled graph.

Full-stack web app deployment with LangChain.js

You can ship a LangChain.js agent and chat UI together as a single web app. Examples include using Vite with LangSmith Deployment as the agent backend, or embedding the agent inside web framework route handlers.

Give your agent this brain