Create the evidence record before the narrative
The Python workflow should first resolve stable competition and team IDs, query a bounded match set, and save the structured response with its parameters, request ID, and retrieval timestamp. Assign an internal evidence reference to each retained record. Only then should the model receive the subset needed to answer the research question.
This order matters because citations created after prose tend to become decorative. When the evidence records exist first, the model can attach a reference to each factual claim and the application can verify that reference. A citation should identify the match or collection record and the retrieval, not point vaguely to a homepage.
Keep match facts separate from analysis
Scores, kickoff times, statuses, teams, and competition membership can be source facts when present in the retained JSON. Statements about momentum, tactical strength, expected performance, or likely outcomes are interpretations unless backed by another explicit source. Store and render them in separate sections so readers understand the difference.
The current Stats API contract does not provide odds, expected goals, player performance, lineups, injuries, or a prediction service. A research agent may combine separately licensed evidence in your own system, but it must preserve provenance and rights for each source. It should never describe a model conclusion as if it came from the football API.
evidence_id
query_parameters
request_id
retrieved_at
resource_ids
source_facts[]
inferences[]
citations[]
limitations[]
A handoff your agent can actually follow
Treat an AI agent as a planner and transformer, not as the database. Give it a narrow task, the exact resources it may call, the response fields it may quote, and a stop condition for missing data. Keep bearer credentials in the server-side tool implementation rather than in the prompt, transcript, browser, or generated source file.
The handoff below is deliberately operational. It asks for evidence before prose, makes uncertainty visible, and keeps the model inside the current football API contract. Adapt the output format to your product, but preserve the rules about stable IDs, UTC timestamps, freshness, and error handling.
Use Python server-side and read STATS_API_KEY from the environment.
Store each retrieved response with request parameters and retrieved_at.
Generate citations that point to the retained evidence record.
Place any comparison or interpretation in a separate inferences section.
What the human reviewer still owns
Automation can verify schemas and repeatable checks, but publication and product decisions still need a person. Review the selected competition, season, team, and match IDs; confirm that the time window matches the user’s question; and read the final answer against the retrieved JSON. A fluent explanation is not evidence that the underlying call was correct.
For time-sensitive football AI, record when the source was ingested and when the agent retrieved it. If the workflow cannot establish those timestamps, qualify the result instead of presenting it as current. The same rule applies to unavailable capabilities: do not quietly substitute fixtures or results for lineups, player statistics, odds, expected goals, injuries, or live events.
- Confirm every quoted fact appears in the retained API response.
- Exercise the empty, 401, 404, 429, and 503 paths before launch.
- Keep model interpretation separate from source facts in logs and user-facing output.
- Open every generated citation and confirm the cited record supports the exact sentence, not merely the general topic.
Continue with the contract, not a guess
Start with the public contract and coverage ledger, then move into implementation only when the capability you need is marked available. The related guide gives your next agent-first pattern without requiring an undocumented endpoint.