Skip to content

feat: ecosystem architecture enhancements (Graph, Loop, Context, Harness)#28

Open
Patel230 wants to merge 19 commits into
mainfrom
feat/sdk-python-fixes
Open

feat: ecosystem architecture enhancements (Graph, Loop, Context, Harness)#28
Patel230 wants to merge 19 commits into
mainfrom
feat/sdk-python-fixes

Conversation

@Patel230

Copy link
Copy Markdown
Contributor

This PR introduces cross-ecosystem architectural enhancements encompassing Graph Engineering, Loop Engineering, Context Management, and Prompt Frameworks.

What's Included

  • Graph Engineering: StateGraph implementations, A2A protocol support, and Cypher-like DSLs.
  • Loop Engineering: Async exponential backoff and retry handlers with strict context timeout support.
  • Context Engineering: Token budget optimizers prioritizing recent messages and system prompts.
  • Harness Engineering: Test harness wrappers for injecting mocks and running result validations.
  • Prompt Engineering: Secure text templating engines for LLM prompts.

All changes include appropriate edge-case handling for timeouts, cancellations, and state immutability.

Patel230 and others added 19 commits July 23, 2026 20:14
…Response

- Add tool_calls field to ChatResponse so the tool execution loop in
  chat_with_tools/chat_with_tools_async actually triggers (was dead code
  because hasattr check always returned False)
- Replace hasattr guard with direct field access
- Fix example: health.sessions -> health.active_sessions (AttributeError)
- Add [project.optional-dependencies] tracing extra with opentelemetry-api,
  opentelemetry-sdk, and opentelemetry-exporter-otlp
- Fix docstring: decorators are NOT pre-applied to SDK internals; users
  must apply them explicitly. Add pip install hawk-sdk[tracing] instruction
Add system_prompt field to AgentConfig and pass it through to chat
requests. Update docstring to clarify history tracking behavior.
…calls

Previously expected_tools was declared on EvalTask but never checked
during benchmark runs. Now both run_benchmark and run_benchmark_async
extract tool names from the response's tool_calls and verify all
expected tools were invoked, reporting a failure with the missing
tool names if any are absent.
Mirror the Go SDK's ToolChoice field: add tool_choice to ChatRequest
and AgentConfig, wire it through chat kwargs in both sync Agent and
AsyncAgent. Also add parallel_tool_calls to ChatRequest for spec
parity.
…d eval features

The README's API reference was missing the chat_with_tools function,
Agent/AsyncAgent, Toolkit, tracing, Workflow, Plan, and EvalTask features.
Added a tool execution loop section with example, and expanded the Features
list to cover all exported modules.
…op + types

- StreamReader/AsyncStreamReader.events() now wrap iteration in try/finally
  so the underlying httpx response is closed when the caller breaks early
  (previously leaked the connection until GC).
- chat_with_tools / chat_with_tools_async now raise HawkError when the
  tool loop exhausts max_rounds with unexecuted tool calls still pending,
  instead of silently dropping them (matches the TypeScript SDK).
- Add HawkError base exception (non-transport SDK errors) and export it.
- ChatRequest.session_id now enforces the OpenAPI contract: maxLength 128
  and pattern ^[A-Za-z0-9._-]+$ via Pydantic Field constraints.
- Add pytest-cov to dev dependencies (Makefile cover target needs it).
- Tests: chat_with_tools loop (sync+async), max-rounds guard, early-break
  resource cleanup, StreamEventTooLargeError path, session_id validation.
…rdering

- RUF022: Sort __all__ alphabetically in src/hawk/__init__.py
- Add missing CompositeResolver to __all__
- I001: Fix unsorted imports in tests/test_streaming.py
- Pass ruff check clean
- Add graph.py with execution graph implementation
- Add test_graph.py with test coverage
- Update client.py, README, and OpenAPI spec
- Implement Cypher-like Graph Query Language
- Add fluent API for building and querying graphs
- Add BFS, DFS, shortest path, and PageRank algorithms
- Add ContextOptimizer for managing LLM token limits and context windows
- Add TestHarness for validating agent execution outputs and mocking tools
- Apply ruff fixes for python typing
- Add pytest suites verifying token limits and context compaction
- Add pytest suites verifying harness validators and mock injection
- Add pytest suites verifying graph DSL shortest path algorithms
- Replace deprecated typing imports (Dict, List, Set) with builtins
- Migrate Iterator from typing to collections.abc
- Rename shadowing params (id -> node_id, type -> node_type)
- Add missing return type annotations (-> None)
- Add type annotations for **kwargs
- Fix Message.content handling for str | None

Co-Authored-By: Claude <noreply@anthropic.com>
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