Skip to main content

Connect your first agent

Connect a TypeScript or JavaScript agent application to E1 in a few steps. This guide uses the Ellipsis SDK with LangChain callbacks.

Before you begin

Make sure you have:
  • Node.js 22 or later.
  • An E1 account and an agent created in your organization’s workspace.
  • The agent API key generated for that E1 agent.
  • The E1 ingestion URL from the API reference.
  • A LangChain application and the API key for the LLM provider you use.
For LangChain and LangGraph instrumentation, the SDK requires @langchain/core version 1.1.0 or later.

1. Install the SDK

Install the package from npm:
For LangChain integrations, make sure your project includes the relevant LangChain packages. For example:
Install the provider package you use separately. The Weather Agent example uses Google Gemini through @langchain/google-genai.

2. Get your E1 connection details

You need two mandatory values: To generate an agent API key:
  1. Sign in to E1, or create an account.
  2. Open your organization’s workspace.
  3. Create an agent.
  4. Generate an API key for that agent.
The key associates telemetry exported by your application with the corresponding agent in E1.

3. Configure environment variables

Store your connection details in environment variables rather than hardcoding credentials in your source files. Create a .env file in your project root:
Load the variables before initializing the SDK. If you use dotenv, install it:
Then create your configuration:
globalTags and globalMetadata are optional. They add context to telemetry collected by the SDK.
Add .env to your .gitignore. Never commit your E1 agent API key or an LLM provider API key to a public repository.

4. Initialize the SDK and create a handler

Initialize Ellipsis once at the top level of your application:
The second argument is the optional SDK logging level. Supported levels are debug, info, warn, error and silent. The default level is warn.

5. Pass the handler to your agent

Pass the handler through the LangChain callbacks option when invoking your agent:
The Ellipsis handler captures supported execution events and exports telemetry to your E1 platform.

6. Run your application and inspect the trace

Execute your application as you normally would. Once the agent has run and telemetry has been exported, open your E1 workspace and inspect the corresponding agent. Depending on the events reported by the framework and model integration, you can inspect:
  • Trace and span hierarchies.
  • Agent and chain executions.
  • LLM provider and model information.
  • Token consumption and prices per run.
  • Execution duration and latency.
  • Tool calls and associated operations.
  • Errors and failed executions.

Complete integration pattern

The following illustrates the essential SDK integration points. Add the handler to the invocation of your existing LangChain agent:
This is the instrumentation pattern, not a complete standalone agent. Your application still needs its own model, tools and agent definition.

Continue learning