a2aproject / a2aproject/a2a-cli

feat: add interactive chat for multi-turn agent sessions

Abierto
#34 0 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement P2
Lenguaje dominante
Go
Estrellas
95
Forks
4
Merge medio
3 d 2 h
PR fusionados (30 d)
24

Descripción

**Goal:** Give a human a simple, interactive multi-turn conversation with an agent from the terminal, without re-typing identifiers on every turn.
**User story:** As a developer exploring an agent, I want an interactive chat that remembers the conversation, so that I can go back and forth without re-passing --context-id and --task-id each turn.

**Priority:** P2 · **Area:** CLI code

## Problem

Driving a multi-turn conversation today means running `a2a send` repeatedly and manually carrying `--context-id` (and `--task-id` while a task is paused) from one command's output into the next. There is no interactive session command:

```
$ a2a chat --help
Error: unknown command "chat" for "a2a"
```

## Proposed behavior

Add an interactive `a2a chat` command for a back-and-forth session with one agent:

```
a2a chat -a
```

- Reads a message from the prompt, sends it, prints the agent's reply, and loops.
- **Carries the `contextId` across turns automatically** (and the active `taskId` while a task is interrupted), so the user never copies identifiers by hand — the CLI stays stateless between processes, but a live `chat` session holds this in memory for its own duration only.
- On `INPUT_REQUIRED`, prompts for the reply and continues the same task; on `AUTH_REQUIRED`, stops and explains what's needed.
- Prints the `taskId`/`contextId` so a user can resume later with `a2a send`.
- Plain, readable output; exits cleanly on EOF/`Ctrl-D` or a `/quit` command.

## Interactive-safety requirements

- `chat` is interactive-only: it **must auto-degrade to non-interactive `send` behavior when stdout is not a terminal**, and must never block waiting on input in a pipe/CI context.
- It must not be the default command; a script's behavior must not change because it happened to run in a terminal.

## Who benefits

- Developers exploring or debugging an agent conversationally.
- Anyone giving a quick demo of an agent from the terminal.

## Acceptance criteria

- [ ] `a2a chat -a ` runs a multi-turn loop, carrying `contextId`/`taskId` automatically.
- [ ] Handles `INPUT_REQUIRED` (prompt + continue) and `AUTH_REQUIRED` (stop + explain).
- [ ] Auto-degrades / does not block when stdout is not a terminal.
- [ ] `/quit` and EOF exit cleanly; the last `taskId`/`contextId` are printed for later resume.

## Environment

- CLI version: `a2a version v0.0.0-…1e29dfe94f95+dirty`
- OS: Linux x86_64

## Notes

This is an ergonomics layer built entirely on top of the existing `send`/`task` behavior — it introduces no new protocol behavior, only an interactive front-end that manages identifiers for the length of the session.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.