Conjure.ExecutionContext (Conjure v0.1.1-alpha)

View Source

Context passed to executors containing skill and environment information.

The execution context encapsulates all the configuration needed to safely execute tool calls, including:

  • Working directory for file operations
  • Path restrictions for security
  • Environment variables to set
  • Timeout limits
  • Network access policy
  • Executor-specific configuration

Security

The context enforces boundaries on what the executor can access. Use allowed_paths to restrict file operations to specific directories.

Example

context = %Conjure.ExecutionContext{
  skills_root: "/opt/skills",
  working_directory: "/tmp/conjure/session-123",
  allowed_paths: ["/tmp/conjure/session-123", "/opt/skills"],
  timeout: 30_000,
  network_access: :none
}

Summary

Functions

Creates a context for a specific skill.

Creates a new execution context with the given options.

Validates that a path is within allowed boundaries.

Types

t()

@type t() :: %Conjure.ExecutionContext{
  allowed_paths: [Path.t()],
  container_id: String.t() | nil,
  environment: map(),
  executor_config: map(),
  network_access: :none | :limited | :full,
  skill: Conjure.Skill.t() | nil,
  skills_root: Path.t(),
  timeout: pos_integer(),
  working_directory: Path.t()
}

Functions

for_skill(skill, opts \\ [])

@spec for_skill(
  Conjure.Skill.t(),
  keyword()
) :: t()

Creates a context for a specific skill.

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new execution context with the given options.

Options

  • :skills_root - Root directory containing skills (default: "/tmp/conjure/skills")
  • :working_directory - Working directory for operations (default: "/tmp/conjure/work")
  • :environment - Environment variables to set
  • :timeout - Execution timeout in milliseconds (default: 30_000)
  • :allowed_paths - List of paths that can be accessed
  • :network_access - Network policy: :none, :limited, or :full
  • :executor_config - Executor-specific configuration

validate_path(execution_context, path)

@spec validate_path(t(), Path.t()) :: {:ok, Path.t()} | {:error, :path_not_allowed}

Validates that a path is within allowed boundaries.

Returns {:ok, normalized_path} if the path is allowed, or {:error, :path_not_allowed} otherwise.