a2aproject / a2aproject/a2a-cli

feat: add interactive chat for multi-turn agent sessions

Ouverte
#34 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
enhancement P2
Langage dominant
Go
Étoiles
95
Forks
4
Merge moyen
3 j 2 h
PR mergées (30 j)
24

Description

**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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.