Skip to content

AUDIT-12 — Medium — TOOL_OUTPUT_MAX_CHARS ignored; compose omits documented settings #69

Closed

Description

@getdownandcode

Summary

Severity: Medium
Area: Configuration
Affected files: agentkit/api/deps.py:181-185, agentkit/config.py:105-109, docker-compose.yml:74-86
Suggested branch: fix/wire-documented-settings
Suggested PR title: fix(config): wire TOOL_OUTPUT_MAX_CHARS and the documented compose settings

This is finding AUDIT-12 of 18 from a consolidated audit of agentkit/. It is deliberately self-contained so it can be fixed on its own branch with its own PR.

Related findings: Related: AUDIT-18 (compose hardening).


AUDIT-12 — Medium — TOOL_OUTPUT_MAX_CHARS ignored; compose omits documented settings

Files

  • agentkit/api/deps.py:181-185
  • agentkit/config.py:105-109
  • docker-compose.yml:74-86

Current code — agentkit/api/deps.py:181-185

    config = AgentConfig(
        max_steps=settings.MAX_STEPS,
        run_timeout_s=settings.RUN_TIMEOUT_S,
        tool_timeout_s=settings.TOOL_TIMEOUT_S,
    )

Current code — docker-compose.yml:74-86

    environment:
      - DATABASE_URL=${DATABASE_URL:-postgresql+asyncpg://postgres:postgres@postgres:5432/agentkit}
      - REDIS_URL=${REDIS_URL:-redis://redis:6379/0}
      - FILE_TOOL_BASE_DIR=/tmp/agentkit_sandbox
      - RUN_TIMEOUT_S=${RUN_TIMEOUT_S:-60}
      - API_KEYS=${API_KEYS:-}
      - LLM_PROVIDER=${LLM_PROVIDER:-gemini}
      - LLM_MODEL=${LLM_MODEL:-gemini-3.1-flash-lite}
      - GEMINI_API_KEY=${GEMINI_API_KEY:-}
      - OPENAI_API_KEY=${OPENAI_API_KEY:-}

Why this is a bug

  • AgentConfig.tool_output_max_chars is never set from Settings.TOOL_OUTPUT_MAX_CHARS → the setting is dead and the limit is always the hard-coded 2000.
  • Compose does not pass SEARCH_API_KEY, RATE_LIMIT_PER_MIN, MAX_STEPS, TOOL_TIMEOUT_S, SESSION_TTL_S, TOOL_OUTPUT_MAX_CHARS, LLM_MAX_RETRIES, LLM_RETRY_BASE_DELAY_S, LLM_RETRY_MAX_DELAY_S — all documented in .env.example / docs/SPEC.md. A containerised deployment silently runs with defaults, and web_search is unusable without SEARCH_API_KEY.

Pass cases

  • TOOL_OUTPUT_MAX_CHARS from the environment actually reaches AgentConfig.tool_output_max_chars (test: set it to e.g. 50 and assert a longer tool output is truncated to 50).
  • Compose passes every setting documented in .env.example / docs/SPEC.md, with ${VAR:-} defaults so the stack still boots.
  • A test (or a compose-config assertion) enumerates the documented settings and fails if one is missing from the compose environment block.
  • docs/SPEC.md:225 and docs/AGENTKIT_SPEC.md:225 stay in sync with the real setting list.


Definition of done (per AGENTS.md)

  • New/updated unit and integration tests covering the pass cases above, all passing (pytest).
  • ruff check ., ruff format --check . and mypy agentkit clean.
  • Docstrings updated where behaviour changed; docs/PROGRESS.md updated (status, PR link, commit count, notes).
  • A new ADR in docs/DECISIONS.md if an architectural decision was made.
  • Branch pushed and PR opened (never commit directly to main).

Baseline at the time of writing: pytest is green on main (all tests pass; tests/real/* skipped unless AGENTKIT_REAL_INFRA=1).

Activity

  1. getdownandcode commented on Oct 20, 2026

    @getdownandcode
    OwnerAuthor

    Audit index (18 separate issues, fix one by one)

    ID Issue Severity
    AUDIT-01 #58 Critical
    AUDIT-02 #59 Critical
    AUDIT-03 #60 High
    AUDIT-04 #61 High
    AUDIT-05 #62 High
    AUDIT-06 #63 High/Medium
    AUDIT-07 #64 Medium-High
    AUDIT-08 #65 Medium-High
    AUDIT-09 #66 Medium-High
    AUDIT-10 #67 Medium-High
    AUDIT-11 #68 Medium
    AUDIT-12 #69 Medium
    AUDIT-13 #70 Medium
    AUDIT-14 #71 Medium
    AUDIT-15 #72 Medium
    AUDIT-16 #73 Medium
    AUDIT-17 #74 Low
    AUDIT-18 #75 Low/Deployment

    Each issue is self-contained: current code, reproduction, pass cases, suggested branch and PR title. Reference the relevant one with Fixes #NN in your PR.

  2. HamzaKhanBUIC commented on Oct 20, 2026

    @HamzaKhanBUIC

    Opened PR #82 with the complete fix and regression test suite:

    • In �gentkit/api/deps.py:get_agent(), passed ool_output_max_chars=settings.TOOL_OUTPUT_MAX_CHARS to AgentConfig.
    • In docker-compose.yml, exposed all documented configuration settings (SEARCH_API_KEY, RATE_LIMIT_PER_MIN, MAX_STEPS, TOOL_TIMEOUT_S, SESSION_TTL_S, TOOL_OUTPUT_MAX_CHARS, LLM_MAX_RETRIES, LLM_RETRY_BASE_DELAY_S, LLM_RETRY_MAX_DELAY_S).
    • Aligned docs/SPEC.md and docs/AGENTKIT_SPEC.md with the full Settings variable set.
    • Added unit and integration tests in ests/unit/test_config.py verifying dependency wiring, tool truncation behavior, and full parity between Settings.model_fields and docker-compose.yml.
    • Verified clean across pytest,
      uff check,
      uff format --check, and mypy agentkit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions