Skip to content

Instantly share code, notes, and snippets.

@jmanhype
Last active October 25, 2025 13:33
Show Gist options
  • Select an option

  • Save jmanhype/629bb48a5f9a358ddff1abc714b349af to your computer and use it in GitHub Desktop.

Select an option

Save jmanhype/629bb48a5f9a358ddff1abc714b349af to your computer and use it in GitHub Desktop.
Modaic JTBD agent push & verification flow

Modaic Hub Push & Verify Flow

Use case: publish the JTBD DSPy agent to Modaic Hub, confirm the revision landed, and sanity-check the hosted build from a clean cache. Format matches our gist shipments (narrative + copy/paste snippets).


πŸ”‘ Environment & Setup

  • Python 3.10+ with the repo installed editable.
  • Export the Modaic + LLM secrets (keep them out of git):
python -m venv .venv && source .venv/bin/activate
pip install -e .

set -a && source .env && set +a  # or export the keys manually

Required variables:

MODAIC_TOKEN=...                     # personal access token
MODAIC_AGENT_ID=straughterguthrie/jtbd-agent
RETRIEVER_KIND=notes
RETRIEVER_NOTES=$'JTBD primer\nMoat checklist\nValidation plan quickstart'
JTBD_DSPY_MODEL=claude-3-5-sonnet-20240620
OPENAI_API_KEY=sk-...

πŸš€ Push the Agent

The helper script wraps JTBDDSPyAgent.push_to_hub(...) and uploads both weights and code.

flowchart LR
    Env[Load .env secrets] --> Build[Instantiate JTBDDSPyAgent]
    Build --> Push["push_to_hub(repo=MODAIC_AGENT_ID)"]
    Push --> Modaic[(Modaic Hub)]
    Modaic --> Log["CLI prints success message"]
Loading
python tools/push_modaic_agent.py

Expected output:

Agent pushed to Modaic Hub: straughterguthrie/jtbd-agent

If either MODAIC_TOKEN or MODAIC_AGENT_ID is missing, the script exits with a warningβ€”no partial state is created.


πŸ”„ Reload & Smoke Test

Force the runtime to pull the remote revision and exercise each tool using the fixture payload.

sequenceDiagram
    participant Dev Shell
    participant Loader as reload_agent
    participant Hub as Modaic Hub
    participant Demo as dogfood_remote_agent

    Dev Shell->>Loader: reload_agent
    Loader->>Hub: fetch latest revision
    Hub-->>Loader: cached repo at ~/.cache/modaic/agents/...
    Dev Shell->>Demo: run dogfood_remote_agent.py
    Demo->>Hub: call_agent_envelope
    Hub-->>Demo: JSON payloads
    Demo-->>Dev Shell: print structured output
Loading
python tools/dogfood_remote_agent.py | jq

You should see JSON blobs for deconstruct, jobs, moat, and judge. Use DEMO_IDEA_PATH=/path/to/custom.json to override the sample.


πŸ” Verify the Hub Revision

Modaic caches hub repos under ~/.cache/modaic/agents/<slug>. Run the snippet below to ensure we can instantiate directly from Modaic and to print the commit that was fetched.

python - <<'PY'
from pathlib import Path
from service.modaic_agent import JTBDDSPyAgent, JTBDConfig

# Work around upstream typing bug so from_precompiled sees JTBDConfig
JTBDDSPyAgent.__annotations__["config"] = JTBDConfig

agent = JTBDDSPyAgent.from_precompiled("straughterguthrie/jtbd-agent")
repo_dir = Path.home() / ".cache/modaic/agents/straughterguthrie/jtbd-agent"
commit = (repo_dir / ".git" / "HEAD").read_text().strip()

print("Loaded agent:", type(agent).__name__)
print("Modaic cache:", repo_dir)
print("HEAD ref:", commit)
PY

To inspect the cached repo directly:

cd ~/.cache/modaic/agents/straughterguthrie/jtbd-agent
git log -1 --oneline

🧾 Optional: Publish as GitHub Gist

gh auth status
gh gist create docs/modaic_push_verification_gist.md \
  -d "Modaic JTBD agent push & verification flow" \
  -p

Attach supporting scripts (tools/push_modaic_agent.py, tools/dogfood_remote_agent.py) if readers need turnkey copies outside the repo.


βœ… Checklist

Step Command Result
Setup pip install -e . & load .env Environment ready
Push python tools/push_modaic_agent.py Agent revision published
Smoke python tools/dogfood_remote_agent.py Remote tools return JSON
Verify JTBDDSPyAgent.from_precompiled(...) Confirms Modaic repo + commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment