Skip to content

Turn strava.py chat into a tool-using agent with runlog search#3

Open
sahilds1 wants to merge 1 commit into
mainfrom
2-turn-stravapy-into-an-agent
Open

Turn strava.py chat into a tool-using agent with runlog search#3
sahilds1 wants to merge 1 commit into
mainfrom
2-turn-stravapy-into-an-agent

Conversation

@sahilds1

Copy link
Copy Markdown
Owner

Replace the passive single-shot chat with an agent loop: the conversation now runs llm's tool-calling loop (model.conversation(tools=[...]) + conversation.chain()), so the model can decide mid-conversation to call a tool and act on the result, instead of only answering from the seeded activity JSON.

The agent's first tool is search_runlog, a keyword search over the athlete's running log (RUNLOG.txt, override with --runlog). It lives in a new self-contained strava_tools.py built from pure parse_runlog / search_entries / format_entries helpers, which are the test targets in test_strava_tools.py. Adding a second tool is a one-line change to the tools=[...] list.

format_entries returns self-contained titles + bodies on purpose: with the default OpenAI (Chat Completions) plugin, reasoning state is not preserved across turns or across a tool hop, so the tool's returned text is the only durable state the next turn sees. strava.py carries a comment on this and on the OpenAI Agents SDK as a future extension path.

Also updates SYSTEM_PROMPT to tell the model about the tool and to ground history claims in what it returns, and documents the agent in CLAUDE.md.

Replace the passive single-shot chat with an agent loop: the conversation
now runs llm's tool-calling loop (model.conversation(tools=[...]) +
conversation.chain()), so the model can decide mid-conversation to call a
tool and act on the result, instead of only answering from the seeded
activity JSON.

The agent's first tool is search_runlog, a keyword search over the
athlete's running log (RUNLOG.txt, override with --runlog). It lives in a
new self-contained strava_tools.py built from pure parse_runlog /
search_entries / format_entries helpers, which are the test targets in
test_strava_tools.py. Adding a second tool is a one-line change to the
tools=[...] list.

format_entries returns self-contained titles + bodies on purpose: with the
default OpenAI (Chat Completions) plugin, reasoning state is not preserved
across turns or across a tool hop, so the tool's returned text is the only
durable state the next turn sees. strava.py carries a comment on this and
on the OpenAI Agents SDK as a future extension path.

Also updates SYSTEM_PROMPT to tell the model about the tool and to ground
history claims in what it returns, and documents the agent in CLAUDE.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant