메뉴
HN
Hacker News 41일 전

API 요금 없이 AI 에이전트 간 대화 구현하는 가벼운 방법

IMP
8/10
핵심 요약

API 호출 비용 없이 구독 중인 요금제만으로 Claude, Codex, Gemini 같은 코딩 에이전트들이 서로 상호작용하는 간단한 워크플로우를 공유합니다. CLI의 세션 재개(resume) 기능과 tmux를 활용해 에이전트들이 서로의 결과를 검토하고 수정하는 멀티 에이전트 루프를 구성할 수 있습니다. 복잡한 프레임워크나 추가 종속성 없이 빠르게 실험해 볼 수 있다는 점이 가장 큰 장점입니다.

번역된 본문

지난 몇 주 동안 저는 API, SDK 또는 추가 종속성(dependency) 없이 코딩 에이전트들이 서로 상호작용할 수 있는 간단한 워크플로우를 테스트했습니다. 핵심 제약 조건은 다음과 같습니다. 이미 구독하고 있는 요금제를 사용하고, API 사용료를 추가로 지불하지 않으며, 몇 분 안에 시도해 볼 수 있을 만큼 설정을 간단하게 유지하는 것입니다.

이 방법은 두 가지 이유로 저에게 유용했습니다. 첫째, 때때로 Claude 세션을 연장하면서 Codex나 Gemini에게 작업의 일부를 검토하거나 이어서 작업하도록 요청하고 싶었습니다. 둘째, 단일 벤더의 하위 에이전트에 의존하는 대신, 작업을 위임하고 동일한 초안, 사양 또는 구현에 대해 다른 모델의 관점을 얻고 싶었습니다.

이것은 세련된 프레임워크가 아닙니다. 매우 적은 설정으로 멀티 에이전트 워크플로우를 테스트하기에 충분히 잘 작동하는 실용적인 패턴일 뿐입니다. 예시를 간단하게 유지하기 위해 이 글에서는 '초안(draft)'을 예시로 사용하지만, 동일한 패턴이 사양, 코드 변경 및 검토 작업에도 똑같이 적용됩니다.

기본 아이디어 API를 통해 모델을 통합하는 대신, 이전 대화를 유지한 채 CLI를 통해 한 에이전트가 다른 에이전트를 호출하도록 합니다. 비대화형 패턴의 핵심은 매번 새로운 세션을 시작하는 대신 이전 세션을 재개(resume)하는 것입니다. 에이전트가 사용해야 하는 명령어는 다음과 같습니다:

codex exec resume --last "prompt" gemini -r latest -p "prompt"

중요한 부분은 에이전트가 이전 상호작용을 재개하여 매번 처음부터 시작하는 대신 동일한 주제에 대해 계속 반복 작업(iterate)할 수 있다는 것입니다. Codex 예시에서 --last는 새 세션을 여는 대신 가장 최근 세션을 계속하도록 CLI에 지시합니다.

저는 이 패턴의 규칙을 Claude 메모리 파일인 '외부 에이전트 규칙(external agent conventions)'에 저장해 두었습니다. 여기에는 정확한 호출 규칙이 포함되어 있으며, 다른 에이전트가 읽고 재사용하여 상호작용을 일관되게 유지하는 방법을 알 수 있습니다.

이를 통해 매우 가벼운 루프를 만들 수 있습니다:

  1. 한 에이전트가 초안을 작성하거나 검토합니다.
  2. 해당 에이전트가 재개 모드(resume mode)를 사용하여 다른 에이전트를 호출해 비평을 요청합니다.
  3. 오케스트레이팅 에이전트가 비평을 읽고 다음 단계를 결정합니다.
  4. 초안이 충분히 좋아지거나 논의가 더 이상 가치를 더하지 못할 때까지 에이전트들이 계속 반복(iterate)합니다.

실제로 이 방식을 통해 다음과 같은 작업이 가능합니다:

  • Claude가 작성한 초안을 Codex에게 검토 요청
  • 동일한 초안에 대해 Gemini에게 대안적 해석 요청
  • 한 에이전트를 작성자로, 다른 에이전트를 검토자로 사용
  • 인간이 직접 오케스트레이터 역할을 하거나, 오케스트레이션을 에이전트 중 하나에 위임
  • 에이전트 간의 상호작용을 수동으로 복사-붙여넣기 할 필요가 없음

여러 벤더에 걸쳐 이 작업을 수행하는 이유 중 하나는 동일한 모델 패밀리의 단순한 추가 검토가 아닌, 전혀 다른 관점을 얻기 위해서입니다.

개략적으로 비대화형 흐름은 다음과 같습니다: Claude가 초안 작성 -> Codex가 재개 모드를 사용해 검토 -> Claude가 초안 수정 -> Claude 또는 Codex가 이견 요약 -> 출력이 충분히 안정화될 때까지 반복

이 패턴은 다음과 같은 경우에 적합합니다:

  • 가능한 한 최소한의 설정을 원할 때
  • 추가 종속성을 원하지 않을 때
  • 관측 가능성(observability)보다 빠른 실험이 더 중요할 때

이 패턴의 가장 큰 한계는 가시성(visibility)입니다. 에이전트들이 대화하게 만들 수는 있지만, 상호작용 기록을 검사하거나 진행 상황을 모니터링하거나 각 단계에서 무슨 일이 일어났는지 파악하기가 항상 쉽지만은 않습니다. 또한 한 에이전트가 자율적으로 다른 에이전트를 호출하는 경우 특히 권한(permissions)에 주의를 기울여야 합니다.

