Skip to main content

Hello World

A ready-to-run example is available here.

Your first agent​

This is the most basic example showing how to set up and run an Faheem Code agent.

LLM Configuration​

Configure the language model that will power your agent:

llm = LLM(
model=model,
api_key=SecretStr(api_key),
base_url=base_url, # Optional
service_id="agent"
)

Select an Agent​

Use the preset agent with common built-in tools:

agent = get_default_agent(llm=llm, cli_mode=True)

The default agent includes BashTool, FileEditorTool, etc.

Start a Conversation​

Start a conversation to manage the agent's lifecycle:

conversation = Conversation(agent=agent, workspace=cwd)
conversation.send_message(
"Write 3 facts about the current project into FACTS.txt."
)
conversation.run()

Expected Behavior​

When you run this example:

  1. The agent analyzes the current directory
  2. Gathers information about the project
  3. Creates FACTS.txt with 3 relevant facts
  4. Completes and exits

Example output file:

FACTS.txt
---------
1. This is a Python project using the Faheem Code SDK.
2. The project includes examples demonstrating various agent capabilities.
3. The SDK provides tools for file manipulation, bash execution, and more.

Ready-to-run example​

import os

from faheemcode.sdk import LLM, Agent, Conversation, Tool
from faheemcode.tools.file_editor import FileEditorTool
from faheemcode.tools.task_tracker import TaskTrackerTool
from faheemcode.tools.terminal import TerminalTool

llm = LLM(
model=os.getenv("LLM_MODEL", "anthropic/claude-sonnet-4-5-20250929"),
api_key=os.getenv("LLM_API_KEY"),
base_url=os.getenv("LLM_BASE_URL", None),
)

agent = Agent(
llm=llm,
tools=[
Tool(name=TerminalTool.name),
Tool(name=FileEditorTool.name),
Tool(name=TaskTrackerTool.name),
],
)

cwd = os.getcwd()
conversation = Conversation(agent=agent, workspace=cwd)

conversation.send_message("Write 3 facts about the current project into FACTS.txt.")
conversation.run()
print("All done!")

You can run the example code as-is.

Bring your own provider key
export LLM_API_KEY="your-api-key"
export LLM_MODEL="anthropic/claude-sonnet-4-5-20250929" # or openai/gpt-4o, etc.
cd software-agent-sdk
uv run python examples/01_standalone_sdk/01_hello_world.py
Faheem Code Cloud key
# https://app.faheemcode.ai/settings/api-keys
export LLM_API_KEY="example-user-api-key"
export LLM_MODEL="faheemcode/claude-sonnet-4-5-20250929"
cd software-agent-sdk
uv run python examples/01_standalone_sdk/01_hello_world.py

Next steps​