Skip to content

tuist/condukt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

151 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Condukt header

Hex.pm HexDocs CI Hex.pm downloads License GitHub stars Last commit

Condukt is an Elixir library for building reliable AI agents.

Use Condukt when agents should live inside your OTP system. It provides the agent runtime, tool system, sandboxing model, project instructions, provider support, structured output, redaction, secrets, streaming, and telemetry.

Installation

Add Condukt to your Elixir application:

def deps do
  [
    {:condukt, "~> 1.5"}
  ]
end

A Small Tour

This example shows the common shape: define an agent, grant tools, delegate to a sub-agent, expose a typed operation, run one-shot tasks, and stream a persistent session.

defmodule MyApp.ProjectAgent do
  use Condukt

  @impl true
  def model, do: "anthropic:claude-sonnet-4-20250514"

  @impl true
  def system_prompt do
    "You help maintain this repository. Prefer concrete findings and patches."
  end

  @impl true
  def tools do
    Condukt.Tools.coding_tools() ++
      [{Condukt.Tools.Command, command: "git"}]
  end

  @impl true
  def subagents do
    [
      reviewer: [
        system_prompt: "Review changes and return concise blockers first.",
        tools: Condukt.Tools.read_only_tools(),
        output: %{
          type: "object",
          properties: %{
            summary: %{type: "string"},
            blockers: %{type: "array", items: %{type: "string"}}
          },
          required: ["summary", "blockers"]
        }
      ]
    ]
  end

  operation :release_notes,
    input: %{
      type: "object",
      properties: %{version: %{type: "string"}},
      required: ["version"]
    },
    output: %{
      type: "object",
      properties: %{
        title: %{type: "string"},
        highlights: %{type: "array", items: %{type: "string"}}
      },
      required: ["title", "highlights"]
    },
    instructions: "Draft release notes from the git history and project files."
end

api_key = System.fetch_env!("ANTHROPIC_API_KEY")

{:ok, %{summary: summary}} =
  Condukt.run(MyApp.ProjectAgent, "Summarize README.md in one paragraph.",
    api_key: api_key,
    cwd: ".",
    input: %{path: "README.md"},
    input_schema: %{
      type: "object",
      properties: %{path: %{type: "string"}},
      required: ["path"]
    },
    output: %{
      type: "object",
      properties: %{summary: %{type: "string"}},
      required: ["summary"]
    }
  )

{:ok, notes} =
  MyApp.ProjectAgent.release_notes(%{version: "1.3.0"},
    api_key: api_key
  )

{:ok, agent} =
  MyApp.ProjectAgent.start_link(
    api_key: api_key,
    cwd: ".",
    redactor: Condukt.Redactors.Regex,
    compactor: {Condukt.Compactor.Sliding, keep: 40}
  )

agent
|> Condukt.stream("Review the last commit and delegate if useful.")
|> Stream.each(fn
  {:text, chunk} -> IO.write(chunk)
  {:tool_call, name, _id, _args} -> IO.puts("\nUsing #{name}")
  :done -> IO.puts("\nDone")
  _event -> :ok
end)
|> Stream.run()

Documentation

Start here:

Build agents:

Run production integrations:

License

MIT License. See LICENSE for details.

About

An Elixir library and standalone agentic engine for building AI workflows

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors