diff --git a/README.md b/README.md index 4652bc48..49f2c97c 100644 --- a/README.md +++ b/README.md @@ -89,26 +89,26 @@ WORKSPACE_ID=$(vf workspace list --output-format json | jq -r '.workspaces[0].id PROJECT_ID=$(vf project create --name "My Agent" --type webchat \ --workspace-id "$WORKSPACE_ID" --output-format json | jq -r '.project.id') -# 3. Start a conversation (fresh projects have one environment, alias "main") -vf conversation send --user-id quickstart-user --project-id "$PROJECT_ID" \ - --environment-alias main --version-param draft \ - --action '{"type":"launch"}' --output-format json - -# 4. Say something — same user-id continues the same conversation -vf conversation send --user-id quickstart-user --project-id "$PROJECT_ID" \ - --environment-alias main --version-param draft \ - --action '{"type":"text","payload":"What can you help me with?"}' --output-format json +# 3. Start a session: a conversation with the agent +# (fresh projects have one environment, alias "main") +vf session start --project-id "$PROJECT_ID" --environment-alias main + +# 4. Say something: the session goes on until you end it +vf session send --project-id "$PROJECT_ID" --environment-alias main "What can you help me with?" + +# 5. End it; vf finds its transcript, for an evaluation +vf session end --project-id "$PROJECT_ID" --environment-alias main ``` -The agent's replies arrive as `text` traces in the response. +At a terminal vf prints what the agent said. With `--output-format json` each turn prints the API's answer, the agent's replies as `text` traces, and the session's ID. A new project starts from a **template**, so it answers immediately but introduces itself as a placeholder brand ("Acme Corp support") and its instructions still contain fill-in-the-blank prompts. Getting to *your* agent is the next step, not the last one: edit the instructions (`vf agent update`), add knowledge (`vf document create-url`), run tests (`vf test run create`), and publish (`vf environment publish`). Worth knowing before you script against the CLI: -- **`--version-param draft` runs what you are editing; `published` runs the live version.** A new project is created with a first release already in place, so either works immediately — you do not have to publish anything first. -- **`--action '{"type":"launch"}'` is optional.** Sending a `text` action straight away works; the runtime starts the conversation itself. The launch step is shown because it makes the first turn explicit. -- **A conversation with the draft runs your latest edits.** The draft runs as last compiled, so vf compiles it before every turn with it: each `conversation send`, in a conversation old or new, and `conversation run-script`. A compile takes about half a second. If the draft won't compile, vf says why and sends nothing (`error_type` `compile_failed`, exit 1). An edit made while a turn runs can miss that turn; vf then compiles again after it and warns. `--no-compile` talks to the last build as it is; the published version is never compiled. +- **A session talks to the draft, what you are editing; `vf session start -v published` talks to the live version.** A new project is created with a first release already in place, so either works immediately — you do not have to publish anything first. +- **vf remembers the current session** for each project and environment, so `send`, `get`, `update` and `end` need no ID, and a `send` with none going starts one. `-s ` names another. A session's ID is its conversation's user ID: `vf transcript search --session ` lists its transcripts, and `vf evaluation run --session ` evaluates its newest. `vf session run-script` runs a list of messages as a fresh session. At a terminal, `vf session start` goes on to a chat, a turn a line, until `/end`; Ctrl-D leaves the session going, and `vf session send` with no message goes back to it. (`vf conversation`, which took a user ID, a version and an action in JSON on every turn, still runs for the scripts that use it.) +- **A session with the draft runs your latest edits.** The draft runs as last compiled, so vf compiles it when a session starts (`session start`, `session run-script`, a `send` that starts one), and before a turn after vf itself edited the draft (`vf agent update`, `vf playbook update`, …). Other turns don't compile. A compile takes about half a second. If the draft won't compile, vf says why and sends nothing (`error_type` `compile_failed`, exit 1). An edit made elsewhere, or while a turn runs, can miss that turn; vf then compiles after it and warns, so the next turn runs it. A conversation already going can still be swayed by its earlier replies: to try an edit cleanly, start a new session. `--no-compile` talks to the last build as it is; the published version is never compiled. - **Pass `--output-format json` explicitly when piping.** Inside AI coding agents (`CLAUDECODE`, `CURSOR_AGENT`, …) the default output is TOON, not JSON. - **Capture values with `--jq`**: `ID=$(vf project create … --jq .project.id)`. A string result prints raw, as `jq -r` prints it; anything else prints as JSON. - **`vf whoami` is offline** — it shows which credential source is configured but does not validate the token. `vf workspace list` is the real check. @@ -604,17 +604,14 @@ which names the coding agent running the CLI (`claude_code`, `codex`, …) or is * [`query`](docs/vf_knowledge-base_query.md) - Query knowledge base -### [conversation](docs/vf_conversation.md) - -* [`send`](docs/vf_conversation_send.md) - Send -* [`run-script`](docs/vf_conversation_run-script.md) - Run script - -#### [state](docs/vf_conversation_state.md) +### [session](docs/vf_session.md) -* [`get`](docs/vf_conversation_state_get.md) - Get state -* [`update`](docs/vf_conversation_state_update.md) - Update state -* [`delete`](docs/vf_conversation_state_delete.md) - Delete state -* [`update-variables`](docs/vf_conversation_state_update-variables.md) - Update variables +* [`start`](docs/vf_session_start.md) - Start a fresh conversation with the agent +* [`send`](docs/vf_session_send.md) - Say the next thing to the agent +* [`update`](docs/vf_session_update.md) - Set variables in the session +* [`get`](docs/vf_session_get.md) - Show the session and its variables +* [`end`](docs/vf_session_end.md) - End the session, and find its transcript +* [`run-script`](docs/vf_session_run-script.md) - Run a list of messages as a fresh session ### [credits](docs/vf_credits.md) diff --git a/docs/vf.md b/docs/vf.md index b6ead473..6f3b60c3 100644 --- a/docs/vf.md +++ b/docs/vf.md @@ -36,7 +36,6 @@ vf [flags] * [vf api-tool](vf_api-tool.md) - Manage API tools: HTTP requests the agent can make * [vf auth](vf_auth.md) - Manage authentication credentials * [vf configure](vf_configure.md) - Configure authentication credentials and preferences -* [vf conversation](vf_conversation.md) - Talk to an agent: send messages, run scripts * [vf document](vf_document.md) - Manage knowledge base documents and sitemaps * [vf environment](vf_environment.md) - Publish, clone, merge and compare environments * [vf evaluation](vf_evaluation.md) - Create and run evaluations that score transcripts @@ -47,6 +46,7 @@ vf [flags] * [vf mcp-tool](vf_mcp-tool.md) - List, inspect and run MCP server tools * [vf playbook](vf_playbook.md) - Build playbooks: instructions, tools and exit paths * [vf project](vf_project.md) - Create, list and manage projects +* [vf session](vf_session.md) - Start a session with the agent, send turns, end it * [vf tool](vf_tool.md) - Manage the tools an agent and its playbooks use * [vf transcript](vf_transcript.md) - Search and read conversation transcripts * [vf variable](vf_variable.md) - Manage the variables an agent reads and sets diff --git a/docs/vf_session.md b/docs/vf_session.md new file mode 100644 index 00000000..0d6bd904 --- /dev/null +++ b/docs/vf_session.md @@ -0,0 +1,49 @@ +## vf session + +Start a session with the agent, send turns, end it + +### Synopsis + +Talk to the agent one conversation at a time, as a person would. + +'vf session start' begins a fresh conversation, 'vf session send' says the next thing, and 'vf session end' ends it and finds its transcript, for 'vf evaluation run'. vf remembers the session each start began as the current one for its project and environment, so a turn takes only the message. A send with none going starts one. + +The session ID is the conversation's user ID: -s names a session, and -u still works. + +``` +vf session [flags] +``` + +### Options + +``` + -h, --help help for session +``` + +### Options inherited from parent commands + +``` + --agent-mode Enable structured errors and default TOON output for AI coding agents. Automatically enabled when a known agent environment is detected (CLAUDE_CODE, CURSOR_AGENT, etc.). Use --agent-mode=false to disable. + --color string Control colored output: auto (color when output is a TTY), always, or never. Respects NO_COLOR and FORCE_COLOR env vars. (default "auto") + -d, --debug Log request and response diagnostics to stderr + --dry-run Preview the request that would be sent without executing it (output to stderr) + -H, --header stringArray Set a custom HTTP request header (format: "Key: Value"). Can be specified multiple times. + --include-headers Include HTTP response headers in the output + -q, --jq string Filter the response with a jq expression, e.g. '.project.id' or '.items[] | .id'. A string prints raw, as jq -r prints it; anything else prints as JSON ('| tojson' keeps a string quoted). Overrides -o: the filter reads the JSON response, and its output is the same whatever -o says + --no-interactive Disable all interactive features (auto-prompting, the home prompt, TUI forms) + -o, --output-format string Specify the output format. Options: pretty, json, yaml, table, toon. (default "pretty") + --server-url string Override the default server URL + --timeout string HTTP request timeout (e.g., 30s, 5m, 100ms) + --token string Voiceflow bearer token + --usage Print the CLI Usage schema in KDL format +``` + +### SEE ALSO + +* [vf](vf.md) - Build, test, and operate Voiceflow AI agents from your terminal +* [vf session end](vf_session_end.md) - End the session, and find its transcript +* [vf session get](vf_session_get.md) - Show the session and its variables +* [vf session run-script](vf_session_run-script.md) - Run a list of messages as a fresh session +* [vf session send](vf_session_send.md) - Say the next thing to the agent +* [vf session start](vf_session_start.md) - Start a fresh conversation with the agent +* [vf session update](vf_session_update.md) - Set variables in the session diff --git a/docs/vf_session_end.md b/docs/vf_session_end.md new file mode 100644 index 00000000..c29f16d6 --- /dev/null +++ b/docs/vf_session_end.md @@ -0,0 +1,49 @@ +## vf session end + +End the session, and find its transcript + +### Synopsis + +End the current session's conversation, and find its transcript, for 'vf evaluation run'. The session is no longer the current one. + +``` +vf session end [flags] +``` + +### Examples + +``` + vf session end -p -e +``` + +### Options + +``` + -e, --environment-alias string The environment's alias, such as main or dev; 'vf environment list' lists them. [required] + -h, --help help for end + -p, --project-id string The project's ID: in Creator, under the agent's Settings → General, or from 'vf project list'. [required] + -s, --session string The session to act on. Without it, the current one: the one the last 'vf session start' began. + -v, --version-param string The version the session talks to. vf knows it for a session it started; for another, it is the draft unless you say published. (options: draft, published) +``` + +### Options inherited from parent commands + +``` + --agent-mode Enable structured errors and default TOON output for AI coding agents. Automatically enabled when a known agent environment is detected (CLAUDE_CODE, CURSOR_AGENT, etc.). Use --agent-mode=false to disable. + --color string Control colored output: auto (color when output is a TTY), always, or never. Respects NO_COLOR and FORCE_COLOR env vars. (default "auto") + -d, --debug Log request and response diagnostics to stderr + --dry-run Preview the request that would be sent without executing it (output to stderr) + -H, --header stringArray Set a custom HTTP request header (format: "Key: Value"). Can be specified multiple times. + --include-headers Include HTTP response headers in the output + -q, --jq string Filter the response with a jq expression, e.g. '.project.id' or '.items[] | .id'. A string prints raw, as jq -r prints it; anything else prints as JSON ('| tojson' keeps a string quoted). Overrides -o: the filter reads the JSON response, and its output is the same whatever -o says + --no-interactive Disable all interactive features (auto-prompting, the home prompt, TUI forms) + -o, --output-format string Specify the output format. Options: pretty, json, yaml, table, toon. (default "pretty") + --server-url string Override the default server URL + --timeout string HTTP request timeout (e.g., 30s, 5m, 100ms) + --token string Voiceflow bearer token + --usage Print the CLI Usage schema in KDL format +``` + +### SEE ALSO + +* [vf session](vf_session.md) - Start a session with the agent, send turns, end it diff --git a/docs/vf_session_get.md b/docs/vf_session_get.md new file mode 100644 index 00000000..33039743 --- /dev/null +++ b/docs/vf_session_get.md @@ -0,0 +1,49 @@ +## vf session get + +Show the session and its variables + +### Synopsis + +Show the current session: its ID, the version it talks to, and its variables. -o json prints its whole state, as the API keeps it. + +``` +vf session get [flags] +``` + +### Examples + +``` + vf session get -p -e +``` + +### Options + +``` + -e, --environment-alias string The environment's alias, such as main or dev; 'vf environment list' lists them. [required] + -h, --help help for get + -p, --project-id string The project's ID: in Creator, under the agent's Settings → General, or from 'vf project list'. [required] + -s, --session string The session to act on. Without it, the current one: the one the last 'vf session start' began. + -v, --version-param string The version the session talks to. vf knows it for a session it started; for another, it is the draft unless you say published. (options: draft, published) +``` + +### Options inherited from parent commands + +``` + --agent-mode Enable structured errors and default TOON output for AI coding agents. Automatically enabled when a known agent environment is detected (CLAUDE_CODE, CURSOR_AGENT, etc.). Use --agent-mode=false to disable. + --color string Control colored output: auto (color when output is a TTY), always, or never. Respects NO_COLOR and FORCE_COLOR env vars. (default "auto") + -d, --debug Log request and response diagnostics to stderr + --dry-run Preview the request that would be sent without executing it (output to stderr) + -H, --header stringArray Set a custom HTTP request header (format: "Key: Value"). Can be specified multiple times. + --include-headers Include HTTP response headers in the output + -q, --jq string Filter the response with a jq expression, e.g. '.project.id' or '.items[] | .id'. A string prints raw, as jq -r prints it; anything else prints as JSON ('| tojson' keeps a string quoted). Overrides -o: the filter reads the JSON response, and its output is the same whatever -o says + --no-interactive Disable all interactive features (auto-prompting, the home prompt, TUI forms) + -o, --output-format string Specify the output format. Options: pretty, json, yaml, table, toon. (default "pretty") + --server-url string Override the default server URL + --timeout string HTTP request timeout (e.g., 30s, 5m, 100ms) + --token string Voiceflow bearer token + --usage Print the CLI Usage schema in KDL format +``` + +### SEE ALSO + +* [vf session](vf_session.md) - Start a session with the agent, send turns, end it diff --git a/docs/vf_session_run-script.md b/docs/vf_session_run-script.md new file mode 100644 index 00000000..457c1dc8 --- /dev/null +++ b/docs/vf_session_run-script.md @@ -0,0 +1,59 @@ +## vf session run-script + +Run a list of messages as a fresh session + +### Synopsis + +Run a list of user messages as one new conversation, and make it the current session. + +With the draft, vf compiles it first, so the script runs your latest edits. 'vf session send' goes on from the script's last turn; --end ends the session after the script instead, and finds its transcript, for 'vf evaluation run'. + +``` +vf session run-script [flags] +``` + +### Examples + +``` + vf session run-script -p -e --messages '["What are your hours?","Book a table for two"]' + vf session run-script -p -e --messages '["Hi","Cancel my order"]' --end +``` + +### Options + +``` + --body string Request body as JSON (alternative to individual flags). --body - reads it from stdin; piped stdin is read on its own only when no body flag is given. --body @file reads it from a file. + --end End the session after the script, and find its transcript, as 'vf session end' does. + -e, --environment-alias string The environment's alias, such as main or dev; 'vf environment list' lists them. [required] + -h, --help help for run-script + -l, --launch string How the conversation starts; payload is its only field. Leave it out for a plain launch. JSON: { payload: { persona?: string, … } } + -m, --messages string The user messages to send, in order, after the launch. A message is typed text, as a string or { "text": "…" }, or a button press, as { "button": "