MainSequence CLI
This page gives a practical overview of the mainsequence command-line interface.
For command-by-command behavior, use --help (for example: mainsequence project --help).
For a deeper workflow guide, see CLI Deep Dive.
Installation
pip install mainsequence
Authentication
mainsequence login
mainsequence login 127.0.0.1:8000 mainsequence-dev
mainsequence login --no-open
mainsequence login --access-token "$TOKEN" --refresh-token "$REFRESH"
mainsequence login --access-token "$TOKEN" --refresh-token "$REFRESH" --backend http://127.0.0.1:80 --projects-base mainsequence-dev
mainsequence logout
Backend/base-folder overrides passed to login are terminal-session only. They do not rewrite the persisted CLI settings for other terminals.
When no backend is provided, mainsequence login targets the standard production backend.
By default, mainsequence login persists auth tokens for later CLI commands:
- macOS: secure OS storage
- Linux and other platforms without secure-store support: local CLI auth storage under the MainSequence config directory
You only need --export if you explicitly want shell-managed environment variables.
If you prefer shell-managed environment variables:
mainsequence login --export
mainsequence login --access-token "$TOKEN" --refresh-token "$REFRESH" --export
mainsequence logout --export
Structured Output
Commands that return a structured object or a list of objects also accept --json.
The flag is global and can be placed after the command you are running, for example:
mainsequence user --json
mainsequence agent list --json
mainsequence project images list --json
mainsequence cc workspace detail 7 --json
mainsequence sdk latest --json
mainsequence project current --json
mainsequence project sdk-status --path . --json
When the underlying SDK result is a Pydantic model, the CLI serializes it through the model's JSON dump path before printing.
Core Command Groups
Top-Level Commands
mainsequence --help
mainsequence doctor
mainsequence constants --help
mainsequence secrets --help
mainsequence agent --help
mainsequence simple_table --help
mainsequence cc --help
mainsequence organization --help
mainsequence skills list
mainsequence skills path
mainsequence skills path project_builder
mainsequence data-node list
mainsequence markets --help
mainsequence user
mainsequence settings show
mainsequence sdk latest
Project Commands
mainsequence project --help
Command Center
mainsequence cc --help
mainsequence cc workspace list
mainsequence cc workspace detail 7
mainsequence cc workspace create "Rates Desk" --description "Shared workspace"
mainsequence cc workspace create --file workspace.json
mainsequence cc workspace update 7 --file workspace.json
mainsequence cc workspace delete 7
mainsequence cc workspace add-label 7 --label trading --label desk
mainsequence cc workspace remove-label 7 --label old-layout
mainsequence cc registered_widget_type list
mainsequence cc registered_widget_type detail main-sequence-data-node
mainsequence cc registered_widget_type list --filter widget_id=markdown-note
mainsequence cc registered_widget_type list --show-filters
mainsequence cc connection_type list
mainsequence cc connection_type detail postgres
mainsequence cc connection list
mainsequence cc connection detail warehouse-primary
Command Center commands are grouped under cc:
workspacecreate, detail, update, list, and delete shared workspacesregistered_widget_typeinspect the widget catalog available to workspaces, including widget-type detail by uniquewidget_idrather than backend rowidconnection_typeinspect the Command Center connection catalog by stable connectiontype_idconnectioninspect configured Command Center connection instances by stable connectionuid
For widget-specific workspace mutations, prefer the SDK workspace methods instead of rewriting the full workspace document:
Workspace.patch_workspace_widget(...)Workspace.delete_workspace_widget(...)Workspace.move_workspace_widget(...)
Those methods mutate one mounted widget instance directly without requiring a full workspace fetch/update round-trip.
Most frequently used flows:
# Markets
mainsequence agent list
mainsequence agent detail 12
mainsequence agent create "Research Copilot" --agent-unique-id research-copilot --description "Desk agent"
mainsequence agent get_or_create "Research Copilot" --agent-unique-id research-copilot --description "Desk agent"
mainsequence agent allocate_a2a_target_session 12 801
mainsequence agent allocate_a2a_target_session 12 801 --handle-unique-id delegated-handle-1
mainsequence agent get_latest_session 12
mainsequence agent session detail 801
mainsequence agent can_view 12
mainsequence agent can_edit 12
mainsequence agent add_to_view 12 7
mainsequence agent add_to_edit 12 7
mainsequence agent add_team_to_view 12 9
mainsequence agent add_team_to_edit 12 9
mainsequence agent remove_from_view 12 7
mainsequence agent remove_from_edit 12 7
mainsequence agent remove_team_from_view 12 9
mainsequence agent remove_team_from_edit 12 9
mainsequence agent delete 12
mainsequence agent run list
mainsequence agent run detail 501
mainsequence constants list
mainsequence constants list --show-filters
mainsequence constants create APP__MODE production
mainsequence constants create ASSETS__MASTER '{"dataset":"bloomberg"}'
mainsequence constants can_view 42
mainsequence constants can_edit 42
mainsequence constants add_to_view 42 7
mainsequence constants add_to_edit 42 7
mainsequence constants add_team_to_view 42 9
mainsequence constants add_team_to_edit 42 9
mainsequence constants remove_from_view 42 7
mainsequence constants remove_from_edit 42 7
mainsequence constants remove_team_from_view 42 9
mainsequence constants remove_team_from_edit 42 9
mainsequence constants delete 42
mainsequence secrets list
mainsequence secrets list --show-filters
mainsequence secrets create API_KEY super-secret-value
mainsequence secrets can_view 42
mainsequence secrets can_edit 42
mainsequence secrets add_to_view 42 7
mainsequence secrets add_to_edit 42 7
mainsequence secrets add_team_to_view 42 9
mainsequence secrets add_team_to_edit 42 9
mainsequence secrets remove_from_view 42 7
mainsequence secrets remove_from_edit 42 7
mainsequence secrets remove_team_from_view 42 9
mainsequence secrets remove_team_from_edit 42 9
mainsequence secrets delete 42
mainsequence project search tutorial
mainsequence organization github-organizations
mainsequence organization teams list
mainsequence organization teams list --show-filters
mainsequence organization teams create Research --description "Model validation"
mainsequence organization teams edit 9 --name "Research Core" --inactive
mainsequence organization teams can_view 9
mainsequence organization teams can_edit 9
mainsequence organization teams add_to_view 9 7
mainsequence organization teams add_to_edit 9 7
mainsequence organization teams remove_from_view 9 7
mainsequence organization teams remove_from_edit 9 7
mainsequence organization teams delete 9
mainsequence simple_table list
mainsequence simple_table list --filter namespace=pytest_alice
mainsequence simple_table detail 41
mainsequence simple_table add-label 41 --label reference-data
mainsequence simple_table remove-label 41 --label deprecated
mainsequence simple_table delete 41
mainsequence data-node list
mainsequence data-node list --show-filters
mainsequence data-node list --filter namespace=pytest_alice
mainsequence data-node list --filter id__in=42,43
mainsequence data-node list --data-source-id 2
mainsequence data_node search "close price"
mainsequence data-node search "close price" --data-source-id 2
mainsequence data-node search "portfolio weights" --mode description
mainsequence data-node search close --mode column
mainsequence data-node detail 123
mainsequence data-node refresh-search-index 123
mainsequence data-node add-label 123 --label curated
mainsequence data-node remove-label 123 --label legacy
mainsequence data-node can_view 123
mainsequence data-node can_edit 123
mainsequence data-node add_to_view 123 7
mainsequence data-node add_to_edit 123 7
mainsequence data-node add_team_to_view 123 9
mainsequence data-node add_team_to_edit 123 9
mainsequence data-node remove_from_view 123 7
mainsequence data-node remove_from_edit 123 7
mainsequence data-node remove_team_from_view 123 9
mainsequence data-node remove_team_from_edit 123 9
mainsequence data-node delete 123
mainsequence data-node delete 123 --full-delete-selected
mainsequence data-node delete 123 --full-delete-selected --override-protection
mainsequence markets portfolios list
mainsequence markets portfolios list --filter id__in=42
mainsequence markets asset-translation-table list
mainsequence markets asset-translation-table list --show-filters
mainsequence markets asset-translation-table detail 12
# 1) List and create
mainsequence project list
mainsequence project add-label 123 --label rates --label research
mainsequence project remove-label 123 --label legacy
mainsequence project can_view 123
mainsequence project can_edit 123
mainsequence project add_to_view 123 7
mainsequence project add_to_edit 123 7
mainsequence project add_team_to_view 123 9
mainsequence project add_team_to_edit 123 9
mainsequence project remove_from_view 123 7
mainsequence project remove_from_edit 123 7
mainsequence project remove_team_from_view 123 9
mainsequence project remove_team_from_edit 123 9
mainsequence project images list
mainsequence project images list 123
mainsequence project images list --show-filters
mainsequence project images list --filter project_repo_hash__in=4a1b2c3d,5e6f7a8b
mainsequence project create tutorial-project
mainsequence project images create
mainsequence project images create 123
mainsequence project images create 123 4a1b2c3d
mainsequence project images create 123 --timeout 600 --poll-interval 15
mainsequence project jobs list
mainsequence project jobs runs list 91
mainsequence project jobs runs logs 501
mainsequence project jobs runs logs 501 --max-wait-seconds 900
mainsequence project jobs run 91
mainsequence project jobs run 91 --arg demo-from-cli
mainsequence project jobs run 91 -- --name demo-from-cli
mainsequence project jobs create --name daily-run --execution-path scripts/test.py
mainsequence project schedule_batch_jobs scheduled_jobs.yaml
mainsequence project schedule_batch_jobs scheduled_jobs.yaml --strict
mainsequence project data-node-updates list
mainsequence project data-node-updates list 123
mainsequence project project_resource list
mainsequence project project_resource list --show-filters
mainsequence project project_resource list --filter resource_type=dashboard
mainsequence project project_resource list --filter resource_type=fastapi
mainsequence project project_resource create_fastapi
mainsequence project project_resource create_fastapi 123
mainsequence project project_resource delete_fastapi 701
mainsequence project project_resource delete_fastapi 701 --yes
mainsequence project validate-name "Rates Platform"
mainsequence cc workspace add-label 7 --label trading --label desk
mainsequence cc workspace remove-label 7 --label old-layout
# 2) Set up locally
mainsequence project set-up-locally 123
mainsequence project refresh_token
# 3) Environment setup
mainsequence project build_local_venv
mainsequence project build_local_venv --path .
mainsequence project freeze-env --path .
mainsequence project update AGENTS.md
mainsequence project update AGENTS.md --path .
mainsequence project update_agent_skills
mainsequence project update_agent_skills --path .
# 4) Day-to-day sync
mainsequence project sync "Update environment"
mainsequence project sync --path . -m "Update environment"
# 5) Docker/devcontainer
mainsequence project build-docker-env --path .
# 6) SDK maintenance
mainsequence project sdk-status --path .
mainsequence project update-sdk --path .
List Filters
Most list commands accept the same generic filter interface:
mainsequence <...> list --show-filters
mainsequence <...> list --filter KEY=VALUE
mainsequence <...> list --filter KEY=VALUE --filter OTHER_KEY=VALUE
Rules:
- Allowed filters are taken from the backing SDK model
FILTERSET_FIELDS. - Value expectations are derived from
FILTER_VALUE_NORMALIZERS. __infilters accept comma-separated values such asid__in=1,2,3.- Some commands always apply scoping filters internally and will reject attempts to override them.
mainsequence project images listalways scopes by the selected project.mainsequence project project_resource listalways scopes by project and upstream remoterepo_commit_sha.mainsequence project jobs runs listalways scopes byjob__id.- If a command's backing model does not expose filter metadata,
--show-filterswill tell you that no additional model filters are available. mainsequence constants listexposes filters fromConstant.FILTERSET_FIELDS, currentlynameandname__in.mainsequence secrets listexposes filters fromSecret.FILTERSET_FIELDS, currentlynameandname__in.
Settings
mainsequence settings show
mainsequence settings set-base ~/mainsequence
mainsequence settings set-backend <backend-url>
mainsequence settings reset
mainsequence settings refresh
Skills
mainsequence skills list
mainsequence skills list --json
mainsequence skills path
mainsequence skills path project_builder
mainsequence skills path command_center/workspace_builder
mainsequence skills path workspace_builder
mainsequence skills path workspace_builder --json
Troubleshooting
- Run
mainsequence doctorto check config, auth visibility, and tool availability. - If a command says not logged in, run
mainsequence loginagain. mainsequence loginpersists tokens for later CLI runs. Use--exportonly when you explicitly want shell-managed auth variables instead.mainsequence skills listlists installed scaffold skills from the current CLI installation by recursively discoveringSKILL.mdfiles under the installedagent_scaffoldbundle.mainsequence skills pathwith no argument prints the installedagent_scaffold/skillsdirectory for the current CLI installation.mainsequence skills path <skill_name>prints the installedSKILL.mdpath for one scaffold skill from the current CLI installation. It accepts full relative skill names such ascommand_center/workspace_builderand unique leaf names such asworkspace_builder.mainsequence usershows the authenticated MainSequence user through the SDK clientUser.get_logged_user()path.- in standalone authenticated CLI or script code that is not request-bound, prefer
User.get_authenticated_user_details()overUser.get_logged_user().User.get_logged_user()is for request-bound identity contexts such as FastAPI middleware, Streamlit, or code that explicitly binds_CURRENT_AUTH_HEADERS. mainsequence project search "<QUERY>"searches visible projects through the SDK clientProject.quick_search()path and returnsid,project_name,repository_branch, andcluster_idfor matching rows.mainsequence project searchrequires at least 3 query characters. The backend does substring matching onproject_name, and if the query is numeric it also matches an exact project id.mainsequence organization teams listlists teams through the SDK clientTeam.filter()path.mainsequence organization teams create,edit, anddeleteuse the SDK clientTeam.create(),Team.patch(), andTeam.delete()paths.mainsequence organization teams can_viewandcan_editinspect team access through the SDKTeam.can_view()andTeam.can_edit()paths.mainsequence organization teams add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate explicit user access on teams through the SDKTeampermission-action paths.mainsequence agent list,detail,create,get_or_create,allocate_a2a_target_session,get_latest_session, anddeleteuse the SDK clientmainsequence.client.agent_runtime_models.Agentpaths.mainsequence agent session detailuses the SDK clientmainsequence.client.agent_runtime_models.AgentSessionpath.mainsequence agent can_viewandcan_editinspect agent sharing through the SDKShareableObjectMixinaccess-state paths onAgent.mainsequence agent add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate explicit user access on agents through the SDKShareableObjectMixinpermission-action paths.mainsequence agent add_team_to_view,add_team_to_edit,remove_team_from_view, andremove_team_from_editmutate explicit team access on agents through the SDKShareableObjectMixinteam-action paths.mainsequence agent run listanddetailuse the SDK clientmainsequence.client.agent_runtime_models.AgentRunpaths for runtime inspection.mainsequence agent_runtimeis kept as a compatibility alias for theagent runcommand group.mainsequence simple_table listlists simple table storages through the SDK clientSimpleTableStorage.filter()path.mainsequence simple_table list --filter namespace=...is the first-class CLI form for narrowing simple table storages by storage namespace.mainsequence simple_table detailfetches one simple table storage throughSimpleTableStorage.get()and renders its schema/configuration in the terminal.mainsequence simple_table add-labelandremove-labelmutateSimpleTableStoragelabels through the SDKLabelableObjectMixinpath. Labels are organizational metadata only and do not affect runtime behavior or functionality.mainsequence simple_table deletedeletes a simple table storage through the SDK clientSimpleTableStorage.delete()path and always requires typed verification before the delete call is sent.mainsequence constants listlists constants through the SDK clientConstant.filter()path.mainsequence constants createcreates a constant through the SDK clientConstant.create()path and only acceptsnameandvalue.mainsequence constants can_viewlists users returned by the SDKShareableObjectMixin.users_can_view()path forConstant.mainsequence constants can_editlists users returned by the SDKShareableObjectMixin.users_can_edit()path forConstant.mainsequence constants add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate constant user sharing through the SDKShareableObjectMixinpaths and render the resulting permission state in the terminal.mainsequence constants add_team_to_view,add_team_to_edit,remove_team_from_view, andremove_team_from_editmutate constant team sharing through the SDKShareableObjectMixinteam-action paths.mainsequence constants deletedeletes a constant through the SDK clientConstant.delete()path and always requires typed verification before the delete call is sent.- Constant names that include a double underscore display the prefix before
__as the terminal category. Example:ASSETS__MASTERis shown under categoryASSETS. mainsequence secrets listlists secrets through the SDK clientSecret.filter()path.mainsequence secrets createcreates a secret through the SDK clientSecret.create()path and only acceptsnameandvalue.mainsequence secrets can_viewlists users returned by the SDKShareableObjectMixin.users_can_view()path forSecret.mainsequence secrets can_editlists users returned by the SDKShareableObjectMixin.users_can_edit()path forSecret.mainsequence secrets add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate secret user sharing through the SDKShareableObjectMixinpaths and render the resulting permission state in the terminal.mainsequence secrets add_team_to_view,add_team_to_edit,remove_team_from_view, andremove_team_from_editmutate secret team sharing through the SDKShareableObjectMixinteam-action paths.mainsequence secrets deletedeletes a secret through the SDK clientSecret.delete()path and always requires typed verification before the delete call is sent.- Secret list and delete previews intentionally show metadata only, not secret values.
mainsequence data-node listlists data node storages through the SDK clientDataNodeStorage.filter()path.mainsequence data-node list --show-filtersprints the filters exposed byDataNodeStorage.FILTERSET_FIELDSand the expected value shapes fromFILTER_VALUE_NORMALIZERS.mainsequence data-node list --filter namespace=...is the first-class CLI form for narrowing data node storages by storage namespace.mainsequence data-node list --data-source-id 2is the first-class shortcut for the commondata_source__idfilter.mainsequence data-node searchis the public search command for data nodes. It can search descriptions, columns, or both through the SDK clientDataNodeStorage.description_search()andDataNodeStorage.column_search()paths.mainsequence data-node search --mode descriptiononly usesDataNodeStorage.description_search().mainsequence data-node search --mode columnonly usesDataNodeStorage.column_search().mainsequence data-node search --data-source-id 2is the first-class shortcut for filtering search results by data source.mainsequence data-node searchsupports the same--filter KEY=VALUEand--show-filterspattern asdata-node list, based onDataNodeStorage.FILTERSET_FIELDSandFILTER_VALUE_NORMALIZERS.mainsequence data-node detailfetches one storage throughDataNodeStorage.get()and renders its configuration in the terminal.mainsequence data-node refresh-search-indexcalls the SDK instance methodDataNodeStorage.refresh_table_search_index()for one storage and prints the backend response in the terminal.mainsequence data-node add-labelandremove-labelmutateDataNodeStoragelabels through the SDKLabelableObjectMixinpath. Labels are organizational metadata only and do not affect runtime behavior or functionality.mainsequence project search "<QUERY>"is the first-class CLI command for finding existing projects before creation or local setup. Use it for fuzzy discovery, then usemainsequence project validate-name "<PROJECT_NAME>"for the exact create-time availability check.mainsequence project validate-name "<PROJECT_NAME>"validates a candidate project name through the SDK clientProject.validate_name()path, prints normalized names and suggestions, and exits non-zero when the name is unavailable.mainsequence project update AGENTS.mdis project-scoped. It resolves the target project first, then readsAGENTS.mdfrom the running CLI's installedagent_scaffoldbundle. This command does not require the target project's.venv. If the target file is missing, it creates it from that installed bundle. If an existingAGENTS.mdhas no Main Sequence managed marker, the command replaces the whole file. If the managed marker exists, the command updates only that managed block.mainsequence project update_agent_skillsis project-scoped. It resolves the target project first, then copies every top-level skill folder from that project's installedagent_scaffold/skills/bundle in.venvinto.agents/skills/mainsequence/, overwriting only folders with the same names under that namespace. It does not copy bundle-root files such asAGENTS.md, and it does not remove existing top-level project skills under.agents/skills/.mainsequence data-node can_viewlists users returned by the SDKShareableObjectMixin.can_view()path forDataNodeStorage.mainsequence data-node can_editlists users returned by the SDKShareableObjectMixin.can_edit()path forDataNodeStorage.mainsequence data-node add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate data-node user sharing through the SDKShareableObjectMixinpaths and render the resulting permission state in the terminal.mainsequence data-node add_team_to_view,add_team_to_edit,remove_team_from_view, andremove_team_from_editmutate data-node team sharing through the SDKShareableObjectMixinteam-action paths.mainsequence data-node deleteexecutes the SDK clientDataNodeStorage.delete()path and exposes the same delete flags as the client:full_delete_selected,full_delete_downstream_tables,delete_with_no_table, andoverride_protection.mainsequence data-node deletealways requires typed verification before the delete call is sent.mainsequence markets portfolios listlists markets portfolios through the SDK clientPortfolio.filter()path.mainsequence markets asset-translation-table listlists translation tables through the SDK clientAssetTranslationTable.filter()path.mainsequence markets asset-translation-table detailfetches one translation table throughAssetTranslationTable.get()and renders each rule as a readablematch => targetmapping in the terminal.mainsequence project images listlists project images using the SDK clientProjectImage.filter()path.ProjectImageresponses include backend metadata such ascreation_date, and the SDK model accepts that field.- All list commands share the same
--filter KEY=VALUEand--show-filterspattern. Commands that already enforce scoping filters reject overriding those keys. mainsequence project images createonly accepts pushed commits forproject_repo_hash. If omitted, it lists commits from the current branch upstream (or remote refs as fallback), shows which commits already have image ids, and waits untilis_ready=trueby polling every 30 seconds for up to 5 minutes by default.mainsequence project jobs listlists project jobs through the SDK clientJob.filter()path.mainsequence project jobs listshows a human-readable schedule summary fromtask_schedule.mainsequence project data-node-updates listlists data node updates through the SDK clientProject.get_data_nodes_updates()path.mainsequence project add-labelandremove-labelmutateProjectlabels through the SDKLabelableObjectMixinpath. Labels are organizational metadata only and do not affect runtime behavior or functionality.mainsequence project can_viewlists users returned by the SDKShareableObjectMixin.users_can_view()path forProject.mainsequence project can_editlists users returned by the SDKShareableObjectMixin.users_can_edit()path forProject.mainsequence project add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate project user sharing through the SDKShareableObjectMixinpaths and render the resulting permission state in the terminal.mainsequence project add_team_to_view,add_team_to_edit,remove_team_from_view, andremove_team_from_editmutate project team sharing through the SDKShareableObjectMixinteam-action paths.mainsequence project project_resource listlists project resources through the SDK clientProjectResource.filter()path and always appliesrepo_commit_shafrom the current upstream branch head.mainsequence cc workspace add-labelandremove-labelmutateWorkspacelabels through the SDKLabelableObjectMixinpath. Labels are organizational metadata only and do not affect runtime behavior or functionality.mainsequence project syncperforms the local uv/git sync flow and, after a successful push, calls the SDK clientProject.sync_project_after_commit()path for the resolved project id.mainsequence project jobs runs listlists job-run history through the SDK clientJobRun.filter(job__id=[job_id])path.mainsequence project jobs runs logsfetches logs through the SDK clientJobRun.get_logs()path, polls every 30 seconds by default while the job run isPENDINGorRUNNING, and stops after 10 minutes unless you override--max-wait-secondsor disable it with--max-wait-seconds 0.mainsequence project jobs runtriggers a manual run through the SDK clientJob.run_job()path.mainsequence project jobs run --arg ...appends per-run args to the saved job entrypoint; it does not replace the savedexecution_pathorapp_name.mainsequence project jobs run -- --name demo-from-cliis the preferred form when an appended arg itself starts with-.mainsequence project jobs createcreates jobs through the SDK clientJob.create()path, requires a project image, expectsexecution_pathrelative to the content root, for examplescripts/test.py, builds interval or crontab schedules interactively when requested, and defaults compute settings tocpu_request=0.25,memory_request=0.5,spot=false,max_runtime_seconds=86400when omitted.mainsequence project schedule_batch_jobsvalidates a repository-managedscheduled_jobs.yamlfile and submits the batch through the SDK clientJob.bulk_get_or_create()path.mainsequence project schedule_batch_jobsexpects a top-leveljobslist, resolves the project id from the argument or local.env, lets you choose one project image for the whole batch, and supports--strictwhen the file should act as the full desired state.