Python quickstart
A source-correct, no-network first success in Python.
Start with an operation that needs no model, network, identity seed, or wallet. This verifies the actual Python message API before adding a provider or tools.
Prerequisites
Python 3.11 or later. The distribution is named forge-sdk, while imports begin with forge. The package root does not re-export all SDK classes.
Use a source checkout
The paths below assume the Forge checkout is beside your application. Adjust the local path to your workspace. Registry publication is not inferred from the package name.
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -e ./forge/forge-pyFirst success
Save this in your application's entry point after resolving forge.core.
from forge.core.message import ModelMessage, Role
message = ModelMessage.text(Role.USER, "Hello, Forge")
assert message.text_content() == "Hello, Forge"
print(message.text_content())Expected output: Hello, Forge. This checks message construction and text extraction only; it does not call an LLM.
Add an agent
AgentConfig takes model_ref, system_prompt, max_steps, and generation options. ToolLoopAgent separately takes the config, model, tool registry, and tool executor. await agent.run(input_text) returns an AgentOutput with text, messages, steps, and usage. The run owns lifecycle transitions. Handle Forge errors at the application boundary.
Verify the source
The example uses declarations from the message declarations. Package metadata comes from forge-py/pyproject.toml.