langgraph_client 0.2.2 copy "langgraph_client: ^0.2.2" to clipboard
langgraph_client: ^0.2.2 copied to clipboard

A Dart client for the LangGraph API that enables applications to interact with LangGraph services, threads, assistants, runs, and crons with support for streaming operations.

example/example.dart

import 'package:langgraph_client/langgraph_client.dart';

void main() {
  streamStatefulRun();
}

// https://langchain-ai.github.io/langgraph/cloud/reference/api/api_ref.html#tag/thread-runs/POST/threads/{thread_id}/runs/stream
void streamStatefulRun() async {
  var client = LangGraphClient(
    baseUrl: 'http://localhost:52273', // Replace with your LangGraph API URL
  );

  Thread thread = await client.createThread();

  var statefulRequest = RunCreateStateful(
    assistantId: 'my-langgraph-agent', // Replace with your assistant ID
    input: {
      'messages': [
        {
          'content': 'Write a Hello World program in Dart',
          'role': 'user',
        },
      ]
    },
    streamMode: 'messages',
  );

  await for (final sseEvent
      in client.streamStatefulRun(thread.threadId, statefulRequest)) {
    print(sseEvent);
  }
}
5
likes
160
points
313
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart client for the LangGraph API that enables applications to interact with LangGraph services, threads, assistants, runs, and crons with support for streaming operations.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

equatable, http, json_annotation, sse_stream

More

Packages that depend on langgraph_client