trustgraph/tests/unit/test_agent
cybermaggedon 153ae9ad30
Split Analysis into Analysis+ToolUse and Observation, add message_id (#747)
Refactor agent provenance so that the decision (thought + tool
selection) and the result (observation) are separate DAG entities:

  Question ← Analysis+ToolUse ← Observation ← ... ← Conclusion

Analysis gains tg:ToolUse as a mixin RDF type and is emitted
before tool execution via an on_action callback in react().
This ensures sub-traces (e.g. GraphRAG) appear after their
parent Analysis in the streaming event order.

Observation becomes a standalone prov:Entity with tg:Observation
type, emitted after tool execution. The linear DAG chain runs
through Observation — subsequent iterations and the Conclusion
derive from it, not from the Analysis.

message_id is populated on streaming AgentResponse for thought
and observation chunks, using the provenance URI of the entity
being built. This lets clients group streamed chunks by entity.

Wire changes:
- provenance/agent.py: Add ToolUse type, new
  agent_observation_triples(), remove observation from iteration
- agent_manager.py: Add on_action callback between reason() and
  tool execution
- orchestrator/pattern_base.py: Split emit, wire message_id,
  chain through observation URIs
- orchestrator/react_pattern.py: Emit Analysis via on_action
  before tool runs
- agent/react/service.py: Same for non-orchestrator path
- api/explainability.py: New Observation class, updated dispatch
  and chain walker
- api/types.py: Add message_id to AgentThought/AgentObservation
- cli: Render Observation separately, [analysis: tool] labels
2026-03-31 17:51:22 +01:00
..
__init__.py Extending test coverage (#434) 2025-07-14 17:54:04 +01:00
conftest.py Extending test coverage (#434) 2025-07-14 17:54:04 +01:00
test_agent_service_non_streaming.py Split Analysis into Analysis+ToolUse and Observation, add message_id (#747) 2026-03-31 17:51:22 +01:00
test_agent_step_arguments.py MCP auth for the simple case (#557) 2025-11-11 12:28:53 +00:00
test_aggregator.py Update tests for agent-orchestrator (#745) 2026-03-31 13:12:26 +01:00
test_completion_dispatch.py Update tests for agent-orchestrator (#745) 2026-03-31 13:12:26 +01:00
test_conversation_state.py Extending test coverage (#434) 2025-07-14 17:54:04 +01:00
test_explainability_parsing.py Split Analysis into Analysis+ToolUse and Observation, add message_id (#747) 2026-03-31 17:51:22 +01:00
test_mcp_tool_auth.py MCP auth for the simple case (#557) 2025-11-11 12:28:53 +00:00
test_meta_router.py Update tests for agent-orchestrator (#745) 2026-03-31 13:12:26 +01:00
test_pattern_base_subagent.py Update tests for agent-orchestrator (#745) 2026-03-31 13:12:26 +01:00
test_provenance_triples.py Split Analysis into Analysis+ToolUse and Observation, add message_id (#747) 2026-03-31 17:51:22 +01:00
test_react_processor.py master -> 1.5 (README updates) (#552) 2025-10-11 11:46:03 +01:00
test_reasoning_engine.py Extending test coverage (#434) 2025-07-14 17:54:04 +01:00
test_tool_coordination.py Extending test coverage (#434) 2025-07-14 17:54:04 +01:00
test_tool_filter.py Feature/tool group (#484) 2025-09-03 23:39:49 +01:00
test_tool_service.py Tool services - dynamically pluggable tool implementations for agent frameworks (#658) 2026-03-04 14:51:32 +00:00
test_tool_service_lifecycle.py Updated test suite for explainability & provenance (#696) 2026-03-13 14:27:42 +00:00