diff --git a/src/langsmith/deploy-other-frameworks.mdx b/src/langsmith/deploy-other-frameworks.mdx index 1e99462655..894bc761ce 100644 --- a/src/langsmith/deploy-other-frameworks.mdx +++ b/src/langsmith/deploy-other-frameworks.mdx @@ -1,108 +1,777 @@ --- title: Deploy other frameworks -sidebarTitle: Deploy other frameworks (e.g., Strands, CrewAI) -description: Deploy agents built with Strands, CrewAI, or other frameworks to LangSmith using the LangGraph Functional API. +sidebarTitle: Deploy other frameworks +description: Deploy agents built with Claude Agent SDK, Strands, CrewAI, AutoGen, and other frameworks to LangSmith Deployment. --- -This guide shows you how to use [Functional API](/oss/langgraph/functional-api) to deploy a [Strands Agent](https://strandsagents.com/latest/documentation/docs/) on [LangSmith Deployment](/langsmith/deployment) and set up tracing for [LangSmith Observability](/langsmith/observability). You can follow the same approach with other frameworks like CrewAI and AutoGen. -To deploy Google ADK agents, refer to [Deploy Google ADK agents](/langsmith/deploy-google-adk). +LangSmith Deployment runs any framework. For agents not built on Deep Agents, LangChain, or LangGraph, deploy using either the [`deployments-wrap-sdk`](https://pypi.org/project/deployments-wrap-sdk/) package (Google ADK) or the [LangGraph Functional API](/oss/langgraph/functional-api) (Claude Agent SDK, Strands, CrewAI, AutoGen, and other libraries). -Using Functional API and deploying to LangSmith Deployment provides several benefits: + +For new builds, consider [Deep Agents](/oss/deepagents/overview), an open-source harness for agents that plan, use tools, delegate to subagents, and work over long horizons. Deep Agents deploy directly to LangSmith Deployment, with [Managed Deep Agents](/langsmith/deploy-managed-deep-agent) available for a fully hosted runtime. + -* Production deployment: Deploy your integrated solution to [LangSmith Deployment](/langsmith/deployment) for scalable production use. -* Enhanced features: With Functional API, you can integrate your existing agents with [persistence](/oss/langgraph/persistence), [streaming](/langsmith/streaming), [short and long-term memory](/oss/concepts/memory) and more, with minimal changes to your existing code. -* Multi-agent systems: Build [multi-agent systems](/oss/langchain/multi-agent) where individual agents are built with different frameworks. +## Supported frameworks + +The following frameworks have end-to-end examples in this guide. Each example exports a LangGraph-compatible graph from `agent.py` that Agent Server can serve. + +
+ + + + Claude Agent SDK + + + + + + Strands Agents + + + + + + CrewAI + + + + + + AutoGen + +
+ + +Don't see your framework? The Functional API accepts any callable, so you can apply the same pattern shown in the following examples to any agent library. Wrap your agent's entrypoint with `@task` and `@entrypoint`, then deploy. + + +## How the Functional API works + +When a run arrives on Agent Server for a Functional API-wrapped agent: + +1. The platform invokes your `@entrypoint`-decorated `agent` function with the run input and any saved state from prior turns on the same thread (passed as the `previous` argument). +2. The entrypoint calls your `@task`-decorated function, which delegates to the framework agent (Claude Agent SDK, Strands, CrewAI, AutoGen, or another library). +3. The entrypoint returns `entrypoint.final(value=..., save=...)`. The `value` is the response for this turn; `save` is the checkpointed state used as `previous` on the next turn. +4. Agent Server persists the checkpoint, streams partial output when supported, and records traces when tracing is configured. + +This pattern preserves your framework's execution semantics while giving you standard Agent Server features: durable runs, multi-thread persistence, streaming endpoints, and LangSmith observability. ## Prerequisites -* Python 3.9+ -* Dependencies: `pip install strands-agents strands-agents-tools langgraph` -* AWS Credentials in your environment +Regardless of framework, you need: + +* Python 3.10+ for Functional API frameworks (Strands Agents supports Python 3.9+) +* A [LangSmith API key](/langsmith/create-account-api-key) + +## General deployment pattern + +Follow the same steps for each framework. Choose your stack in the tabs inside each step, combine the snippets in one module (for example `agent.py`), and export the `@entrypoint`-decorated function as a module-level variable named `agent`. The [end-to-end example](#end-to-end-example) section shows complete files you can copy. + + + + +Install Python packages for your framework plus LangGraph and LangSmith. + + + + +For [Claude Agent SDK](https://docs.claude.com/en/api/agent-sdk/overview): + +```bash +pip install "langsmith[claude-agent-sdk]" langgraph "langgraph-cli[inmem]" +``` + +Set `ANTHROPIC_API_KEY` in your environment. For an Anthropic API key, refer to the [Claude console](https://claude.ai/login). + + + + +For [Strands Agents](https://strandsagents.com/latest/documentation/docs/): + +```bash +pip install strands-agents strands-agents-tools langgraph "langsmith[strands-agents]" "langgraph-cli[inmem]" +``` + +Configure AWS credentials if you use Amazon Bedrock as the model provider. + + + + +For [CrewAI](https://docs.crewai.com/): + +```bash +pip install crewai langgraph langsmith opentelemetry-instrumentation-crewai opentelemetry-instrumentation-openai "langgraph-cli[inmem]" +``` -## 1. Define strands agent +Set LLM provider credentials in your environment (for example `OPENAI_API_KEY` if you use OpenAI-backed models). -Create a Strands Agent with prebuilt tools. + + + +For [AutoGen](https://microsoft.github.io/autogen/): + +```bash +pip install autogen-agentchat autogen-ext langgraph langsmith opentelemetry-instrumentation-openai "langgraph-cli[inmem]" +``` + +Set `OPENAI_API_KEY` (or your model provider credentials) in your environment. + + + + + + + +Build your agent using the framework of your choice, exactly as you would outside of LangSmith. + + + + +```python +from claude_agent_sdk import ClaudeAgentOptions + +options = ClaudeAgentOptions( + model="claude-sonnet-4-6", + system_prompt="You are a helpful assistant.", +) +``` + + + ```python from strands import Agent -from strands_tools import file_read, file_write, python_repl, shell, journal -agent = Agent( - tools=[file_read, file_write, python_repl, shell, journal], - system_prompt="You are an Expert Software Developer Assistant specializing in web frameworks. Your task is to analyze project structures and identify mappings.", - model="us.anthropic.claude-sonnet-4-20250514-v1:0", - ) +strands_agent = Agent( + system_prompt="You are a helpful assistant.", + model="us.anthropic.claude-sonnet-4-20250514-v1:0", +) +``` + + + + +```python +from crewai import Agent as CrewAgent, Crew, Task + +researcher = CrewAgent(role="Researcher", goal="Research a topic", backstory="Expert researcher.") +crew = Crew( + agents=[researcher], + tasks=[Task(description="{topic}", agent=researcher, expected_output="A short report.")], +) ``` -## 2. Use Functional API to deploy on LangSmith Deployment + + + +```python +from autogen_agentchat.agents import AssistantAgent +from autogen_ext.models.openai import OpenAIChatCompletionClient + +assistant = AssistantAgent( + name="assistant", + model_client=OpenAIChatCompletionClient(model="gpt-4o"), +) +``` -[Functional API](/oss/langgraph/functional-api) allows you to integrate and deploy with frameworks other than LangChain. Functional API also provides the additional benefit to leverage other key features—persistence, memory, human-in-the-loop, and streaming—coupled with your existing agent, with minimal changes to your existing code. + + -It uses two key building blocks: + + -* **@[`@entrypoint`]**: Marks a function as the starting point of a workflow, encapsulating logic and managing execution flow, including handling long-running tasks and interrupts. -* **@[`@task`]**: Represents a discrete unit of work, such as an API call or data processing step, that can be executed asynchronously within an entrypoint. Tasks return a future-like object that can be awaited or resolved synchronously. +Expose your agent through an `@entrypoint`-decorated function named `agent`. Inside, use `@task` for the unit of work that calls into the framework. Use `entrypoint.final()` to return the response and persist conversation history across turns on the same thread. + + + ```python -from strands.types.content import Message +import operator +from claude_agent_sdk import ClaudeSDKClient from langgraph.func import entrypoint, task + +@task +async def invoke_claude(prompt: str) -> str: + async with ClaudeSDKClient(options=options) as client: + await client.query(prompt) + chunks: list[str] = [] + async for message in client.receive_response(): + chunks.append(str(message)) + return "\n".join(chunks) + +@entrypoint() +async def agent(messages: list[dict], previous: list[dict] | None = None): + history = operator.add(previous or [], messages) + prompt = history[-1]["content"] + response = await invoke_claude(prompt) + new_message = {"role": "assistant", "content": response} + return entrypoint.final( + value=[new_message], + save=operator.add(history, [new_message]), + ) +``` + + + + +```python import operator +from langgraph.func import entrypoint, task +from strands.types.content import Message + @task def invoke_strands(messages: list[Message]): - # run the agent with existing messages; can invoke with the final message with messages[-1] - result = agent(messages) - # return the resulting message + result = strands_agent(messages) return [result.message] @entrypoint() -def workflow(messages: list[Message], previous: list[Message]): +def agent(messages: list[Message], previous: list[Message] | None = None): messages = operator.add(previous or [], messages) response = invoke_strands(messages).result() return entrypoint.final(value=response, save=operator.add(messages, response)) ``` -## 3. Set up tracing with OpenTelemetry + + -In your environment variables, set up the following: +```python +import operator + +from langgraph.func import entrypoint, task + +@task +def run_crew(topic: str) -> str: + return str(crew.kickoff(inputs={"topic": topic})) + +@entrypoint() +def agent(messages: list[dict], previous: list[dict] | None = None): + history = operator.add(previous or [], messages) + response = run_crew(history[-1]["content"]).result() + new_message = {"role": "assistant", "content": response} + return entrypoint.final(value=[new_message], save=operator.add(history, [new_message])) +``` + + + ```python -# Turn off LangSmith default tracing, as we want to only trace with OpenTelemetry -LANGSMITH_TRACING=false +import operator + +from langgraph.func import entrypoint, task + +@task +async def invoke_autogen(prompt: str) -> str: + result = await assistant.run(task=prompt) + return result.messages[-1].content -OTEL_EXPORTER_OTLP_ENDPOINT = "https://api.smith.langchain.com/otel/" +@entrypoint() +async def agent(messages: list[dict], previous: list[dict] | None = None): + history = operator.add(previous or [], messages) + response = await invoke_autogen(history[-1]["content"]) + new_message = {"role": "assistant", "content": response} + return entrypoint.final(value=[new_message], save=operator.add(history, [new_message])) +``` + + + + + + + +Forward the framework's native traces to LangSmith. Call tracing setup once at application startup, before creating or invoking agents. + + + + +```python +from langsmith.integrations.claude_agent_sdk import configure_claude_agent_sdk -OTEL_EXPORTER_OTLP_HEADERS = "x-api-key=your-langsmith-api-key,Langsmith-Project=your-tracing-project-name" +configure_claude_agent_sdk() +``` + +For full setup details, see [Trace Claude Agent SDK applications](/langsmith/trace-claude-agent-sdk). + + + + +Set your [LangSmith API key](/langsmith/create-account-api-key) and project name. If you use Amazon Bedrock, also configure AWS credentials. + +```python +from langsmith.integrations.strands_agents import setup_langsmith_telemetry + +setup_langsmith_telemetry() ``` -If you're [self-hosting LangSmith](/langsmith/self-hosted), replace the `OTEL_EXPORTER_OTLP_ENDPOINT` endpoint with your LangSmith API endpoint and append `/api/v1/otel`. For example: `OTEL_EXPORTER_OTLP_ENDPOINT = "https://ai-company.com/api/v1/otel"` +If you're [self-hosting LangSmith](/langsmith/self-hosted), configure the OpenTelemetry OTLP endpoint and headers for your deployment. See [Trace Strands Agents applications](/langsmith/trace-with-strands-agents). -Strand's OTel tracing contains synchronous code. In this case, you may need to set `BG_JOB_ISOLATED_LOOPS=true` to execute background runs in an isolated event loop separate from the serving API event loop. This only prevents health-check failures; the synchronous tracing code still degrades throughput and tail latency under load. See [`BG_JOB_ISOLATED_LOOPS`](/langsmith/env-var-cloud) for recommended async alternatives. +Strands' OTel tracing contains synchronous code. You may need to set `BG_JOB_ISOLATED_LOOPS=true` when deploying to Agent Server. See [`BG_JOB_ISOLATED_LOOPS`](/langsmith/env-var#bg_job_isolated_loops). -In your main agent, set up the following: +For full setup details, see [Trace Strands Agents applications](/langsmith/trace-with-strands-agents). + + + + +Register the LangSmith span processor with the CrewAI and OpenAI instrumentors: ```python -from strands.telemetry import StrandsTelemetry +from langsmith.integrations.otel import OtelSpanProcessor +from opentelemetry import trace +from opentelemetry.instrumentation.crewai import CrewAIInstrumentor +from opentelemetry.instrumentation.openai import OpenAIInstrumentor +from opentelemetry.sdk.trace import TracerProvider + +current_provider = trace.get_tracer_provider() +if isinstance(current_provider, TracerProvider): + tracer_provider = current_provider +else: + tracer_provider = TracerProvider() + trace.set_tracer_provider(tracer_provider) -strands_telemetry = StrandsTelemetry() -strands_telemetry.setup_otlp_exporter() -strands_telemetry.setup_meter() +tracer_provider.add_span_processor(OtelSpanProcessor()) +CrewAIInstrumentor().instrument(tracer_provider=tracer_provider) +OpenAIInstrumentor().instrument(tracer_provider=tracer_provider) ``` -## 4. Prepare for deployment +For full setup details, see [Trace CrewAI applications](/langsmith/trace-with-crewai). -From here, to deploy to LangSmith, create a file structure like the following: + + +Register the LangSmith span processor with the OpenAI instrumentor: + +```python +from langsmith.integrations.otel import OtelSpanProcessor +from opentelemetry import trace +from opentelemetry.instrumentation.openai import OpenAIInstrumentor +from opentelemetry.sdk.trace import TracerProvider + +tracer_provider = TracerProvider() +tracer_provider.add_span_processor(OtelSpanProcessor()) +trace.set_tracer_provider(tracer_provider) +OpenAIInstrumentor().instrument() ``` -my-strands-agent/ -├── agent.py # Your main agent code -├── requirements.txt # Python dependencies -└── langgraph.json # LangGraph configuration + +For full setup details, see [Trace AutoGen applications](/langsmith/trace-with-autogen). + + + + + + + +## End-to-end example + +The following examples combine agent definition, Functional API wrapping, tracing setup, and export of the `agent` symbol in a single `agent.py` file. Pick the tab for your framework. + + + + +```python agent.py +import operator + +from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient +from langgraph.func import entrypoint, task +from langsmith.integrations.claude_agent_sdk import configure_claude_agent_sdk + +configure_claude_agent_sdk() + +options = ClaudeAgentOptions( + model="claude-sonnet-4-6", + system_prompt="You are a helpful assistant.", +) + +@task +async def invoke_claude(prompt: str) -> str: + async with ClaudeSDKClient(options=options) as client: + await client.query(prompt) + chunks: list[str] = [] + async for message in client.receive_response(): + chunks.append(str(message)) + return "\n".join(chunks) + +@entrypoint() +async def agent(messages: list[dict], previous: list[dict] | None = None): + history = operator.add(previous or [], messages) + prompt = history[-1]["content"] + response = await invoke_claude(prompt) + new_message = {"role": "assistant", "content": response} + return entrypoint.final( + value=[new_message], + save=operator.add(history, [new_message]), + ) +``` + + + + +```python agent.py +import operator + +from langgraph.func import entrypoint, task +from langsmith.integrations.strands_agents import setup_langsmith_telemetry +from strands import Agent +from strands.types.content import Message + +setup_langsmith_telemetry() + +strands_agent = Agent( + system_prompt="You are a helpful assistant.", + model="us.anthropic.claude-sonnet-4-20250514-v1:0", +) + +@task +def invoke_strands(messages: list[Message]): + result = strands_agent(messages) + return [result.message] + +@entrypoint() +def agent(messages: list[Message], previous: list[Message] | None = None): + messages = operator.add(previous or [], messages) + response = invoke_strands(messages).result() + return entrypoint.final(value=response, save=operator.add(messages, response)) +``` + + + + +```python agent.py +import operator + +from crewai import Agent as CrewAgent, Crew, Task +from langgraph.func import entrypoint, task +from langsmith.integrations.otel import OtelSpanProcessor +from opentelemetry import trace +from opentelemetry.instrumentation.crewai import CrewAIInstrumentor +from opentelemetry.instrumentation.openai import OpenAIInstrumentor +from opentelemetry.sdk.trace import TracerProvider + +current_provider = trace.get_tracer_provider() +if isinstance(current_provider, TracerProvider): + tracer_provider = current_provider +else: + tracer_provider = TracerProvider() + trace.set_tracer_provider(tracer_provider) + +tracer_provider.add_span_processor(OtelSpanProcessor()) +CrewAIInstrumentor().instrument(tracer_provider=tracer_provider) +OpenAIInstrumentor().instrument(tracer_provider=tracer_provider) + +researcher = CrewAgent(role="Researcher", goal="Research a topic", backstory="Expert researcher.") +crew = Crew( + agents=[researcher], + tasks=[Task(description="{topic}", agent=researcher, expected_output="A short report.")], +) + +@task +def run_crew(topic: str) -> str: + return str(crew.kickoff(inputs={"topic": topic})) + +@entrypoint() +def agent(messages: list[dict], previous: list[dict] | None = None): + history = operator.add(previous or [], messages) + response = run_crew(history[-1]["content"]).result() + new_message = {"role": "assistant", "content": response} + return entrypoint.final(value=[new_message], save=operator.add(history, [new_message])) +``` + + + + +```python agent.py +import operator + +from autogen_agentchat.agents import AssistantAgent +from autogen_ext.models.openai import OpenAIChatCompletionClient +from langgraph.func import entrypoint, task +from langsmith.integrations.otel import OtelSpanProcessor +from opentelemetry import trace +from opentelemetry.instrumentation.openai import OpenAIInstrumentor +from opentelemetry.sdk.trace import TracerProvider + +tracer_provider = TracerProvider() +tracer_provider.add_span_processor(OtelSpanProcessor()) +trace.set_tracer_provider(tracer_provider) +OpenAIInstrumentor().instrument() + +assistant = AssistantAgent( + name="assistant", + model_client=OpenAIChatCompletionClient(model="gpt-4o"), +) + +@task +async def invoke_autogen(prompt: str) -> str: + result = await assistant.run(task=prompt) + return result.messages[-1].content + +@entrypoint() +async def agent(messages: list[dict], previous: list[dict] | None = None): + history = operator.add(previous or [], messages) + response = await invoke_autogen(history[-1]["content"]) + new_message = {"role": "assistant", "content": response} + return entrypoint.final(value=[new_message], save=operator.add(history, [new_message])) +``` + + + + +Two things are essential for every example: + +1. **Export the `@entrypoint`-decorated function as `agent`** at module scope. Agent Server imports this symbol when serving the graph. +2. **Return `entrypoint.final()` with a `save` argument** so conversation state persists across turns on the same thread. + +## Project layout + +A deployable project needs these files: + +``` +my-agent/ +├── agent.py # exports the agent graph +├── langgraph.json # Agent Server config +├── pyproject.toml # Python dependencies +└── .env # Provider credentials and LangSmith variables +``` + +[`langgraph.json`](/langsmith/application-structure#configuration-file-concepts) points Agent Server at the exported symbol: + + + + +```json langgraph.json +{ + "$schema": "https://langgra.ph/schema.json", + "dependencies": ["."], + "graphs": { + "claude_agent": "./agent.py:agent" + }, + "env": ".env" +} +``` + +```toml pyproject.toml +[project] +name = "my-claude-agent" +version = "0.0.1" +requires-python = ">=3.10" +dependencies = [ + "langsmith[claude-agent-sdk]>=0.3.0", + "langgraph>=0.4.0", +] +``` + +```bash .env +LANGSMITH_API_KEY=your-langsmith-api-key +LANGSMITH_TRACING=true +LANGSMITH_PROJECT=my-claude-agent +ANTHROPIC_API_KEY=your-anthropic-api-key +``` + + + + +```json langgraph.json +{ + "$schema": "https://langgra.ph/schema.json", + "dependencies": ["."], + "graphs": { + "strands_agent": "./agent.py:agent" + }, + "env": ".env" +} +``` + +```toml pyproject.toml +[project] +name = "my-strands-agent" +version = "0.0.1" +requires-python = ">=3.9" +dependencies = [ + "strands-agents>=0.1.0", + "strands-agents-tools>=0.1.0", + "langsmith[strands-agents]>=0.3.0", + "langgraph>=0.4.0", +] +``` + +```bash .env +LANGSMITH_API_KEY=your-langsmith-api-key +LANGSMITH_TRACING=true +LANGSMITH_PROJECT=my-strands-agent +OTEL_EXPORTER_OTLP_ENDPOINT=https://api.smith.langchain.com/otel/v1/traces +OTEL_EXPORTER_OTLP_HEADERS=x-api-key=your-langsmith-api-key,Langsmith-Project=my-strands-agent +AWS_REGION=your-aws-region +AWS_PROFILE=your-aws-profile +``` + + + + +```json langgraph.json +{ + "$schema": "https://langgra.ph/schema.json", + "dependencies": ["."], + "graphs": { + "crewai_agent": "./agent.py:agent" + }, + "env": ".env" +} +``` + +```toml pyproject.toml +[project] +name = "my-crewai-agent" +version = "0.0.1" +requires-python = ">=3.10" +dependencies = [ + "crewai>=0.100.0", + "langgraph>=0.4.0", + "langsmith>=0.3.0", + "opentelemetry-instrumentation-crewai>=0.1.0", + "opentelemetry-instrumentation-openai>=0.1.0", +] +``` + +```bash .env +LANGSMITH_API_KEY=your-langsmith-api-key +LANGSMITH_PROJECT=my-crewai-agent +OPENAI_API_KEY=your-openai-api-key +``` + + + + +```json langgraph.json +{ + "$schema": "https://langgra.ph/schema.json", + "dependencies": ["."], + "graphs": { + "autogen_agent": "./agent.py:agent" + }, + "env": ".env" +} +``` + +```toml pyproject.toml +[project] +name = "my-autogen-agent" +version = "0.0.1" +requires-python = ">=3.10" +dependencies = [ + "autogen-agentchat>=0.4.0", + "autogen-ext>=0.4.0", + "langgraph>=0.4.0", + "langsmith>=0.3.0", + "opentelemetry-instrumentation-openai>=0.1.0", +] +``` + +```bash .env +LANGSMITH_API_KEY=your-langsmith-api-key +LANGSMITH_PROJECT=my-autogen-agent +OPENAI_API_KEY=your-openai-api-key +``` + + + + +## Install dependencies + +From your project directory: + +```bash +pip install -e . +``` + +## Enable tracing + +Use the framework-specific `.env` template in [Project layout](#project-layout). Agent Server loads this file when `"env": ".env"` is set in `langgraph.json`. + +Set `LANGSMITH_PROJECT` and your framework provider credentials in that file. For Claude Agent SDK and Strands Agents, also set `LANGSMITH_TRACING=true`. For CrewAI and AutoGen, tracing is enabled in `agent.py` through `OtelSpanProcessor()` and the framework instrumentors, so set `LANGSMITH_API_KEY` and `LANGSMITH_PROJECT` only. + +[Traces](/langsmith/observability) show agent invocations, tool calls, and LLM interactions in the [LangSmith UI](https://smith.langchain.com). For framework-specific tracing options, see the links in [Configure tracing](#configure-tracing) above. + +## Run locally + +Start the local Agent Server with the [LangGraph CLI](/langsmith/cli): + +```bash +langgraph dev +``` + + +If `langgraph dev` reports that `langgraph-api` is missing, install `langgraph-cli[inmem]` in the same environment. + + +This serves the agent at `http://127.0.0.1:2024` and opens [LangSmith Studio](/langsmith/studio). Send a request with `curl`: + + +`langgraph dev` may serve on a different port. Check the URL in the terminal output and update the `curl` commands below if needed. + + + + + +```bash +# Create a thread +THREAD=$(curl -s -X POST http://127.0.0.1:2024/threads \ + -H "Content-Type: application/json" -d '{}' | python -c "import sys, json; print(json.load(sys.stdin)['thread_id'])") + +# Run the agent and wait for the final response +curl -s -X POST "http://127.0.0.1:2024/threads/$THREAD/runs/wait" \ + -H "Content-Type: application/json" \ + -d '{ + "assistant_id": "ASSISTANT_ID", + "input": [{"role": "user", "content": "Hello"}] + }' +``` + + + + +```bash +# Create a thread +THREAD=$(curl -s -X POST http://127.0.0.1:2024/threads \ + -H "Content-Type: application/json" -d '{}' | python -c "import sys, json; print(json.load(sys.stdin)['thread_id'])") + +# Run the agent and wait for the final response +curl -s -X POST "http://127.0.0.1:2024/threads/$THREAD/runs/wait" \ + -H "Content-Type: application/json" \ + -d '{ + "assistant_id": "ASSISTANT_ID", + "input": [ + { + "role": "user", + "content": [ + {"type": "text", "text": "Hello"} + ] + } + ] + }' +``` + + +If this request fails with `NoCredentialsError`, configure AWS credentials for your model provider (for example `AWS_PROFILE` or `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`) and restart `langgraph dev`. + + + + + +Replace `ASSISTANT_ID` with the graph key from your `langgraph.json` `graphs` object. For example, if your config is `"graphs": {"claude_agent": "./agent.py:agent"}`, use `claude_agent`; if your config is `"graphs": {"strands_agent": "./agent.py:agent"}`, use `strands_agent`. + + +[Verify that the LangGraph API runs locally](/langsmith/local-dev-testing) before deploying. If `langgraph dev` fails, deployment to LangSmith will fail as well. + + +## Deploy to LangSmith + +Once the agent runs locally, deploy it with `langgraph deploy`: + +```bash +langgraph deploy --name my-agent ``` -To deploy your agent, follow the [Deploy to cloud](/langsmith/deploy-to-cloud) guide. +For environment configuration, deployment types, and revision management, see [Deploy to cloud](/langsmith/deploy-to-cloud). For self-hosted setups, see [Self-hosted deployments](/langsmith/self-hosted). For Docker-only hosting without the control plane, see [Deploy standalone](/langsmith/deploy-standalone-server). diff --git a/src/langsmith/deployment.mdx b/src/langsmith/deployment.mdx index e209df22a3..d84e49e299 100644 --- a/src/langsmith/deployment.mdx +++ b/src/langsmith/deployment.mdx @@ -46,7 +46,7 @@ Deploy Google Agent Development Kit (ADK) agent as a LangGraph with the `deploym href="/langsmith/deploy-other-frameworks" icon="packages" > -Use the LangGraph Functional API to deploy Strands, CrewAI, and other agent frameworks. +Deploy Claude Agent SDK, Strands, CrewAI, AutoGen, and other agent frameworks with the Functional API or `deployments-wrap-sdk`.