Skip to content
DocsOperate it

Command line

Tess Core includes a small command for running one agent turn without writing any code. It is meant for scripts, CI jobs and quick checks. For an application, use the Python API.

Shell
uv run python -m tess_core run -p "Summarise the changes in this repository" --provider anthropic

In the default permission mode a shell command that is not clearly read-only is refused. If the agent never gets past the refusal, the command exits with 2. See Permissions without a person.

run

OptionMeaning
-p, --promptThe prompt. - reads it from standard input.
--cwdThe directory the agent works in. Default: the current directory.
--runtime-homeWhere state is kept. Default: $TESS_CORE_HOME, then ~/.tess-core.
--sessionContinue a saved session, by id or by a search phrase.
--providerA provider or profile name.
--provider-registryA provider registry file. Only its profiles are used.
--provider-auth-pathA Codex auth file for the chosen registry profile.
--modelA model name, overriding the profile's default.
--effortReasoning effort.
--permission-modedefault, acceptEdits, auto, dontAsk or bypassPermissions.
--toolsThe tools to enable, comma-separated names.
--allowed-toolsNarrow the enabled tools to these names.
--disallowed-toolsRemove these tools.
--input-formattext (default) or json.
--output-formattext (default), json or stream-json.
--max-turnsThe number of turns to run. Default: 1.
--no-session-persistenceDo not save the session.

Providers

The command knows two built-in providers, anthropic and openai, which read ANTHROPIC_API_KEY and OPENAI_API_KEY. Profiles you define in <runtime-home>/settings/providers.yaml are available by name.

A Codex sign-in is used only when you name its file, for example TESS_OPENAI_CODEX_AUTH_PATH=~/.codex/auth.json. The command never looks for one, so being signed in to another tool does not change which provider or credential a run uses.

To use a provider registry file, pass it:

Shell
uv run python -m tess_core run -p "..." --provider-registry providers.yaml --provider claude

Resolution is then strict, as it is for start_runtime: the built-in profiles, the settings folder's profiles and credentials found elsewhere are not used. --provider may be left out when the registry has one profile. A profile that signs in with a Codex account takes its auth file from --provider-auth-path.

Output

text prints the final answer.

json prints one object when the turn ends:

JSON
{
  "success": true,
  "exitCode": 0,
  "sessionId": "…",
  "text": "…",
  "model": "…",
  "stopReason": "end_turn",
  "usage": {"input_tokens": 1820, "output_tokens": 214},
  "toolCount": 3,
  "estimatedCostUsd": 0.0087,
  "deniedCalls": 0
}

stream-json prints one event per line as the turn runs, starting with system.init and ending with result, which carries the same object as json. The events are those in the event catalogue. Image data is redacted and very long strings are truncated.

Shell
uv run python -m tess_core run -p "Run the tests and report" --provider anthropic \
    --output-format stream-json | jq -r 'select(.event == "tool.started") | .data.name'

Exit codes

CodeMeaning
0The turn completed
1The turn failed or was cancelled, or the provider has no credential
2A tool call needed approval, was refused because the command cannot ask, and that tool never then ran successfully.

Permissions without a person

Nobody is there to answer a prompt, so a call that would ask is refused. A model that is refused one form of a command often succeeds with another, and that run is not a failure: the command exits with 2 only when a refused tool never ran successfully afterwards. The deniedCalls field of the result counts every refusal either way. Decide the authority up front. There are three levers:

Which tools exist. The tool options take tool names and decide what the model can call at all. They do not take permission rules: --allowed-tools "Bash(git diff:*)" is refused with an explanation. A read-only review needs nothing else:

Shell
uv run python -m tess_core run -p "Review src/ for bugs" --provider anthropic \
    --tools Read,Glob,Grep

Which calls are allowed. Permission rules live in <runtime-home>/settings/config.yaml:

YAML
permissions:
  allow:
    - Bash(pytest:*)
    - Bash(git diff:*)
Shell
uv run python -m tess_core run -p "Fix the failing test. Run the tests with: pytest -q" \
    --provider anthropic --runtime-home ./ci-agent --permission-mode acceptEdits

The model is not shown your rules, and an allow rule matches one spelling of a command: Bash(pytest:*) allows pytest -q but not python -m pytest or uv run pytest. Say in the prompt which commands to use, or add a rule for each spelling you accept. A command joined to another with a pipe or && is never covered by an allow rule. Models often try such a form first, are refused, and then use the allowed one; the run then exits 0 and reports the refusal in deniedCalls.

The mode. --permission-mode sets how everything not covered by a rule is treated. See Security for the modes and the rule syntax.

Continuing a conversation

Shell
uv run python -m tess_core run -p "Start a changelog entry" --provider anthropic --output-format json \
    | jq -r .sessionId > session.txt
uv run python -m tess_core run -p "Add the migration notes" --session "$(cat session.txt)"

In CI

Keep a runtime home with its settings in the repository, for example ci-agent/settings/config.yaml holding the allow rules above, and point the command at it. Ignore everything in that directory except settings/:

YAML
- name: Agent review
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
  run: |
    uv run python -m tess_core run \
      -p "Review the diff against origin/main. Reply with a list of problems, or 'OK'." \
      --provider anthropic --tools Read,Glob,Grep,Bash \
      --runtime-home ci-agent --no-session-persistence

What the command does not do

It runs one conversation and exits. A sub-agent or background task the model starts runs only while the command does, and is stopped when it exits. Work that must outlive a turn, the scheduler and monitors need a running runtime; use start_runtime for those.

Found a mistake? Edit this page on GitHub.