Skip to main content

A conversational prompting and programming language

Project description

Convo-Lang Python Wrapper (v0.6.3)

PyPI Downloads

A Python wrapper around the Convo-Lang CLI that lets you build conversations in Python and execute them via the official Convo-Lang engine.

Status: 0.6.3 – basic conversation building, runtime variables support, and single-shot completion via the CLI.


Features

  • Minimal, Pythonic API to build conversations (system, user, assistant)
  • Execute full .convo files directly from Python via add_convo_file()
  • One-line complete() to run via Convo-Lang CLI, with optional runtime variables via complete(variables={...})
  • Automatic JSON handling when passing data between agents (no manual serialization)
  • Clean multi-agent pipelines by chaining structured outputs between .convo agents
  • Simple config with env passthrough (e.g., OPENAI_API_KEY) and defaultModel
  • Zero server code required — uses the official Convo-Lang CLI under the hood

Installation

1. Install Node.js and npm

The wrapper depends on the Convo-Lang CLI, which requires Node.js.
Download and install the latest LTS version of Node.js (includes npm):

Verify installation:

node -v
npm -v

2. Install the Convo-Lang CLI

npm i -g @convo-lang/convo-lang-cli

This makes the convo binary available in your PATH.

3. Install the Python wrapper

pip install convo-lang

Quick Start

from convo_lang import Conversation

OPENAI_API_KEY = "sk-proj-EMA"
defaultModel = "gpt-5"
convo = Conversation(
    config={
        "env": {"OPENAI_API_KEY": OPENAI_API_KEY},
        "defaultModel": defaultModel,
    }
)
convo.add_system_message("You are a home automation assistant.")
convo.add_user_message("It's time for bed, can you turn off the lights")
answer = convo.complete()
print(answer)

Passing Variables to .convo

You can pass variables to the Convo-Lang runtime using the variables argument of complete(). These variables can be referenced inside your .convo script.

from convo_lang import Conversation

convo = Conversation(
    config={
        "env": {"OPENAI_API_KEY": OPENAI_API_KEY},
        "defaultModel": defaultModel,
    }
)

convo.add_convo_text(convo_text)

answer = convo.complete(variables={"isNewVisitor": True})
print(answer)

Variables are forwarded to the Convo-Lang CLI via --vars and support booleans, numbers, and strings.

If a variable value is a JSON string or a Python dict/list serialized to JSON, Convo-Lang will automatically treat it as structured JSON inside .convo and allow passing it between agents without manual parsing.


Passing Data Between Agents

You can pass structured data (JSON) between agents directly.

  • If you pass a Python dict/list (or a JSON string) as a variable, it will be available as JSON inside .convo.
  • When an agent returns structured output, it can be forwarded to the next agent as-is.
  • No manual serialization/deserialization is required.
convo_candidate_profile_analyzer = Conversation(agent_configs)
convo_candidate_profile_analyzer.add_convo_file(
    "agents/candidateProfileAnalyzer.convo"
)
profile_data = convo_candidate_profile_analyzer.complete(
    variables={"candidate_profile": candidate_profile}
)

convo_profile_job_matcher = Conversation(agent_configs)
convo_profile_job_matcher.add_convo_file("agents/profileJobMatcher.convo")
match_data = convo_profile_job_matcher.complete(
    variables={"profile_data": profile_data}
)

This enables clean multi-agent pipelines where each agent consumes the structured output of the previous one.


Loading Entire .convo Files

You can load an entire .convo file as-is, without extracting or embedding parts of it into Python strings:

convo = Conversation(config)
convo.add_convo_file("path/to/agent.convo")
result = convo.complete()

This is the recommended approach for real projects:

  • The full .convo file is executed by the CLI unchanged
  • Prompt logic, control flow, and conditions live entirely in .convo
  • Python is used only for orchestration and data passing
  • .convo files can be versioned, reviewed, and tested independently

Requirements

  • Python 3.8+
  • Node.js 18+ and npm
  • Convo-Lang CLI: npm i -g @convo-lang/convo-lang-cli
  • At least one LLM provider API key in the environment (e.g., OPENAI_API_KEY)

Authors

Maintainers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

convo_lang-0.6.3.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

convo_lang-0.6.3-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file convo_lang-0.6.3.tar.gz.

File metadata

  • Download URL: convo_lang-0.6.3.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0rc2

File hashes

Hashes for convo_lang-0.6.3.tar.gz
Algorithm Hash digest
SHA256 8fb41cc13ea3e64b5639ddc3a35c5c39f531f2bd059c8ec684947f79767e4d9a
MD5 be40ffcc549604ef58eac3cb7d9980c4
BLAKE2b-256 9e35e12a76d181b78cfa7f7979c50dff509e292900bef38c7cfa021512ba6186

See more details on using hashes here.

File details

Details for the file convo_lang-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: convo_lang-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0rc2

File hashes

Hashes for convo_lang-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 41fe3e6dd1abe044e4cfd9fd2b3d03540b9f7952a30e868b708cda735f3117c9
MD5 7ad041c85044bc61f818772f350a1040
BLAKE2b-256 d3202a6c042d0bc964368f1e39704e470abc1be0ffcd70288df11a396f1a62fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page