더 높은 가시성을 제공하는 방법: tmux 더 나은 가시성을 원한다면 tmux가 더 나은 선택입니다. 이 방식은 tmux가 설치되어 있어야 하지만, 그 대가로 별도의 창(pane)이나 세션에서 각 에이전트가 무엇을 하고 있는지 확인하고 출력을 더 쉽게 캡처할 수 있습니다. 해당 워크플로우에서 에이전트가 사용할 수 있는 몇 가지 명령어는 다음과 같습니다:

전용 tmux 소켓을 생성하고 격리된 세션 시작

SOCKET="${TMPDIR:-/tmp}/claude-tmux-sockets/claude.sock" mkdir -p "${TMPDIR:-/tmp}/claude-tmux-sockets" tmux -S "$SOCKET" new -d -s "descriptive-name"

프롬프트를 문자 그대로 전송한 후 Enter 키로 제출

tmux -S "$SOCKET" send-keys -t target -l -- "$cmd" sleep 1 tmux -S "$SOCKET" send-keys -t target Enter

원문 보기
원문 보기 (영어)
For the past few weeks I have been testing a simple workflow for making coding agents interact with each other without using APIs, SDKs, or extra dependencies. The main constraint is this: use the subscription plans you already have, avoid paying for API usage, and keep the setup simple enough that you can try it in a few minutes. This became useful to me for two reasons: I sometimes want to extend a Claude session by asking Codex or Gemini to review or continue part of the work. I also want to delegate work and get different model perspectives on the same draft, spec, or implementation, instead of relying on a single vendor’s subagents. This is not a polished framework. It is just a practical pattern that works well enough to test multi-agent workflows with very little setup. To keep the examples simple, the rest of this post uses a draft as the running example, but the same pattern applies to specs, code changes, and review tasks. The basic idea Instead of integrating models through APIs, you let one agent invoke another through the CLI in a way that preserves the previous conversation. For the non-interactive pattern, the key is to resume the previous session instead of starting a new one every time. The commands the agent should use are: codex exec resume --last "prompt" gemini -r latest -p "prompt" The important part is that the agent resumes the previous interaction so it can keep iterating on the same topic instead of starting from zero on every call. In the Codex example, --last tells the CLI to continue the most recent session instead of opening a new one. I keep the conventions for this pattern in this Claude memory file: external agent conventions It contains the exact invocation rules and can be read and reused by other agents so they know how to keep the interaction going consistently. That gives you a very lightweight loop: One agent produces or reviews a draft. That agent invokes another agent to critique it using resume mode. The orchestrating agent reads the critique and decides the next step. The agents keep iterating until the draft is good enough or the discussion stops adding value. In practice, this lets you do things like: ask Codex to review a draft produced in Claude ask Gemini for an alternative reading of the same draft use one agent as the writer and another as the reviewer act as the human orchestrator, or delegate orchestration to one of the agents avoid manually copy-pasting each interaction between agents One reason to do this across vendors is to get a different perspective, not just another pass from the same model family. At a high level, the non-interactive flow looks like this: Claude writes a draft -> Codex reviews it using resume mode -> Claude revises the draft -> Claude or Codex summarizes the disagreements -> Repeat until the output is stable enough This pattern is good when: you want the smallest possible setup you do not want extra dependencies you care more about fast experimentation than about observability Its biggest limitation is visibility. You can make agents talk, but it is not always easy to inspect the interaction history, monitor progress, or understand what happened at each step. It is also worth paying attention to permissions, especially if one agent is invoking another autonomously. The more visible pattern: tmux If you want better visibility, tmux is the better option. This version depends on having tmux installed, but in exchange you can see what each agent is doing in separate panes or sessions and capture their output more easily. A few commands the agent can use in that workflow are: # Create a dedicated tmux socket and start an isolated session SOCKET = " ${ TMPDIR :- /tmp } /claude-tmux-sockets/claude.sock" mkdir -p " ${ TMPDIR :- /tmp } /claude-tmux-sockets" tmux -S " $SOCKET " new -d -s "descriptive-name" # Send a prompt literally, then submit it with Enter tmux -S " $SOCKET " send-keys -t target -l -- " $cmd " sleep 1 tmux -S " $SOCKET " send-keys -t target Enter # Capture recent pane output without line wrapping artifacts tmux -S " $SOCKET " capture-pane -p -J -t target -S -200 # Attach to the running session to monitor the agents directly tmux -S " $SOCKET " attach -t session-name I keep the conventions for this pattern in this Claude memory file: tmux multi-agent patterns It describes the socket, monitoring, and pane-management conventions, and other agents can read it as a reusable reference. This pattern is better when: you want to watch the interaction as it happens you want to run two or more agents in parallel you want easier debugging when the workflow becomes messy The main caveat I think there is real value in getting multiple perspectives from different models, but I am still not fully convinced that more agent-to-agent interaction always pays off. LLMs are very good at producing plausible, well-written text. When they start talking to each other, they can produce a lot of it. So the open question is not whether they can reach consensus. They can. The harder question is whether the final result is actually better, or whether it is just a more polished hallucination produced after a longer chain of interactions. That is why I currently see this as a useful workflow to test, not as a universal solution. In summary If you already use subscription-based coding agents, the simplest way I have found to make them collaborate without paying for API usage is: use non-interactive calls with resume when you want simplicity use tmux when you want visibility and tighter control That is enough to build small multi-agent workflows across tools like Claude, Codex, and Gemini without much setup.