Skip to content

Add configurable file read limits to SDK tools #1

@tombee

Description

@tombee

Problem

When using the Conductor SDK's file read tool in an agentic context, there's no way to limit how much of a file is read. Large files can:

  • Exhaust the context window
  • Increase token costs unnecessarily
  • Slow down agent iterations

Concrete example from foreman: The implementing stage reads source files during code analysis. A 10,000 line file consumes excessive tokens when only the first 500 lines are relevant.

Proposal

Add configurable line limits to file read operations:

// Option 1: Tool-level configuration
tool := sdk.FileReadTool(sdk.WithMaxLines(500))

// Option 2: Per-call parameter in tool schema
{
  "name": "read",
  "parameters": {
    "path": "/path/to/file.ts",
    "max_lines": 500,      // Optional, default unlimited
    "offset": 0            // Optional, start from line N
  }
}

General Utility

  1. Code analysis agents - Any agent reading source files benefits from bounded reads
  2. Log analysis - Reading recent log entries without loading entire files
  3. Document processing - Preview/summary workflows that only need file headers

Acceptance Criteria

  • File read tool accepts optional max_lines parameter
  • File read tool accepts optional offset parameter
  • When limit is set, output includes indicator that file was truncated
  • Default behavior unchanged (read entire file if no limit)
  • Unit tests for truncation behavior

Priority

High / Blocking - Foreman implementation blocked until this lands.

Labels

enhancement, sdk, priority:high

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions