Skip to main content

Prerequisites

  • Python 3.9+
  • An OpenAI API key (or any supported model provider)
  • Git

Step 1: Install GitAgent

pip install gitagent

Step 2: Initialize a new agent

mkdir my-agent && cd my-agent
git init
gitagent init
gitagent init creates the OpenGAP directory structure:
my-agent/
├── agent.yaml
├── skills/
│   └── hello.py
├── hooks/
└── flows/

Step 3: Review the manifest

Open agent.yaml:
name: my-agent
version: "1.0.0"
description: "My first GitAgent"

model:
  provider: openai
  name: gpt-4o
  temperature: 0.0

entrypoint: skills/hello.py

memory:
  enabled: false

Step 4: Look at the sample skill

Open skills/hello.py:
from gitagent import skill

@skill(
    name="greet",
    description="Greet the user by name"
)
def greet(name: str) -> str:
    """Return a personalized greeting."""
    return f"Hello, {name}! I'm your GitAgent."
Skills are plain Python functions decorated with @skill. The description is what the LLM reads to decide when to call it.

Step 5: Set your API key

export OPENAI_API_KEY=sk-...

Step 6: Run the agent

gitagent run "Please greet Alice"
Output:
> Running my-agent
> Calling skill: greet(name="Alice")
> Hello, Alice! I'm your GitAgent.

Step 7: Add a real skill

Replace skills/hello.py with a more useful skill:
from gitagent import skill
import httpx

@skill(
    name="get_weather",
    description="Get the current weather for a city"
)
def get_weather(city: str) -> dict:
    """Fetch current weather data for a city."""
    response = httpx.get(
        "https://wttr.in/{city}?format=j1".format(city=city)
    )
    data = response.json()
    return {
        "city": city,
        "temp_c": data["current_condition"][0]["temp_C"],
        "description": data["current_condition"][0]["weatherDesc"][0]["value"]
    }
Run it:
gitagent run "What's the weather in London?"

Step 8: Commit your agent

git add .
git commit -m "feat: initial agent with weather skill"
Your agent is now version-controlled. Any change to a skill is a reviewable commit.

What’s next

  • Installation — install options, updating, and troubleshooting
  • Agent Structure — full directory layout and manifest reference
  • Skills — skill types, inputs, outputs, and best practices
  • Built-in Tools — tools that come with GitAgent (web search, file ops, etc.)
  • SkillsFlow — compose skills into multi-step workflows