langchain agents deploy

DevOps Community

Skill notes

Durable execution

A graph becomes durable by attaching a checkpointer at compile time. Without one, interrupt() and HumanInTheLoopMiddleware do nothing useful, and crash recovery is impossible. Checkpointer · When InMemorySaver · Dev, tests, smoke runs. State dies with the process. SqliteSaver · Single-node deploys, low-volume. PostgresSaver · Multi-instance, production. Concurrent threads safe.

The production middleware stack

Copy this and tune. See the langchain-agents-middleware skill for full details on each.

Cost controls beyond ModelCallLimitMiddleware

Pick a small fallback. ModelFallbackMiddleware("openai:gpt-4o-mini") after a strong primary keeps costs bounded on retries. Use LLMToolSelectorMiddleware when the agent has 10+ tools. A small model picks the relevant 3–5 to expose to the main model, dropping prompt tokens. Use SummarizationMiddleware on long conversations. Summarize every N tokens to keep prompt size bounded. Use ContextEditingMiddleware to drop old tool outputs from context once they're no longer useful.

Structured outputs

If the agent's final answer must be typed (an extracted record, a decision), use model.with_structured_output(...) as the model passed to create_agent: The agent's terminal AIMessage will be a validated Decision instance.

Keep evals/datasets/smoke.jsonl to 3–5 rows, <60s total. Run before every deploy: If smoke fails, fix the agent or the smoke dataset; do not bypass. See the langchain-agents-langsmith-evals skill for the runner shape.

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
DevOps
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@tomevault-io · no license declared
Token usage
Moderate
Setup complexity
Manual integration
External API key
Required · OpenAI
Operating systems
Docker
Runtime requirements
Node.js · Python >=3.11 · Docker
Detected file/system behavior
  • Read-only
  • Write / modify
  • Shell exec
  • Env read
Network behavior
External requests
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

Output preview langchain-agents-deploy.preview
# Structured outputs

from pydantic import BaseModel

class Decision(BaseModel):
    action: str
    confidence: float

structured_model = init_chat_model("claude-sonnet-4-6").with_structured_output(Decision)

agent = create_agent(model=structured_model, tools=[...], middleware=[...])

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.